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.ReportDocumentMainDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 检测报告业务 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface ReportDocumentMainMapper extends BaseMapperX<ReportDocumentMainDO> {


    default PageResult<ReportDocumentMainDO> selectPage(ReportDocumentMainPageReqVO reqVO) {
        LambdaQueryWrapperX<ReportDocumentMainDO> wrapper = new LambdaQueryWrapperX<>();
        wrapper.ne(ReportDocumentMainDO::getCancelFlag, -1);    //-1为临时数据
        wrapper.eqIfPresent(ReportDocumentMainDO::getFlowInstanceId, reqVO.getFlowInstanceId());
        wrapper.eqIfPresent(ReportDocumentMainDO::getReportDocumentTypeId, reqVO.getReportDocumentTypeId());
        wrapper.eqIfPresent(ReportDocumentMainDO::getFlowKey, reqVO.getFlowKey());
        wrapper.eqIfPresent(ReportDocumentMainDO::getFlowSerialNumber, reqVO.getFlowSerialNumber());
        wrapper.eqIfPresent(ReportDocumentMainDO::getCurrentNode, reqVO.getCurrentNode());
        wrapper.eqIfPresent(ReportDocumentMainDO::getDocumentCustomsDeclaration, reqVO.getDocumentCustomsDeclaration());
        wrapper.eqIfPresent(ReportDocumentMainDO::getDocumentType, reqVO.getDocumentType());
        wrapper.eqIfPresent(ReportDocumentMainDO::getDocumentTitle, reqVO.getDocumentTitle());
        wrapper.eqIfPresent(ReportDocumentMainDO::getDocumentConfig, reqVO.getDocumentConfig());
        wrapper.eqIfPresent(ReportDocumentMainDO::getDocumentSignature, reqVO.getDocumentSignature());
        wrapper.betweenIfPresent(ReportDocumentMainDO::getDocumentStartTime, reqVO.getDocumentStartTime());
        wrapper.betweenIfPresent(ReportDocumentMainDO::getDocumentEndTime, reqVO.getDocumentEndTime());
        wrapper.eqIfPresent(ReportDocumentMainDO::getFormData, reqVO.getFormData());
        wrapper.eqIfPresent(ReportDocumentMainDO::getFlowStatus, reqVO.getFlowStatus());
        wrapper.eqIfPresent(ReportDocumentMainDO::getCancelFlag, reqVO.getCancelFlag());
        wrapper.eqIfPresent(ReportDocumentMainDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode());
        wrapper.betweenIfPresent(ReportDocumentMainDO::getCreateTime, reqVO.getCreateTime());
        wrapper.eqIfPresent(ReportDocumentMainDO::getRemark, reqVO.getRemark());
        wrapper.orderByDesc(ReportDocumentMainDO::getId);
        return selectPage(reqVO, wrapper);
    }

}