Browse Source

修改会员关系

Yangzw 1 month ago
parent
commit
bee39ba005

+ 2 - 3
feifan-module-distri/feifan-module-distri-biz/src/main/java/cn/newfeifan/mall/module/distri/service/sharepath/SharePathServiceImpl.java

@@ -30,7 +30,6 @@ import javax.annotation.Resource;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.validation.annotation.Validated;
 
-import java.math.BigDecimal;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.LocalTime;
@@ -372,8 +371,8 @@ public class SharePathServiceImpl implements SharePathService {
                     break;
                 }
             }
-            sharePathMapper.updateById(user);
         }
+        sharePathMapper.updateById(user);
 
         // 用户的关系网
         List<SharePathDO> userArea = sharePathMapper.selectListByUserId(userId, 99999);
@@ -386,8 +385,8 @@ public class SharePathServiceImpl implements SharePathService {
             }
 
             sharePathDO.setDepth(sharePathDO.getDepth() - depth);
+            sharePathMapper.updateById(sharePathDO);
         }
-        sharePathMapper.updateBatch(userArea);
     }
 
     public List<TreeNode> sharePathDO2TreeNode(List<SharePathDO> sharePathDOS) {

+ 2 - 2
feifan-module-distri/feifan-module-distri-biz/src/main/resources/mapper/sharepath/SharePathMapper.xml

@@ -106,12 +106,12 @@
             resultType="cn.newfeifan.mall.module.distri.dal.dataobject.sharepath.SharePathDO">
         WITH RECURSIVE user_hierarchy AS (
         -- 初始查询,获取目标用户及其直接左右区用户
-        SELECT user_id, user_name, left_child_id, right_child_id,parent_id, depth, referrer_id,phone
+        SELECT id, user_id, user_name, left_child_id, right_child_id,parent_id, depth, referrer_id,phone
         FROM distri_share_path
         WHERE user_id = #{userId}
         UNION ALL
         -- 递归部分,获取左右区用户的下级用户,处理NULL值
-        SELECT u.user_id, u.user_name, u.left_child_id, u.right_child_id, u.parent_id, u.depth, u.referrer_id, u.phone
+        SELECT u.id, u.user_id, u.user_name, u.left_child_id, u.right_child_id, u.parent_id, u.depth, u.referrer_id, u.phone
         FROM distri_share_path u
         INNER JOIN user_hierarchy uh ON (
         (u.user_id = uh.left_child_id AND uh.left_child_id IS NOT NULL) OR