package com.heketai.website.web;


import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.heketai.website.common.result.BaseResult;
import com.heketai.website.entity.SupplierSelect;
import com.heketai.website.service.ISupplierSelectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zhangYong
 * @since 2026-03-04
 */
@RestController
@RequestMapping("/supplierSelect")
public class SupplierSelectController {


    @Autowired
    private ISupplierSelectService supplierSelectService;

    @RequestMapping("findByPage")
    public BaseResult<Page<SupplierSelect>> findByCompanyName(@RequestBody Page<SupplierSelect> page, @RequestParam("companyName")String companyName){
        EntityWrapper<SupplierSelect> wrapper = new EntityWrapper<SupplierSelect>();
        if ( companyName != null && !companyName.isEmpty()){
            wrapper.like("company_name", companyName).or().like("authority",companyName);
        }
        Page<SupplierSelect> supplierSelectPage = supplierSelectService.selectPage(page, wrapper);
        return BaseResult.successWithData(supplierSelectPage);
    }
}
