url 정렬

master
mjkhan21 1 year ago
parent 389cca93c6
commit 212f8d0172

@ -1,9 +1,9 @@
package cokr.xit.foundation.web;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import org.springframework.web.method.HandlerMethod;
@ -42,13 +42,13 @@ public class RequestHandlerReader extends AbstractComponent {
}
});
Set<String> parentIDs = nameURLs.stream()
nameURLs.stream()
.filter(row -> !isEmpty(row.get("parentID")))
.map(row -> row.string("parentID"))
.collect(Collectors.toSet());
parentIDs.forEach(parentID -> {
nameURLs.add(menuItem(null, parentID));
});
.collect(Collectors.toSet())
.forEach(parentID -> {
nameURLs.add(menuItem(null, parentID));
});
Hierarchy<DataObject> tree = new HierarchyBuilder<DataObject>()
.getID(row -> row.string("url"))
@ -62,7 +62,10 @@ public class RequestHandlerReader extends AbstractComponent {
})
.setElements(nameURLs)
.build();
return tree.topElements();
List<DataObject> top = tree.topElements();
Collections.sort(top, (u0, u1) -> u0.string("url").compareTo(u1.string("url")));
return top;
}
private static DataObject menuItem(String name, String path) {

Loading…
Cancel
Save