feat: 外标引用标准列表权限

This commit is contained in:
2024-04-11 09:14:18 +08:00
parent e227a12404
commit c65befd0d8
3 changed files with 111 additions and 10 deletions
@@ -156,4 +156,11 @@ public interface ISysDepartService extends IService<SysDepart>{
* @return
*/
List<SysDepart> queryDeptByPid(String pid);
/**
* 获取所有节点的Id
* @param departList
* @return
*/
List<String> getAllId(List<SysDepartTreeModel> departList);
}
@@ -558,6 +558,39 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart
return this.baseMapper.queryDeptByPid(pid);
}
/**
* 获取树形结构中所有节点的ID
* @param departList 树形结构的根节点列表
* @return 包含所有节点ID的列表
*/
@Override
public List<String> getAllId(List<SysDepartTreeModel> departList) {
List<String> ids = new ArrayList<>();
for (SysDepartTreeModel depart : departList) {
collectIds(depart, ids);
}
return ids;
}
/**
* 递归收集节点ID
* @param node 当前节点
* @param ids 收集到的ID列表
*/
private static void collectIds(SysDepartTreeModel node, List<String> ids) {
if (node == null) {
return;
}
ids.add(node.getId()); // 添加当前节点的ID
List<SysDepartTreeModel> children = node.getChildren();
if (children != null) {
for (SysDepartTreeModel child : children) {
collectIds(child, ids); // 递归处理子节点
}
}
}
/**
* 根据关键字筛选部门信息
* @param keyWord