package cn.iocoder.yudao.module.pms.dal.mysql.oa;

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.pms.controller.admin.oa.IotOaPersonPageReqVO;
import cn.iocoder.yudao.module.pms.dal.dataobject.oa.IotOaPersonDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * oa人员 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface IotOaPersonMapper extends BaseMapperX<IotOaPersonDO> {

    default PageResult<IotOaPersonDO> selectPage(IotOaPersonPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<IotOaPersonDO>()
                .betweenIfPresent(IotOaPersonDO::getCompanystartdate, reqVO.getCompanystartdate())
                .eqIfPresent(IotOaPersonDO::getSubcompanyid1, reqVO.getSubcompanyid1())
                .likeIfPresent(IotOaPersonDO::getSubcompanyname, reqVO.getSubcompanyname())
                .likeIfPresent(IotOaPersonDO::getJobgroupname, reqVO.getJobgroupname())
                .eqIfPresent(IotOaPersonDO::getBelongtoid, reqVO.getBelongtoid())
                .eqIfPresent(IotOaPersonDO::getSubcompanycode, reqVO.getSubcompanycode())
                .eqIfPresent(IotOaPersonDO::getOaId, reqVO.getOaId())
                .likeIfPresent(IotOaPersonDO::getLastname, reqVO.getLastname())
                .betweenIfPresent(IotOaPersonDO::getEnddate, reqVO.getEnddate())
                .likeIfPresent(IotOaPersonDO::getDepartmentname, reqVO.getDepartmentname())
                .eqIfPresent(IotOaPersonDO::getStatus, reqVO.getStatus())
                .likeIfPresent(IotOaPersonDO::getJobtitlename, reqVO.getJobtitlename())
                .eqIfPresent(IotOaPersonDO::getDepartmentcode, reqVO.getDepartmentcode())
                .eqIfPresent(IotOaPersonDO::getWorkcode, reqVO.getWorkcode())
                .eqIfPresent(IotOaPersonDO::getSex, reqVO.getSex())
                .eqIfPresent(IotOaPersonDO::getDepartmentid, reqVO.getDepartmentid())
                .eqIfPresent(IotOaPersonDO::getMobile, reqVO.getMobile())
                .eqIfPresent(IotOaPersonDO::getLocationid, reqVO.getLocationid())
                .betweenIfPresent(IotOaPersonDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(IotOaPersonDO::getId));
    }

}
