浏览代码

feature: 同步修改测试

luoyb 1 年之前
父节点
当前提交
84c1d7756d

+ 6 - 1
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysDeptServiceImpl.java

@@ -269,7 +269,12 @@ public class SysDeptServiceImpl implements ISysDeptService {
         //    bo.setOrderNum(orderNum + 1);
         //}
         SysDept dept = MapstructUtils.convert(bo, SysDept.class);
-        dept.setAncestors(info.getAncestors() + StringUtils.SEPARATOR + dept.getParentId());
+        if (ObjectUtil.isNotEmpty(info)) {
+            dept.setAncestors(info.getAncestors() + StringUtils.SEPARATOR + dept.getParentId());
+        } else {
+            dept.setAncestors(dept.getParentId().toString());
+        }
+
         int count = baseMapper.insert(dept);
         if (count > 0) {
             bo.setDeptId(dept.getDeptId());