From 4c2bae1c7e6f84699091a7e094120808137138dc Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期四, 07 十一月 2024 11:38:59 +0800
Subject: [PATCH] 最新版本541200007

---
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/CategoryServiceImpl.java |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/CategoryServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/CategoryServiceImpl.java
index 8eaa6f8..6de45a4 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/CategoryServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/CategoryServiceImpl.java
@@ -14,11 +14,13 @@
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.shiro.SecurityUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 import java.util.Objects;
@@ -155,6 +157,36 @@
         QueryWrapper<Category> wrapper = new QueryWrapper<>(category);
         return categoryMapper.selectCount(wrapper);
     }
+    @Override
+    public  List<Category> findChileList(Category model) {
+        List<Category> list =findList(model);
+        List<Category> data = new ArrayList<>();
+        if(list!=null){
+            for(Category category : list){
+                if(category.getParentId()!=null){
+                    Category pcate = getParentById(category.getParentId(),list);
+                    if(pcate!=null){
+                        category.setParentName(StringUtils.defaultString(pcate.getName(),""));
+                        category.setName(StringUtils.defaultString(category.getName(),""));
+                        category.setGroupName( category.getParentName()+"/"+category.getName());
+                        data.add(category);
+                    }
+                }
+            }
+        }
+        return  data;
+    }
+
+    private Category getParentById(Integer parentId, List<Category> list) {
+        if(list!=null){
+            for(Category category : list){
+                if(Constants.equalsInteger(parentId,category.getId())){
+                   return  category;
+                }
+            }
+        }
+        return  null;
+    }
 
     private void checkUnique(Category category){
         QueryWrapper<Category> wrapper = new QueryWrapper<>();

--
Gitblit v1.9.3