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

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

/**
 * 销售业绩目标申请OA Mapper
 *
 * @author 艾楷
 */
@Mapper
public interface BpmOASalesPerformanceMapper extends BaseMapperX<BpmOASalesPerformanceDO> {

    default PageResult<BpmOASalesPerformanceDO> selectPage(SalesPerformancePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BpmOASalesPerformanceDO>()
                .eqIfPresent(BpmOASalesPerformanceDO::getUserId, reqVO.getUserId())
                .eqIfPresent(BpmOASalesPerformanceDO::getYear, reqVO.getYear())
                .eqIfPresent(BpmOASalesPerformanceDO::getMonth, reqVO.getMonth())
                .eqIfPresent(BpmOASalesPerformanceDO::getPaymentTarget, reqVO.getPaymentTarget())
                .eqIfPresent(BpmOASalesPerformanceDO::getSaleTarget, reqVO.getSaleTarget())
                .eqIfPresent(BpmOASalesPerformanceDO::getRemark, reqVO.getRemark())
                .eqIfPresent(BpmOASalesPerformanceDO::getResult, reqVO.getResult())
                .eqIfPresent(BpmOASalesPerformanceDO::getProcessInstanceId, reqVO.getProcessInstanceId())
                .betweenIfPresent(BpmOASalesPerformanceDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(BpmOASalesPerformanceDO::getId));
    }

}
