2025年4月10日16:25:46
parent
b19988672a
commit
753e7083ba
|
|
@ -130,8 +130,39 @@ public class RoleController {
|
|||
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||
|
||||
for (Permission permission : permissionList) {
|
||||
if (permission.getParent() == null){
|
||||
List<Permission> children = permission.getChildren();
|
||||
// if (permission.getParent() == null){
|
||||
// List<Permission> children = permission.getChildren();
|
||||
//
|
||||
// Map<String, Object> map = new HashMap<>();
|
||||
// map.put("id", permission.getId());
|
||||
// map.put("name", permission.getName());
|
||||
// map.put("desc", permission.getDescription());
|
||||
// map.put("url", permission.getUrl());
|
||||
// map.put("sort", permission.getSort());
|
||||
// map.put("parentId", permission.getParent() == null ? 0L : permission.getParent().getId());
|
||||
//
|
||||
// List<Map<String, Object>> childList = new ArrayList<>();
|
||||
//
|
||||
// if (!children.isEmpty()){
|
||||
// for (Permission child : children) {
|
||||
// if (permissionList.contains(child)){
|
||||
// Map<String, Object> childMap = new HashMap<>();
|
||||
// childMap.put("id", child.getId());
|
||||
// childMap.put("name", child.getName());
|
||||
// childMap.put("desc", child.getDescription());
|
||||
// childMap.put("url", child.getUrl());
|
||||
// childMap.put("sort", child.getSort());
|
||||
// childMap.put("parentId", child.getParent() == null ? 0L : child.getParent().getId());
|
||||
// childList.add(childMap);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// map.put("children", childList);
|
||||
//
|
||||
// resultList.add(map);
|
||||
// }
|
||||
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("id", permission.getId());
|
||||
|
|
@ -140,29 +171,10 @@ public class RoleController {
|
|||
map.put("url", permission.getUrl());
|
||||
map.put("sort", permission.getSort());
|
||||
map.put("parentId", permission.getParent() == null ? 0L : permission.getParent().getId());
|
||||
|
||||
List<Map<String, Object>> childList = new ArrayList<>();
|
||||
|
||||
if (!children.isEmpty()){
|
||||
for (Permission child : children) {
|
||||
if (permissionList.contains(child)){
|
||||
Map<String, Object> childMap = new HashMap<>();
|
||||
childMap.put("id", child.getId());
|
||||
childMap.put("name", child.getName());
|
||||
childMap.put("desc", child.getDescription());
|
||||
childMap.put("url", child.getUrl());
|
||||
childMap.put("sort", child.getSort());
|
||||
childMap.put("parentId", child.getParent() == null ? 0L : child.getParent().getId());
|
||||
childList.add(childMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
map.put("children", childList);
|
||||
map.put("children", new ArrayList<>());
|
||||
|
||||
resultList.add(map);
|
||||
}
|
||||
}
|
||||
|
||||
return Result.success(resultList);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue