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

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.ConfigXRFConversionRateDO;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import org.apache.ibatis.annotations.Mapper;

/**
 * 荧光数据采集特殊检测项目转换率配置 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface ConfigXRFConversionRateMapper extends BaseMapperX<ConfigXRFConversionRateDO> {

    default PageResult<ConfigXRFConversionRateDO> selectPage(ConfigXRFConversionRatePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ConfigXRFConversionRateDO>()
                .eqIfPresent(ConfigXRFConversionRateDO::getDeviceNo, reqVO.getDeviceNo())
                .likeIfPresent(ConfigXRFConversionRateDO::getLineName, reqVO.getLineName())
                .likeIfPresent(ConfigXRFConversionRateDO::getXRFProjectName, reqVO.getXRFProjectName())
                .eqIfPresent(ConfigXRFConversionRateDO::getConversionRate, reqVO.getConversionRate())
                .eqIfPresent(ConfigXRFConversionRateDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .betweenIfPresent(ConfigXRFConversionRateDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(ConfigXRFConversionRateDO::getRemark, reqVO.getRemark())
                .orderByDesc(ConfigXRFConversionRateDO::getId));
    }
    
    default ConfigXRFConversionRateDO selectBy(String deviceNo, String lineName, String projectName) {
    	return selectOne(new LambdaQueryWrapperX<ConfigXRFConversionRateDO>()
    			.eq(ConfigXRFConversionRateDO::getDeviceNo, deviceNo)
    			.eq(ConfigXRFConversionRateDO::getLineName, lineName)
    			.eq(ConfigXRFConversionRateDO::getXRFProjectName, projectName));
    }

}