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

/**
 * 质控样业务 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface BusinessQCDataMapper extends BaseMapperX<BusinessQCDataDO> {

    default PageResult<BusinessQCDataExtendRespVO> selectPage(BusinessQCDataPageReqVO reqVO) {
        return selectJoinPage(reqVO, BusinessQCDataExtendRespVO.class, new MPJLambdaWrapperX<BusinessQCDataDO>()
                .eqIfPresent(BusinessQCDataDO::getSampleCode, reqVO.getSampleCode())
                .eqIfPresent(BusinessQCDataDO::getSampleName, reqVO.getSampleName())
                .eqIfPresent(BusinessQCDataDO::getConfigAssayMethodId, reqVO.getConfigAssayMethodId())
                .eqIfPresent(BusinessQCDataDO::getBusinessAssayTaskId, reqVO.getBusinessAssayTaskId())
                .eqIfPresent(BusinessQCDataDO::getDictionaryBusinessId, reqVO.getDictionaryBusinessId())
                .eqIfPresent(BusinessQCDataDO::getDictionaryBusinessKey, reqVO.getDictionaryBusinessKey())
                .eqIfPresent(BusinessQCDataDO::getAssayProject, reqVO.getAssayProject())
                .eqIfPresent(BusinessQCDataDO::getAssayDepartmentId, reqVO.getAssayDepartmentId())
                .likeIfPresent(BusinessQCDataDO::getAssayDepartmentName, reqVO.getAssayDepartmentName())
                .eqIfPresent(BusinessQCDataDO::getAssayOperator, reqVO.getAssayOperator())
                .betweenIfPresent(BusinessQCDataDO::getAssignTaskTime, reqVO.getAssignTaskTime())
                .eqIfPresent(BusinessQCDataDO::getIsAssignTasked, reqVO.getIsAssignTasked())
                .eqIfPresent(BusinessQCDataDO::getIsReported, reqVO.getIsReported())
                .eqIfPresent(BusinessQCDataDO::getReporter, reqVO.getReporter())
                .betweenIfPresent(BusinessQCDataDO::getReportTime, reqVO.getReportTime())
                .eqIfPresent(BusinessQCDataDO::getUpdateCount, reqVO.getUpdateCount())
                .eqIfPresent(BusinessQCDataDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .betweenIfPresent(BusinessQCDataDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(BusinessQCDataDO::getRemark, reqVO.getRemark())
                .orderByDesc(BusinessQCDataDO::getId));
    }

	default List<BusinessQCDataExtendRespVO> selectList(BusinessQCDataReqVO reqVO) {
		return selectJoinList(BusinessQCDataExtendRespVO.class, new MPJLambdaWrapperX<BusinessQCDataDO>()
                .eqIfPresent(BusinessQCDataDO::getSampleCode, reqVO.getSampleCode())
                .eqIfPresent(BusinessQCDataDO::getSampleName, reqVO.getSampleName())
                .eqIfPresent(BusinessQCDataDO::getConfigAssayMethodId, reqVO.getConfigAssayMethodId())
                .eqIfPresent(BusinessQCDataDO::getBusinessAssayTaskId, reqVO.getBusinessAssayTaskId())
                .eqIfPresent(BusinessQCDataDO::getDictionaryBusinessId, reqVO.getDictionaryBusinessId())
                .eqIfPresent(BusinessQCDataDO::getDictionaryBusinessKey, reqVO.getDictionaryBusinessKey())
                .eqIfPresent(BusinessQCDataDO::getAssayProject, reqVO.getAssayProject())
                .eqIfPresent(BusinessQCDataDO::getAssayDepartmentId, reqVO.getAssayDepartmentId())
                .likeIfPresent(BusinessQCDataDO::getAssayDepartmentName, reqVO.getAssayDepartmentName())
                .eqIfPresent(BusinessQCDataDO::getAssayOperator, reqVO.getAssayOperator())
                .betweenIfPresent(BusinessQCDataDO::getAssignTaskTime, reqVO.getAssignTaskTime())
                .eqIfPresent(BusinessQCDataDO::getIsAssignTasked, reqVO.getIsAssignTasked())
                .eqIfPresent(BusinessQCDataDO::getIsReported, reqVO.getIsReported())
                .eqIfPresent(BusinessQCDataDO::getReporter, reqVO.getReporter())
                .betweenIfPresent(BusinessQCDataDO::getReportTime, reqVO.getReportTime())
                .eqIfPresent(BusinessQCDataDO::getUpdateCount, reqVO.getUpdateCount())
                .eqIfPresent(BusinessQCDataDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .betweenIfPresent(BusinessQCDataDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(BusinessQCDataDO::getRemark, reqVO.getRemark())
                .orderByDesc(BusinessQCDataDO::getId));
	}
    
    default List<BusinessQCDataDO> selectByBusinessAssayTaskId(Long businessAssayTaskId) {
    	return selectList(new LambdaQueryWrapperX<BusinessQCDataDO>()
    			.eq(BusinessQCDataDO::getBusinessAssayTaskId, businessAssayTaskId));
    }

}