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

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.receive.vo.OaReceivePageReqVO;
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.receive.OaReceiveDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 领用流程信息 Mapper
 *
 * @author dp
 */
@Mapper
public interface OaReceiveMapper extends BaseMapperX<OaReceiveDO> {

    default PageResult<OaReceiveDO> selectPage(OaReceivePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OaReceiveDO>()
                .eqIfPresent(OaReceiveDO::getEmployeeId, reqVO.getEmployeeId())
                .likeIfPresent(OaReceiveDO::getEmployeeName, reqVO.getEmployeeName())
                .eqIfPresent(OaReceiveDO::getEmployeePhone, reqVO.getEmployeePhone())
                .eqIfPresent(OaReceiveDO::getUserId, reqVO.getUserId())
                .eqIfPresent(OaReceiveDO::getDeptId, reqVO.getDeptId())
                .eqIfPresent(OaReceiveDO::getPosition, reqVO.getPosition())
                .betweenIfPresent(OaReceiveDO::getReceiveDate, reqVO.getReceiveDate())
                .eqIfPresent(OaReceiveDO::getProcInstId, reqVO.getProcInstId())
                .eqIfPresent(OaReceiveDO::getAuditStatus, reqVO.getAuditStatus())
                .eqIfPresent(OaReceiveDO::getCurrentAuditEmployeeId, reqVO.getCurrentAuditEmployeeId())
                .likeIfPresent(OaReceiveDO::getCurrentAuditEmployeeName, reqVO.getCurrentAuditEmployeeName())
                .eqIfPresent(OaReceiveDO::getCurrentAuditUserId, reqVO.getCurrentAuditUserId())
                .betweenIfPresent(OaReceiveDO::getFinalAuditDate, reqVO.getFinalAuditDate())
                .eqIfPresent(OaReceiveDO::getApplyEmployeeId, reqVO.getApplyEmployeeId())
                .likeIfPresent(OaReceiveDO::getApplyEmployeeName, reqVO.getApplyEmployeeName())
                .betweenIfPresent(OaReceiveDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(OaReceiveDO::getId));
    }

}