|
|
@ -1,6 +1,5 @@
|
|
|
|
package com.ruoyi.web.controller.system;
|
|
|
|
package com.ruoyi.web.controller.system;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.Iterator;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import org.apache.commons.lang3.ArrayUtils;
|
|
|
|
import org.apache.commons.lang3.ArrayUtils;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@ -54,16 +53,7 @@ public class SysDeptController extends BaseController
|
|
|
|
public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId)
|
|
|
|
public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
List<SysDept> depts = deptService.selectDeptList(new SysDept());
|
|
|
|
List<SysDept> depts = deptService.selectDeptList(new SysDept());
|
|
|
|
Iterator<SysDept> it = depts.iterator();
|
|
|
|
depts.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""));
|
|
|
|
while (it.hasNext())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
SysDept d = (SysDept) it.next();
|
|
|
|
|
|
|
|
if (d.getDeptId().intValue() == deptId
|
|
|
|
|
|
|
|
|| ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
it.remove();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return AjaxResult.success(depts);
|
|
|
|
return AjaxResult.success(depts);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|