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

/**
 * 荧光采集检测项目配置 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface ConfigXRFProjectMapper extends BaseMapperX<ConfigXRFProjectDO> {

    default PageResult<ConfigXRFProjectDO> selectPage(ConfigXRFProjectPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ConfigXRFProjectDO>()
                .eqIfPresent(ConfigXRFProjectDO::getDeviceNo, reqVO.getDeviceNo())
                .eqIfPresent(ConfigXRFProjectDO::getDictionaryProjectId, reqVO.getDictionaryProjectId())
                .likeIfPresent(ConfigXRFProjectDO::getShowName, reqVO.getShowName())
                .likeIfPresent(ConfigXRFProjectDO::getXRFProjectName, reqVO.getXRFProjectName())
                .eqIfPresent(ConfigXRFProjectDO::getXRFProjectUnit, reqVO.getXRFProjectUnit())
                .eqIfPresent(ConfigXRFProjectDO::getDataType, reqVO.getDataType())
                .eqIfPresent(ConfigXRFProjectDO::getDecimalPosition, reqVO.getDecimalPosition())
                .eqIfPresent(ConfigXRFProjectDO::getConversionRate, reqVO.getConversionRate())
                .eqIfPresent(ConfigXRFProjectDO::getSortNo, reqVO.getSortNo())
                .eqIfPresent(ConfigXRFProjectDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .betweenIfPresent(ConfigXRFProjectDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(ConfigXRFProjectDO::getRemark, reqVO.getRemark())
                .orderByDesc(ConfigXRFProjectDO::getId));
    }

	default List<ConfigXRFProjectDO> selectByDeviceNo(String deviceNo) {
		return selectList(new LambdaQueryWrapperX<ConfigXRFProjectDO>()
				.eq(ConfigXRFProjectDO::getDeviceNo, deviceNo));
	}

}