//递归循环遍历list转化为tree
public static List<BusArea> arealistChildren(List<BusArea> fatherList,BusArea parentTree ,List<BusArea> ats ,List<String> pids,List<BusArea> tree){
if(tree==null){
tree = new ArrayList<BusArea>();
}
if(fatherList!=null){
for(BusArea o :fatherList){
tree.add(o);
}
}
for(BusArea atr :ats){
if(atr.getParent()!=null){
if(atr.getParent().getId().equals(parentTree.getId()))
{
tree.add(atr);
//如果父类树列表中包含当前树节点
if(pids.contains(atr.getId())){
// List<String> pbs = pids;
// pbs.remove(atr.getId());
//递归再进行处理
arealistChildren(null,atr , ats ,pids,tree );
}
}
}
}
return tree;
}
//递归循环遍历list转化为tree
猜你喜欢
转载自liuguidong.iteye.com/blog/2257027
今日推荐
周排行