/**
* 递归将菜单按照层级排序
*/
public static void sortList(List<ClaimingExpenses> list,List<ClaimingExpenses> list_sort, Integer parentid,String index){
int num = 1;
for (int i=0; i<list.size(); i++){
ClaimingExpenses ce = list.get(i);
if (ce.getParentId().equals(parentid)){
String parrentIndex = "";
if(parentid == 0){
parrentIndex = index+num;
}else{
parrentIndex = index+"."+num;
}
ce.setIndex(parrentIndex);
list_sort.add(ce);
Integer id = ce.getDataId();
sortList(list, list_sort, id,parrentIndex);
num++;
}
}
}
递归将菜单按照层级排序
最新推荐文章于 2023-12-25 01:49:58 发布