Browse Source

标签字典

wujiefeng 1 year ago
parent
commit
f2f44c05aa

+ 13 - 0
FullCardClient/src/main/java/com/zhongshu/card/client/model/dictionary/DeepTreeItemQueryParam.java

@@ -0,0 +1,13 @@
+package com.zhongshu.card.client.model.dictionary;
+
+import lombok.Data;
+
+@Data
+public class DeepTreeItemQueryParam {
+
+    private String projectId;
+
+    private String dictionaryKey;
+
+    private String dictionaryId;
+}

+ 3 - 3
FullCardServer/src/main/java/com/zhongshu/card/server/core/controller/dictionary/DictionaryController.java

@@ -86,8 +86,8 @@ public class DictionaryController {
     }
 
     @Operation(summary = "查询字典所有项(树形)", description = "查询字典所有项(树形)")
-    @RequestMapping(value = "deepTreeItem", method = RequestMethod.GET)
-    public Object deepTreeItem(@RequestParam("projectId") String projectId, @RequestParam("dictionaryKey")String dictionaryKey){
-        return dictionaryService.deepTreeItem(projectId, dictionaryKey);
+    @RequestMapping(value = "deepTreeItem", method = RequestMethod.POST)
+    public Object deepTreeItem(@RequestBody DeepTreeItemQueryParam param){
+        return dictionaryService.deepTreeItem(param.getProjectId(), param.getDictionaryKey(), param.getDictionaryId());
     }
 }

+ 11 - 4
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/dictionary/DictionaryService.java

@@ -290,12 +290,19 @@ public class DictionaryService extends SuperService {
         return ResultContent.buildContent(dictionaryItemList.stream().map(this::toItemModel).toList());
     }
 
-    public Object deepTreeItem(String projectId, String dictionaryKey){
-        if (StringUtils.isBlank(dictionaryKey)){
-            return ResultContent.buildFail("字典编码不能为空");
+    public Object deepTreeItem(String projectId, String dictionaryKey, String dictionaryId){
+        if (StringUtils.isBlank(dictionaryKey) && StringUtils.isBlank(dictionaryId)){
+            return ResultContent.buildFail("字典编码和字典id不能为空");
+        }
+
+        Dictionary dictionary = null;
+
+        if (StringUtils.isNotBlank(dictionaryId)){
+            dictionary = dictionaryDao.findTopById(dictionaryId);
+        }else if (StringUtils.isNotBlank(dictionaryKey)){
+            dictionary = dictionaryDao.findTopByProjectIdAndKey(projectId, dictionaryKey);
         }
 
-        Dictionary dictionary = dictionaryDao.findTopByProjectIdAndKey(projectId, dictionaryKey);
         if (dictionary == null){
             return ResultContent.buildFail("字典不存在");
         }