From b0166b4fe39247920f2e412f512fec4e6b3cae80 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Wed, 10 Aug 2022 10:08:54 +0800
Subject: [PATCH] fix

---
 src/main/java/com/xcong/farmer/cms/modules/core/service/impl/CmsCoreServiceImpl.java |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/xcong/farmer/cms/modules/core/service/impl/CmsCoreServiceImpl.java b/src/main/java/com/xcong/farmer/cms/modules/core/service/impl/CmsCoreServiceImpl.java
index eb43e96..979c54a 100644
--- a/src/main/java/com/xcong/farmer/cms/modules/core/service/impl/CmsCoreServiceImpl.java
+++ b/src/main/java/com/xcong/farmer/cms/modules/core/service/impl/CmsCoreServiceImpl.java
@@ -5,6 +5,10 @@
 import com.xcong.farmer.cms.common.contants.AppContants;
 import com.xcong.farmer.cms.core.template.TemplateConfiguration;
 import com.xcong.farmer.cms.modules.core.service.ICmsCoreService;
+import com.xcong.farmer.cms.modules.system.entity.ArticleEntity;
+import com.xcong.farmer.cms.modules.system.entity.ColumnEntity;
+import com.xcong.farmer.cms.modules.system.mapper.ArticleMapper;
+import com.xcong.farmer.cms.modules.system.mapper.ColumnMapper;
 import com.xcong.farmer.cms.modules.system.mapper.WebSetMapper;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -32,6 +36,11 @@
 
     @Autowired
     private WebSetMapper webSetMapper;
+
+    @Autowired
+    private ColumnMapper columnMapper;
+    @Autowired
+    private ArticleMapper articleMapper;
 
 //    private final Executor executor = new ThreadPoolExecutor(10, 20, 600, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
 
@@ -148,6 +157,20 @@
         Long companyId = (Long) data.get("companyId");
         Map<String, String> globalSetting = webSetMapper.selectSiteGlobalSetting(companyId);
 
+        String type = (String) data.get("templateType");
+        if ("column".equals(type)){
+            Long id = (Long) data.get("id");
+            ColumnEntity columnEntity = columnMapper.selectById(id);
+            data.put("title", columnEntity.getColumnName() + "_" + globalSetting.get("title"));
+        } else if ("article".equals(type)) {
+            Long id = (Long) data.get("id");
+            ArticleEntity article = articleMapper.selectById(id);
+            ColumnEntity columnEntity = columnMapper.selectById(article.getColumnId());
+            data.put("title", article.getTitle() + "_" + columnEntity.getColumnName() +"_" + globalSetting.get("title"));
+        } else {
+            data.put("title", globalSetting.get("title"));
+        }
+
         data.putAll(globalSetting);
     }
 }

--
Gitblit v1.9.1