修改上级部门(选择项排除本身和下级)
This commit is contained in:
@ -28,6 +28,14 @@ public interface ISysDeptService
|
||||
*/
|
||||
public List<Ztree> selectDeptTree(SysDept dept);
|
||||
|
||||
/**
|
||||
* 查询部门管理树(排除下级)
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @return 所有部门信息
|
||||
*/
|
||||
public List<Ztree> selectDeptTreeExcludeChild(SysDept dept);
|
||||
|
||||
/**
|
||||
* 根据角色ID查询菜单
|
||||
*
|
||||
|
@ -1,7 +1,9 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -54,6 +56,32 @@ public class SysDeptServiceImpl implements ISysDeptService
|
||||
return ztrees;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询部门管理树(排除下级)
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @return 所有部门信息
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "d")
|
||||
public List<Ztree> selectDeptTreeExcludeChild(SysDept dept)
|
||||
{
|
||||
Long deptId = dept.getDeptId();
|
||||
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 + ""))
|
||||
{
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
List<Ztree> ztrees = initZtree(deptList);
|
||||
return ztrees;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据角色ID查询部门(数据权限)
|
||||
*
|
||||
|
Reference in New Issue
Block a user