From 3faf877e3ca03028d60bba265249a543e8f9b533 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期五, 12 七月 2024 15:17:43 +0800
Subject: [PATCH] 提交

---
 server/service/src/main/java/com/doumee/service/business/impl/ShopServiceImpl.java |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/server/service/src/main/java/com/doumee/service/business/impl/ShopServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/ShopServiceImpl.java
index 6223904..2a03951 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/ShopServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/ShopServiceImpl.java
@@ -841,10 +841,16 @@
                     s.setIdPath(s.getId()+"/");
                     shopMapper.updateById(s);
                 }else{
+                    String idPath = StringUtils.defaultString(parent.getIdPath(),"")+ shop.getId()+"/";
+                    String namePath =StringUtils.defaultString(parent.getNamePath(),"")+"/"+shop.getName();
                     s.setParentId(parent.getId());
-                    s.setNamePath(parent.getNamePath()+"/"+s.getName());
-                    s.setIdPath(parent.getIdPath()+s.getId()+"/");
-                    shopMapper.updateById(s);
+                    s.setNamePath(namePath);
+                    s.setIdPath(idPath);
+                    if(!(Constants.equalsLong(parent.getId(),shop.getParentId())
+                            && StringUtils.equals(idPath,shop.getIdPath())
+                            &&StringUtils.equals(namePath,shop.getNamePath())) ){
+                        shopMapper.updateById(s);
+                    }
                 }
                 if(shop.getChildList()!=null && shop.getChildList().size()>0){
                     updateNamePath(s,shop.getChildList());

--
Gitblit v1.9.3