实现 权限树 list2Tree
List<Resource> tree = new ArrayList<>(); for (Resource child : list) { boolean mark = false; for (Resource father : list) { if (StringKit.isNotBlank(child.getPid()) && child.getPid().equals(father.getId())) { mark = true; if (father.getChildren() == null) { father.setChildren(new ArrayList<>()); } father.getChildren().add(child); break; } } if (!mark) { tree.add(child); } } return tree;