5045c73d sonin

设备类别排序

1 个父辈 4ee7bc3e
......@@ -3,10 +3,7 @@ package com.skua.modules.equipment.service.impl;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
......@@ -46,6 +43,12 @@ public class EquipmentCategoryServiceImpl extends ServiceImpl<EquipmentCategoryM
public List<TreeData> tree(int tag) {
//获取数据列表
List<EquipmentCategory> list=queryList();
list.forEach(item -> {
if (item.getSort() == null) {
item.setSort(10000);
}
});
Collections.sort(list, Comparator.comparing(EquipmentCategory::getSort));
//将业务数据转换为构造树所需的数据结构
List<TransTreeModel> transTreeModels = list.stream().map(bo -> convertToTreeModel(bo)).collect(Collectors.toList());
List<TreeData> treeList=TreeUtils.buildTreeForParentId(transTreeModels, "root");
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!