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.ConfigSubSampleParentMethodDO;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import org.apache.ibatis.annotations.Mapper;
/**
 * 分样与检测方法配置 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface ConfigSubSampleParentMethodMapper extends BaseMapperX<ConfigSubSampleParentMethodDO> {

    default PageResult<ConfigSubSampleParentMethodDO> selectPage(ConfigSubSampleParentMethodPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ConfigSubSampleParentMethodDO>()
                .eqIfPresent(ConfigSubSampleParentMethodDO::getConfigSubSampleParentId, reqVO.getConfigSubSampleParentId())
                .eqIfPresent(ConfigSubSampleParentMethodDO::getConfigAssayMethodId, reqVO.getConfigAssayMethodId())
                .eqIfPresent(ConfigSubSampleParentMethodDO::getIsDefaultUse, reqVO.getIsDefaultUse())
                .eqIfPresent(ConfigSubSampleParentMethodDO::getResultTreatmentWay, reqVO.getResultTreatmentWay())
                .eqIfPresent(ConfigSubSampleParentMethodDO::getCalculateMethod, reqVO.getCalculateMethod())
                .eqIfPresent(ConfigSubSampleParentMethodDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .betweenIfPresent(ConfigSubSampleParentMethodDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(ConfigSubSampleParentMethodDO::getRemark, reqVO.getRemark())
                .orderByDesc(ConfigSubSampleParentMethodDO::getId));
    }
    
    /**
     * 根据分样id与分析方法id查询
     * @param configSubSampleParentId
     * @param configAssayMethodId
     * @return
     */
    default ConfigSubSampleParentMethodDO selectByConfigSubSampleParentIdAndConfigAssayMethodId(Long configSubSampleParentId, Long configAssayMethodId) {
    	return selectOne(new LambdaQueryWrapperX<ConfigSubSampleParentMethodDO>()
    			.eq(ConfigSubSampleParentMethodDO::getConfigSubSampleParentId, configSubSampleParentId)
    			.eq(ConfigSubSampleParentMethodDO::getConfigAssayMethodId, configAssayMethodId));
    }

}