package com.zt.plat.module.qms.business.config.dal.mapper;

import java.util.*;

import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.module.qms.business.config.controller.vo.*;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigAssayMethodProjectAssessmentDO;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import org.apache.ibatis.annotations.Mapper;

/**
 * 检测方法分析项目判定 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface ConfigAssayMethodProjectAssessmentMapper extends BaseMapperX<ConfigAssayMethodProjectAssessmentDO> {

    default PageResult<ConfigAssayMethodProjectAssessmentDO> selectPage(ConfigAssayMethodProjectAssessmentPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ConfigAssayMethodProjectAssessmentDO>()
                .eqIfPresent(ConfigAssayMethodProjectAssessmentDO::getConfigBaseSampleId, reqVO.getConfigBaseSampleId())
                .eqIfPresent(ConfigAssayMethodProjectAssessmentDO::getConfigAssayMethodId, reqVO.getConfigAssayMethodId())
                .eqIfPresent(ConfigAssayMethodProjectAssessmentDO::getConfigAssayMethodProjectId, reqVO.getConfigAssayMethodProjectId())
                .eqIfPresent(ConfigAssayMethodProjectAssessmentDO::getDictionaryProjectId, reqVO.getDictionaryProjectId())
                .eqIfPresent(ConfigAssayMethodProjectAssessmentDO::getAssessmentLevel, reqVO.getAssessmentLevel())
                .eqIfPresent(ConfigAssayMethodProjectAssessmentDO::getAssessmentRange, reqVO.getAssessmentRange())
                .eqIfPresent(ConfigAssayMethodProjectAssessmentDO::getMinimumToleraanceValue, reqVO.getMinimumToleraanceValue())
                .eqIfPresent(ConfigAssayMethodProjectAssessmentDO::getMaximumToleraanceValue, reqVO.getMaximumToleraanceValue())
                .eqIfPresent(ConfigAssayMethodProjectAssessmentDO::getMinimumValue, reqVO.getMinimumValue())
                .eqIfPresent(ConfigAssayMethodProjectAssessmentDO::getMaximumValue, reqVO.getMaximumValue())
                .eqIfPresent(ConfigAssayMethodProjectAssessmentDO::getFormula, reqVO.getFormula())
                .eqIfPresent(ConfigAssayMethodProjectAssessmentDO::getIsUseFormula, reqVO.getIsUseFormula())
                .eqIfPresent(ConfigAssayMethodProjectAssessmentDO::getToleraanceAdjustmentValue, reqVO.getToleraanceAdjustmentValue())
                .eqIfPresent(ConfigAssayMethodProjectAssessmentDO::getAssessmentType, reqVO.getAssessmentType())
                .eqIfPresent(ConfigAssayMethodProjectAssessmentDO::getIsCancelAssessment, reqVO.getIsCancelAssessment())
                .eqIfPresent(ConfigAssayMethodProjectAssessmentDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .betweenIfPresent(ConfigAssayMethodProjectAssessmentDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(ConfigAssayMethodProjectAssessmentDO::getRemark, reqVO.getRemark())
                .eqIfPresent(ConfigAssayMethodProjectAssessmentDO::getVersion, reqVO.getVersion())
                .orderByDesc(ConfigAssayMethodProjectAssessmentDO::getId));
    }
    
    default List<ConfigAssayMethodProjectAssessmentDO> selectByConfigBaseSampleIdsAndConfigAssayMethodIdAndConfigAssayMethodProjectId(Long configBaseSampleIdList, Long configAssayMethodId, Long configAssayMethodProjectId) {
    	return selectList(new LambdaQueryWrapperX<ConfigAssayMethodProjectAssessmentDO>()
                .inIfPresent(ConfigAssayMethodProjectAssessmentDO::getConfigBaseSampleId, configBaseSampleIdList)
                .eqIfPresent(ConfigAssayMethodProjectAssessmentDO::getConfigAssayMethodId, configAssayMethodId)
                .eqIfPresent(ConfigAssayMethodProjectAssessmentDO::getConfigAssayMethodProjectId, configAssayMethodProjectId)
                .orderByDesc(ConfigAssayMethodProjectAssessmentDO::getId));
    }
    
    default List<ConfigAssayMethodProjectAssessmentDO> selectByConfigBaseSampleIdAndConfigAssayMethodIdAndConfigAssayMethodProjectId(Long configBaseSampleId, Long configAssayMethodId, Long configAssayMethodProjectId) {
    	return selectList(new LambdaQueryWrapperX<ConfigAssayMethodProjectAssessmentDO>()
                .eqIfPresent(ConfigAssayMethodProjectAssessmentDO::getConfigBaseSampleId, configBaseSampleId)
                .eqIfPresent(ConfigAssayMethodProjectAssessmentDO::getConfigAssayMethodId, configAssayMethodId)
                .eqIfPresent(ConfigAssayMethodProjectAssessmentDO::getConfigAssayMethodProjectId, configAssayMethodProjectId)
                .orderByDesc(ConfigAssayMethodProjectAssessmentDO::getId));
    }

}