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

/**
 * 检验委托来源配置 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface ConfigEntrustSourceMapper extends BaseMapperX<ConfigEntrustSourceDO> {

    default PageResult<ConfigEntrustSourceDO> selectPage(ConfigEntrustSourcePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ConfigEntrustSourceDO>()
                .likeIfPresent(ConfigEntrustSourceDO::getName, reqVO.getName())
                .eqIfPresent(ConfigEntrustSourceDO::getKey, reqVO.getKey())
                .eqIfPresent(ConfigEntrustSourceDO::getDataCollectionKey, reqVO.getDataCollectionKey())
                .eqIfPresent(ConfigEntrustSourceDO::getConfigReportTemplateKey, reqVO.getConfigReportTemplateKey())
                .eqIfPresent(ConfigEntrustSourceDO::getCodeRule, reqVO.getCodeRule())
                .eqIfPresent(ConfigEntrustSourceDO::getCodeField, reqVO.getCodeField())
                .eqIfPresent(ConfigEntrustSourceDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .betweenIfPresent(ConfigEntrustSourceDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(ConfigEntrustSourceDO::getRemark, reqVO.getRemark())
                .eqIfPresent(ConfigEntrustSourceDO::getEntrustType, reqVO.getEntrustType())
                .orderByDesc(ConfigEntrustSourceDO::getId));
    }
    
    default List<ConfigEntrustSourceDO> selectList(ConfigEntrustSourceReqVO reqVO) {
    	return selectList(new LambdaQueryWrapperX<ConfigEntrustSourceDO>()
                .likeIfPresent(ConfigEntrustSourceDO::getName, reqVO.getName())
                .eqIfPresent(ConfigEntrustSourceDO::getKey, reqVO.getKey())
                .eqIfPresent(ConfigEntrustSourceDO::getDataCollectionKey, reqVO.getDataCollectionKey())
                .eqIfPresent(ConfigEntrustSourceDO::getConfigReportTemplateKey, reqVO.getConfigReportTemplateKey())
                .eqIfPresent(ConfigEntrustSourceDO::getCodeRule, reqVO.getCodeRule())
                .eqIfPresent(ConfigEntrustSourceDO::getCodeField, reqVO.getCodeField())
                .eqIfPresent(ConfigEntrustSourceDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .betweenIfPresent(ConfigEntrustSourceDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(ConfigEntrustSourceDO::getRemark, reqVO.getRemark())
                .eqIfPresent(ConfigEntrustSourceDO::getEntrustType, reqVO.getEntrustType())
                .orderByDesc(ConfigEntrustSourceDO::getId));
    }

}