|
@@ -1,9 +1,7 @@
|
|
|
package thyyxxk.webserver.utils;
|
|
|
|
|
|
import cn.hutool.core.util.ReflectUtil;
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import thyyxxk.webserver.entity.settings.IntergrationMenu;
|
|
|
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -25,9 +23,9 @@ public class TreeUtil {
|
|
|
}
|
|
|
|
|
|
public static <T> List<T> ObjectSort(List<T> tempList, String sortName) {
|
|
|
- String getSortName = "get" + StringUtil.getMethodName(sortName);
|
|
|
- String getChildrenName = "get" + StringUtil.getMethodName("children");
|
|
|
- String setChildrenName = "set" + StringUtil.getMethodName("children");
|
|
|
+ String getSortName = StringUtil.getMethodName(sortName);
|
|
|
+ String getChildrenName = StringUtil.getMethodName("children");
|
|
|
+ String setChildrenName = StringUtil.setMethodName("children");
|
|
|
Stream<T> sorted = tempList
|
|
|
.stream()
|
|
|
.sorted((Comparator.comparing(a -> {
|
|
@@ -51,8 +49,8 @@ public class TreeUtil {
|
|
|
}
|
|
|
|
|
|
public static <T> List<T> ObjectTree(List<T> tempList, String id, String parentId, TowFunction<T, T> addCallback) {
|
|
|
- id = "get" + StringUtil.getMethodName(id);
|
|
|
- parentId = "get" + StringUtil.getMethodName(parentId);
|
|
|
+ id = "get" + StringUtil.capitalizeTheFirstLetter(id);
|
|
|
+ parentId = "get" + StringUtil.capitalizeTheFirstLetter(parentId);
|
|
|
|
|
|
List<T> resultList = new LinkedList<>();
|
|
|
Map<Object, T> treeMap = new HashMap<>(tempList.size());
|