package com.zt.plat.module.qms.business.bus.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.bus.controller.vo.BusinessSubParentSamplePageReqVO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSubParentSampleDO;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;

/**
 * 分样业务 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface BusinessSubParentSampleMapper extends BaseMapperX<BusinessSubParentSampleDO> {

    default PageResult<BusinessSubParentSampleDO> selectPage(BusinessSubParentSamplePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BusinessSubParentSampleDO>()
                .eqIfPresent(BusinessSubParentSampleDO::getSampleId, reqVO.getSampleId())
                .eqIfPresent(BusinessSubParentSampleDO::getBusinessBaseSampleId, reqVO.getBusinessBaseSampleId())
                .eqIfPresent(BusinessSubParentSampleDO::getConfigSubSampleParentId, reqVO.getConfigSubSampleParentId())
                .eqIfPresent(BusinessSubParentSampleDO::getDictionaryBusinessId, reqVO.getDictionaryBusinessId())
                .eqIfPresent(BusinessSubParentSampleDO::getSampleCode, reqVO.getSampleCode())
                .likeIfPresent(BusinessSubParentSampleDO::getSampleName, reqVO.getSampleName())
                .eqIfPresent(BusinessSubParentSampleDO::getSubSampleCode, reqVO.getSubSampleCode())
                .eqIfPresent(BusinessSubParentSampleDO::getSubSampleReturnCode, reqVO.getSubSampleReturnCode())
                .eqIfPresent(BusinessSubParentSampleDO::getReporter, reqVO.getReporter())
                .betweenIfPresent(BusinessSubParentSampleDO::getReportTime, reqVO.getReportTime())
                .eqIfPresent(BusinessSubParentSampleDO::getAuditFlowCode, reqVO.getAuditFlowCode())
                .eqIfPresent(BusinessSubParentSampleDO::getAssessmentStatus, reqVO.getAssessmentStatus())
                .eqIfPresent(BusinessSubParentSampleDO::getSampleStatus, reqVO.getSampleStatus())
                .eqIfPresent(BusinessSubParentSampleDO::getIsEnabled, reqVO.getIsEnabled())
                .eqIfPresent(BusinessSubParentSampleDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .betweenIfPresent(BusinessSubParentSampleDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(BusinessSubParentSampleDO::getUpdateCount, reqVO.getUpdateCount())
                .eqIfPresent(BusinessSubParentSampleDO::getRemark, reqVO.getRemark())
                .orderByDesc(BusinessSubParentSampleDO::getId));
    }
    
    default List<BusinessSubParentSampleDO> selectByBusinessBaseSampleId(Long businessBaseSampleId) {
    	return selectList(new LambdaQueryWrapperX<BusinessSubParentSampleDO>()
    			.eq(BusinessSubParentSampleDO::getBusinessBaseSampleId, businessBaseSampleId));
    }
    
    default List<BusinessSubParentSampleDO> selectByBusinessBaseSampleIds(List<Long> businessBaseSampleIds) {
    	return selectList(new LambdaQueryWrapperX<BusinessSubParentSampleDO>()
    			.in(BusinessSubParentSampleDO::getBusinessBaseSampleId, businessBaseSampleIds));
    }

}