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.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.module.qms.business.config.controller.vo.ConfigStandardSampleProjectPageReqVO;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigStandardSampleProjectDO;
import org.apache.ibatis.annotations.Mapper;
import com.zt.plat.module.qms.business.config.controller.vo.*;

/**
 * 标准样检测项目配置 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface ConfigStandardSampleProjectMapper extends BaseMapperX<ConfigStandardSampleProjectDO> {

    default PageResult<ConfigStandardSampleProjectDO> selectPage(ConfigStandardSampleProjectPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ConfigStandardSampleProjectDO>()
                .eqIfPresent(ConfigStandardSampleProjectDO::getConfigStandardSampleTypeId, reqVO.getConfigStandardSampleTypeId())
                .eqIfPresent(ConfigStandardSampleProjectDO::getDictionaryProjectId, reqVO.getDictionaryProjectId())
                .likeIfPresent(ConfigStandardSampleProjectDO::getDictionaryProjectName, reqVO.getDictionaryProjectName())
                .eqIfPresent(ConfigStandardSampleProjectDO::getUnitId, reqVO.getUnitId())
                .eqIfPresent(ConfigStandardSampleProjectDO::getDictionaryProjectUnit, reqVO.getDictionaryProjectUnit())
                .eqIfPresent(ConfigStandardSampleProjectDO::getAccuracy, reqVO.getAccuracy())
                .eqIfPresent(ConfigStandardSampleProjectDO::getSortNo, reqVO.getSortNo())
                .eqIfPresent(ConfigStandardSampleProjectDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .betweenIfPresent(ConfigStandardSampleProjectDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(ConfigStandardSampleProjectDO::getRemark, reqVO.getRemark())
                .eqIfPresent(ConfigStandardSampleProjectDO::getVersion, reqVO.getVersion())
                .orderByDesc(ConfigStandardSampleProjectDO::getId));
    }

}