package cn.iocoder.yudao.module.bpm.dal.mysql.oa.out;

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.bpm.controller.admin.oa.out.vo.OaOutPageReqVO;
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.out.OaOutDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 公务外出流程信息 Mapper
 *
 * @author dp
 */
@Mapper
public interface OaOutMapper extends BaseMapperX<OaOutDO> {

    default PageResult<OaOutDO> selectPage(OaOutPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OaOutDO>()
                .eqIfPresent(OaOutDO::getOutId, reqVO.getOutId())
                .eqIfPresent(OaOutDO::getEmployeeId, reqVO.getEmployeeId())
                .likeIfPresent(OaOutDO::getEmployeeName, reqVO.getEmployeeName())
                .eqIfPresent(OaOutDO::getEmployeePhone, reqVO.getEmployeePhone())
                .eqIfPresent(OaOutDO::getUserId, reqVO.getUserId())
                .eqIfPresent(OaOutDO::getDeptId, reqVO.getDeptId())
                .eqIfPresent(OaOutDO::getPosition, reqVO.getPosition())
                .eqIfPresent(OaOutDO::getReason, reqVO.getReason())
                .eqIfPresent(OaOutDO::getDestination, reqVO.getDestination())
                .betweenIfPresent(OaOutDO::getStartDate, reqVO.getStartDate())
                .betweenIfPresent(OaOutDO::getEndDate, reqVO.getEndDate())
                .eqIfPresent(OaOutDO::getHour, reqVO.getHour())
                .eqIfPresent(OaOutDO::getRemarks, reqVO.getRemarks())
                .eqIfPresent(OaOutDO::getProcInstId, reqVO.getProcInstId())
                .eqIfPresent(OaOutDO::getAuditStatus, reqVO.getAuditStatus())
                .eqIfPresent(OaOutDO::getCurrentAuditEmployeeId, reqVO.getCurrentAuditEmployeeId())
                .likeIfPresent(OaOutDO::getCurrentAuditEmployeeName, reqVO.getCurrentAuditEmployeeName())
                .eqIfPresent(OaOutDO::getCurrentAuditUserId, reqVO.getCurrentAuditUserId())
                .betweenIfPresent(OaOutDO::getFinalAuditDate, reqVO.getFinalAuditDate())
                .eqIfPresent(OaOutDO::getApplyEmployeeId, reqVO.getApplyEmployeeId())
                .likeIfPresent(OaOutDO::getApplyEmployeeName, reqVO.getApplyEmployeeName())
                .betweenIfPresent(OaOutDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(OaOutDO::getId));
    }

}