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.controller.vo.ConfigSubSampleParentPageReqVO;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigSubSampleParentDO;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;

/**
 * 分样配置 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface ConfigSubSampleParentMapper extends BaseMapperX<ConfigSubSampleParentDO> {

    default PageResult<ConfigSubSampleParentDO> selectPage(ConfigSubSampleParentPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ConfigSubSampleParentDO>()
                .eqIfPresent(ConfigSubSampleParentDO::getBaseSampleId, reqVO.getBaseSampleId())
                .eqIfPresent(ConfigSubSampleParentDO::getConfigBaseSampleId, reqVO.getConfigBaseSampleId())
                .eqIfPresent(ConfigSubSampleParentDO::getDictionaryBusinessId, reqVO.getDictionaryBusinessId())
                .likeIfPresent(ConfigSubSampleParentDO::getSampleName, reqVO.getSampleName())
                .eqIfPresent(ConfigSubSampleParentDO::getIsDefaultEnabled, reqVO.getIsDefaultEnabled())
                .eqIfPresent(ConfigSubSampleParentDO::getAuditWay, reqVO.getAuditWay())
                .eqIfPresent(ConfigSubSampleParentDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .betweenIfPresent(ConfigSubSampleParentDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(ConfigSubSampleParentDO::getRemark, reqVO.getRemark())
                .eqIfPresent(ConfigSubSampleParentDO::getVersion, reqVO.getVersion())
                .orderByDesc(ConfigSubSampleParentDO::getId));
    }
    
    default List<ConfigSubSampleParentDO> selectByBaseSampleIds(List<Long> baseSampleIds) {
    	return selectList(new LambdaQueryWrapperX<ConfigSubSampleParentDO>()
    			.in(ConfigSubSampleParentDO::getBaseSampleId, baseSampleIds));
    }

}