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

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

/**
 * 请假流程信息 Mapper
 *
 * @author dp
 */
@Mapper
public interface OaLeaveMapper extends BaseMapperX<OaLeaveDO> {

    default PageResult<OaLeaveDO> selectPage(OaLeavePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OaLeaveDO>()
                .likeIfPresent(OaLeaveDO::getEmployeeName, reqVO.getEmployeeName())
                .likeIfPresent(OaLeaveDO::getEmployeePhone, reqVO.getEmployeePhone())
                .eqIfPresent(OaLeaveDO::getDeptId, reqVO.getDeptId())
                .eqIfPresent(OaLeaveDO::getPosition, reqVO.getPosition())
                .eqIfPresent(OaLeaveDO::getLeaveType, reqVO.getLeaveType())
                .betweenIfPresent(OaLeaveDO::getStartDate, reqVO.getStartDate())
                .betweenIfPresent(OaLeaveDO::getEndDate, reqVO.getEndDate())
                .eqIfPresent(OaLeaveDO::getAuditStatus, reqVO.getAuditStatus())
                .betweenIfPresent(OaLeaveDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(OaLeaveDO::getId));
    }

}