优化部门列表树排除条件

This commit is contained in:
RuoYi
2021-08-30 15:05:33 +08:00
parent 08fc4740d5
commit f68f4824cd
3 changed files with 22 additions and 5 deletions

View File

@ -70,14 +70,14 @@ public class SysDeptServiceImpl implements ISysDeptService
@DataScope(deptAlias = "d")
public List<Ztree> selectDeptTreeExcludeChild(SysDept dept)
{
Long deptId = dept.getDeptId();
Long excludeId = dept.getExcludeId();
List<SysDept> deptList = deptMapper.selectDeptList(dept);
Iterator<SysDept> it = deptList.iterator();
while (it.hasNext())
{
SysDept d = (SysDept) it.next();
if (d.getDeptId().intValue() == deptId
|| ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""))
if (d.getDeptId().intValue() == excludeId
|| ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), excludeId + ""))
{
it.remove();
}