树级结构更新子节点使用replaceFirst

This commit is contained in:
RuoYi 2021-05-11 14:25:25 +08:00
parent dd384e4a31
commit be5c19b764

View File

@ -241,7 +241,7 @@ public class SysDeptServiceImpl implements ISysDeptService
List<SysDept> children = deptMapper.selectChildrenDeptById(deptId); List<SysDept> children = deptMapper.selectChildrenDeptById(deptId);
for (SysDept child : children) for (SysDept child : children)
{ {
child.setAncestors(child.getAncestors().replace(oldAncestors, newAncestors)); child.setAncestors(child.getAncestors().replaceFirst(oldAncestors, newAncestors));
} }
if (children.size() > 0) if (children.size() > 0)
{ {