package cn.iocoder.yudao.module.visit.dal.mysql.customerinfo;

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

/**
 * 客户信息 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface CustomerInfoMapper extends BaseMapperX<CustomerInfoDO> {

    default PageResult<CustomerInfoDO> selectPage(CustomerInfoPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CustomerInfoDO>()
                .likeIfPresent(CustomerInfoDO::getCustomerName, reqVO.getCustomerName())
                .eqIfPresent(CustomerInfoDO::getContact, reqVO.getContact())
                .likeIfPresent(CustomerInfoDO::getCompanyName, reqVO.getCompanyName())
                .eqIfPresent(CustomerInfoDO::getCustomerType, reqVO.getCustomerType())
                .eqIfPresent(CustomerInfoDO::getCityCode, reqVO.getCityCode())
                .betweenIfPresent(CustomerInfoDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CustomerInfoDO::getId));
    }

}