package cn.iocoder.yudao.module.crm.dal.mysql.salesperformanceweight;

import java.util.*;

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.crm.dal.dataobject.salesperformanceweight.SalesPerformanceWeightDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.crm.controller.admin.salesperformanceweight.vo.*;

/**
 * 销售业绩权重设置 Mapper
 *
 * @author 艾楷
 */
@Mapper
public interface SalesPerformanceWeightMapper extends BaseMapperX<SalesPerformanceWeightDO> {

    default PageResult<SalesPerformanceWeightDO> selectPage(SalesPerformanceWeightPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<SalesPerformanceWeightDO>()
                .eqIfPresent(SalesPerformanceWeightDO::getSaleWeight, reqVO.getSaleWeight())
                .eqIfPresent(SalesPerformanceWeightDO::getPaymentWeight, reqVO.getPaymentWeight())
                .eqIfPresent(SalesPerformanceWeightDO::getScoreWeight, reqVO.getScoreWeight())
                .betweenIfPresent(SalesPerformanceWeightDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(SalesPerformanceWeightDO::getId));
    }

}