diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java index 35f627696..aa69c4751 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java @@ -241,7 +241,7 @@ public class SysDeptServiceImpl implements ISysDeptService List children = deptMapper.selectChildrenDeptById(deptId); for (SysDept child : children) { - child.setAncestors(child.getAncestors().replace(oldAncestors, newAncestors)); + child.setAncestors(child.getAncestors().replaceFirst(oldAncestors, newAncestors)); } if (children.size() > 0) {