这里记录一下
public static List<Map> getTreeDep(List<Department> depList,Long parentId){ List<Map> mapList=new ArrayList<Map>(); for(Department department:depList){ if(department.getParentId()==parentId){ Map map=new HashedMap(); map.put("id",department.getId()); map.put("text",department.getName()); map.put("state",department.getIsDelete()); map.put("iconCls","emptyico"); map.put("children",getTreeDep(depList,department.getId())); mapList.add(map); } } return mapList; }