package cn.iocoder.yudao.module.customer.dal.mysql.info;

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.customer.dal.dataobject.businessopportunity.CustomerBusinessOpportunityDO;
import cn.iocoder.yudao.module.customer.dal.dataobject.info.CustomerInfoDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.customer.controller.admin.info.vo.*;

/**
 * 客户信息 Mapper
 *
 * @author zhaopq
 */
@Mapper
public interface CustomerInfoMapper extends BaseMapperX<CustomerInfoDO> {

    default PageResult<CustomerInfoDO> selectPage(CustomerInfoPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CustomerInfoDO>()
                .eqIfPresent(CustomerInfoDO::getCustomerId, reqVO.getCustomerId())
                .eqIfPresent(CustomerInfoDO::getCustomerCode, reqVO.getCustomerCode())
                .likeIfPresent(CustomerInfoDO::getCustomerName, reqVO.getCustomerName())
                .eqIfPresent(CustomerInfoDO::getCustomerStatus, reqVO.getCustomerStatus())
                .eqIfPresent(CustomerInfoDO::getCreatorEmployeeId, reqVO.getCreatorEmployeeId())
                .likeIfPresent(CustomerInfoDO::getCreatorEmployeeName, reqVO.getCreatorEmployeeName())
                .eqIfPresent(CustomerInfoDO::getDeptId, reqVO.getDeptId())
                .betweenIfPresent(CustomerInfoDO::getRegistDate, reqVO.getRegistDate())
                .eqIfPresent(CustomerInfoDO::getCapital, reqVO.getCapital())
                .eqIfPresent(CustomerInfoDO::getLegalPerson, reqVO.getLegalPerson())
                .eqIfPresent(CustomerInfoDO::getWorkforce, reqVO.getWorkforce())
                .eqIfPresent(CustomerInfoDO::getTrade, reqVO.getTrade())
                .eqIfPresent(CustomerInfoDO::getCustomerNature, reqVO.getCustomerNature())
                .eqIfPresent(CustomerInfoDO::getCompanyAddress, reqVO.getCompanyAddress())
                .likeIfPresent(CustomerInfoDO::getCustomerPerson, reqVO.getCustomerPerson())
                .likeIfPresent(CustomerInfoDO::getCustomerPersonPhone, reqVO.getCustomerPersonPhone())
                .eqIfPresent(CustomerInfoDO::getCompanyPersonAddress, reqVO.getCompanyPersonAddress())
                .eqIfPresent(CustomerInfoDO::getCustomerFrom, reqVO.getCustomerFrom())
                .eqIfPresent(CustomerInfoDO::getIsOpen, reqVO.getIsOpen())
                .eqIfPresent(CustomerInfoDO::getRemarks, reqVO.getRemarks())
                .eqIfPresent(CustomerInfoDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(CustomerInfoDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CustomerInfoDO::getId));
    }

}