caozj 1 год назад
Родитель
Сommit
302ff90c11

+ 14 - 1
hx-sale/src/main/java/com/fjhx/sale/service/documents/impl/DocumentsPdfServiceImpl.java

@@ -1,10 +1,14 @@
 package com.fjhx.sale.service.documents.impl;
 
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.fjhx.sale.entity.documents.po.Documents;
 import com.fjhx.sale.entity.documents.po.DocumentsPdf;
 import com.fjhx.sale.mapper.documents.DocumentsPdfMapper;
 import com.fjhx.sale.service.documents.DocumentsPdfService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fjhx.sale.service.documents.DocumentsService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fjhx.sale.entity.documents.vo.DocumentsPdfVo;
@@ -25,6 +29,9 @@ import cn.hutool.core.bean.BeanUtil;
 @Service
 public class DocumentsPdfServiceImpl extends ServiceImpl<DocumentsPdfMapper, DocumentsPdf> implements DocumentsPdfService {
 
+    @Autowired
+    private DocumentsService documentsService;
+
     @Override
     public Page<DocumentsPdfVo> getPage(DocumentsPdfSelectDto dto) {
         IWrapper<DocumentsPdf> wrapper = getWrapper();
@@ -42,7 +49,13 @@ public class DocumentsPdfServiceImpl extends ServiceImpl<DocumentsPdfMapper, Doc
     public DocumentsPdfVo detail(Long id) {
         DocumentsPdf documentsPdf = this.getOne(Wrappers.<DocumentsPdf>query().lambda().eq(DocumentsPdf::getDocumentId,id).eq(DocumentsPdf::getDataType,1));
         DocumentsPdfVo result = BeanUtil.toBean(documentsPdf, DocumentsPdfVo.class);
-        return result;
+        if(ObjectUtils.isEmpty(result)){
+            Documents documents = documentsService.detail(id);
+            return null;
+        }else{
+            return result;
+        }
+
     }
 
     @Override