package cn.iocoder.yudao.module.system.dal.mysql.supplier;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.system.dal.dataobject.supplier.SupplierDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.system.controller.admin.supplier.vo.*;

/**
 * 供应商列表(OA已审核通过后插入) Mapper
 *
 * @author 艾楷
 */
@Mapper
public interface SupplierMapper extends BaseMapperX<SupplierDO> {

    default PageResult<SupplierDO> selectPage(SupplierPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<SupplierDO>()
                .likeIfPresent(SupplierDO::getSupplierName, reqVO.getSupplierName())
                .eqIfPresent(SupplierDO::getPhone, reqVO.getPhone())
                .eqIfPresent(SupplierDO::getContactPerson, reqVO.getContactPerson())
                .eqIfPresent(SupplierDO::getCompanyAddress, reqVO.getCompanyAddress())
                .eqIfPresent(SupplierDO::getBusinessLicenseNo, reqVO.getBusinessLicenseNo())
                .betweenIfPresent(SupplierDO::getSettlementDate, reqVO.getSettlementDate())
                .eqIfPresent(SupplierDO::getSettlementMethod, reqVO.getSettlementMethod())
                .eqIfPresent(SupplierDO::getCompanyAccount, reqVO.getCompanyAccount())
                .eqIfPresent(SupplierDO::getBankAccountOpeningBank, reqVO.getBankAccountOpeningBank())
                .eqIfPresent(SupplierDO::getFileItems, reqVO.getFileItems())
                .betweenIfPresent(SupplierDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(SupplierDO::getId));
    }

}