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>()
                .likeIfPresent(OaExpenseDO::getEmployeeName, reqVO.getEmployeeName())
                .likeIfPresent(OaExpenseDO::getEmployeePhone, reqVO.getEmployeePhone())
                .eqIfPresent(OaExpenseDO::getDeptId, reqVO.getDeptId())
                .eqIfPresent(OaExpenseDO::getPostId, reqVO.getPostId())
                .eqIfPresent(OaExpenseDO::getExpenseTypeId, reqVO.getExpenseTypeId())
                .eqIfPresent(OaExpenseDO::getAuditStatus, reqVO.getAuditStatus())
                .likeIfPresent(OaExpenseDO::getApplyEmployeeName, reqVO.getApplyEmployeeName())
                .betweenIfPresent(OaExpenseDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(OaExpenseDO::getId));
    }

}