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

import java.util.List;

import org.apache.ibatis.annotations.Mapper;

/**
 * 子样分析班组业务 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface BusinessSubSampleAnalysisGroupMapper extends BaseMapperX<BusinessSubSampleAnalysisGroupDO> {

    default PageResult<BusinessSubSampleAnalysisGroupDO> selectPage(BusinessSubSampleAnalysisGroupPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BusinessSubSampleAnalysisGroupDO>()
                .eqIfPresent(BusinessSubSampleAnalysisGroupDO::getBusinessBaseSampleId, reqVO.getBusinessBaseSampleId())
                .eqIfPresent(BusinessSubSampleAnalysisGroupDO::getBusinessSubParentSampleId, reqVO.getBusinessSubParentSampleId())
                .eqIfPresent(BusinessSubSampleAnalysisGroupDO::getBusinessSubSampleId, reqVO.getBusinessSubSampleId())
                .eqIfPresent(BusinessSubSampleAnalysisGroupDO::getAssayDepartmentId, reqVO.getAssayDepartmentId())
                .likeIfPresent(BusinessSubSampleAnalysisGroupDO::getAssayDepartmentName, reqVO.getAssayDepartmentName())
                .eqIfPresent(BusinessSubSampleAnalysisGroupDO::getSampleStatus, reqVO.getSampleStatus())
                .eqIfPresent(BusinessSubSampleAnalysisGroupDO::getIsSend, reqVO.getIsSend())
                .eqIfPresent(BusinessSubSampleAnalysisGroupDO::getSampleReceiver, reqVO.getSampleReceiver())
                .betweenIfPresent(BusinessSubSampleAnalysisGroupDO::getSampleReceiveTime, reqVO.getSampleReceiveTime())
                .eqIfPresent(BusinessSubSampleAnalysisGroupDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .betweenIfPresent(BusinessSubSampleAnalysisGroupDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(BusinessSubSampleAnalysisGroupDO::getUpdateCount, reqVO.getUpdateCount())
                .eqIfPresent(BusinessSubSampleAnalysisGroupDO::getRemark, reqVO.getRemark())
                .orderByDesc(BusinessSubSampleAnalysisGroupDO::getId));
    }
    
    default List<BusinessSubSampleAnalysisGroupDO> selectByBusinessSubParentSampleId(Long businessSubParentSampleId) {
    	return selectList(new LambdaQueryWrapperX<BusinessSubSampleAnalysisGroupDO>()
    			.eq(BusinessSubSampleAnalysisGroupDO::getBusinessSubParentSampleId, businessSubParentSampleId));
    }
    
    default List<BusinessSubSampleAnalysisGroupDO> selectByBusinessSubParentSampleIds(List<Long> businessSubParentSampleIds) {
    	return selectList(new LambdaQueryWrapperX<BusinessSubSampleAnalysisGroupDO>()
    			.in(BusinessSubSampleAnalysisGroupDO::getBusinessSubParentSampleId, businessSubParentSampleIds));
    }
    
    default List<BusinessSubSampleAnalysisGroupDO> selectByBusinessSubParentSampleIdsAndAssayDepartmentId(List<Long> businessSubParentSampleIds, Long assayDepartmentId) {
    	return selectList(new LambdaQueryWrapperX<BusinessSubSampleAnalysisGroupDO>()
    			.in(BusinessSubSampleAnalysisGroupDO::getBusinessSubParentSampleId, businessSubParentSampleIds)
    			.eq(BusinessSubSampleAnalysisGroupDO::getAssayDepartmentId, assayDepartmentId));
    }
    
    default List<BusinessSubSampleAnalysisGroupDO> selectByBusinessSubSampleId(Long businessSubSampleId) {
    	return selectList(new LambdaQueryWrapperX<BusinessSubSampleAnalysisGroupDO>()
    			.eq(BusinessSubSampleAnalysisGroupDO::getBusinessSubSampleId, businessSubSampleId));
    }
    
    default List<BusinessSubSampleAnalysisGroupDO> selectByBusinessSubSampleIds(List<Long> businessSubSampleIds) {
    	return selectList(new LambdaQueryWrapperX<BusinessSubSampleAnalysisGroupDO>()
    			.in(BusinessSubSampleAnalysisGroupDO::getBusinessSubSampleId, businessSubSampleIds));
    }
    
    default List<BusinessSubSampleAnalysisGroupDO> selectByBusinessSubSampleIdsAndAssayDepartmentId(List<Long> businessSubSampleIds, Long assayDepartmentId) {
    	return selectList(new LambdaQueryWrapperX<BusinessSubSampleAnalysisGroupDO>()
    			.in(BusinessSubSampleAnalysisGroupDO::getBusinessSubSampleId, businessSubSampleIds)
    			.eq(BusinessSubSampleAnalysisGroupDO::getAssayDepartmentId, assayDepartmentId));
    }
    
    default BusinessSubSampleAnalysisGroupDO selectByBusinessSubSampleIdAndAssayDepartmentId(Long businessSubSampleId, Long assayDepartmentId) {
    	return selectOne(new LambdaQueryWrapperX<BusinessSubSampleAnalysisGroupDO>()
    			.eq(BusinessSubSampleAnalysisGroupDO::getBusinessSubSampleId, businessSubSampleId)
    			.eq(BusinessSubSampleAnalysisGroupDO::getAssayDepartmentId, assayDepartmentId));
    }

}