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

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

/**
 * 报销流程信息 Mapper
 *
 * @author dp
 */
@Mapper
public interface OaExpenseMapper extends BaseMapperX<OaExpenseDO> {

    default PageResult<OaExpenseDO> selectPage(OaExpensePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OaExpenseDO>()
                .eqIfPresent(OaExpenseDO::getEmployeeId, reqVO.getEmployeeId())
                .likeIfPresent(OaExpenseDO::getEmployeeName, reqVO.getEmployeeName())
                .eqIfPresent(OaExpenseDO::getEmployeePhone, reqVO.getEmployeePhone())
                .eqIfPresent(OaExpenseDO::getUserId, reqVO.getUserId())
                .eqIfPresent(OaExpenseDO::getDeptId, reqVO.getDeptId())
                .eqIfPresent(OaExpenseDO::getPosition, reqVO.getPosition())
                .eqIfPresent(OaExpenseDO::getExpenseTypeId, reqVO.getExpenseTypeId())
                .likeIfPresent(OaExpenseDO::getExpenseTypeName, reqVO.getExpenseTypeName())
                .eqIfPresent(OaExpenseDO::getExpenseMonth, reqVO.getExpenseMonth())
                .eqIfPresent(OaExpenseDO::getTotalMoney, reqVO.getTotalMoney())
                .eqIfPresent(OaExpenseDO::getRemarks, reqVO.getRemarks())
                .eqIfPresent(OaExpenseDO::getProcInstId, reqVO.getProcInstId())
                .eqIfPresent(OaExpenseDO::getAuditStatus, reqVO.getAuditStatus())
                .eqIfPresent(OaExpenseDO::getCurrentAuditEmployeeId, reqVO.getCurrentAuditEmployeeId())
                .likeIfPresent(OaExpenseDO::getCurrentAuditEmployeeName, reqVO.getCurrentAuditEmployeeName())
                .eqIfPresent(OaExpenseDO::getCurrentAuditUserId, reqVO.getCurrentAuditUserId())
                .betweenIfPresent(OaExpenseDO::getFinalAuditDate, reqVO.getFinalAuditDate())
                .eqIfPresent(OaExpenseDO::getApplyEmployeeId, reqVO.getApplyEmployeeId())
                .likeIfPresent(OaExpenseDO::getApplyEmployeeName, reqVO.getApplyEmployeeName())
                .betweenIfPresent(OaExpenseDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(OaExpenseDO::getId));
    }

}