@Override public List<Map<String, Object>> getModuleTree(List<Map<String, Object>> list ,String flowId) { List<?> modulesId = getModulesId(flowId); moduleTree(list,modulesId); return list; } void moduleTree(List<Map<String, Object>> list,List<?> modulesId){ for (Map<String, Object> map : list) { List<Map<String, Object>> child = (List<Map<String, Object>>) map.get("children"); if (child!=null) { if (modulesId.contains(map.get("id"))) { map.put("checked", true); } //递归 moduleTree(child,modulesId); } } };
参考https://blog.csdn.net/qq_37910658/article/details/78707831