package cn.iocoder.yudao.server.dal.mysql;

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.server.controller.admin.vo.crm.CrmPersonPageReqVO;
import cn.iocoder.yudao.server.dal.dataobject.CrmPersonDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * crm人员 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface CrmPersonMapper extends BaseMapperX<CrmPersonDO> {

    default PageResult<CrmPersonDO> selectPage(CrmPersonPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CrmPersonDO>()
                .eqIfPresent(CrmPersonDO::getCrmUserId, reqVO.getCrmUserId())
                .likeIfPresent(CrmPersonDO::getCrmUserName, reqVO.getCrmUserName())
                .eqIfPresent(CrmPersonDO::getCrmUserUnionid, reqVO.getCrmUserUnionid())
                .eqIfPresent(CrmPersonDO::getCrmUserPhone, reqVO.getCrmUserPhone())
                .eqIfPresent(CrmPersonDO::getCrmUserMail, reqVO.getCrmUserMail())
                .betweenIfPresent(CrmPersonDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CrmPersonDO::getId));
    }

}