5045c73d sonin

设备类别排序

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