package com.zt.plat.module.qms.business.reportdoc.dal.mapper;

import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.module.qms.business.reportdoc.controller.vo.*;
import com.zt.plat.module.qms.business.reportdoc.dal.dataobject.ReportDocumentDataDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * 检测报告明细 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface ReportDocumentDataMapper extends BaseMapperX<ReportDocumentDataDO> {

    default PageResult<ReportDocumentDataDO> selectPage(ReportDocumentDataPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ReportDocumentDataDO>()
                .eqIfPresent(ReportDocumentDataDO::getMainId, reqVO.getMainId())
                .eqIfPresent(ReportDocumentDataDO::getSourceId, reqVO.getSourceId())
                .eqIfPresent(ReportDocumentDataDO::getDocumentContent, reqVO.getDocumentContent())
                .eqIfPresent(ReportDocumentDataDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .betweenIfPresent(ReportDocumentDataDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(ReportDocumentDataDO::getRemark, reqVO.getRemark())
                .orderByDesc(ReportDocumentDataDO::getId));
    }

    List<Map<String, Object>> queryBaseSampleBySourceId(@Param("sourceId") Long sourceId);

}