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