递归遍历组织机构

public List getCdtj() {

/*组织机构树*/

List deptTree = safeMonitorService.getDepartTree();

List cdtjList=statisticalDataService.getLstj();

tree(deptTree,cdtjList);

return deptTree;

}



/*递归遍历组织机构,判断id相同填入数据*/

public void tree(List list,List cdtjList){

for(EasyUIJsonTree A:list){

if(!CollectionUtils.isEmpty(A.getChildren())){

List children = A.getChildren();

tree(children,cdtjList);

}else{

for(Cdtj B:cdtjList){

HashMap map=new HashMap<>();

map.put("cdtj", B);

if(A.getMineId().equals(B.getMineID())){

A.setAttributes(map);

}

}

}

}

}

你可能感兴趣的:(递归遍历组织机构)