【8.3.0】【rule】完善default树排序工具

master
stylefeng 2024-09-07 20:57:31 +08:00
parent 60f1fbb740
commit 2f2218a2a9
1 changed files with 4 additions and 4 deletions

View File

@ -38,7 +38,7 @@ import java.util.List;
* @since 2018/7/25 5:59 * @since 2018/7/25 5:59
*/ */
@Data @Data
public class DefaultTreeBuildFactory<T extends AbstractTreeNode> implements AbstractTreeBuildFactory<T> { public class DefaultTreeBuildFactory<T extends AbstractTreeNode<T>> implements AbstractTreeBuildFactory<T> {
/** /**
* id(-1) * id(-1)
@ -79,14 +79,14 @@ public class DefaultTreeBuildFactory<T extends AbstractTreeNode> implements Abst
* @param node id * @param node id
* @param childNodeLists * @param childNodeLists
*/ */
private void buildChildNodes(List<T> totalNodes, T node, List<T> childNodeLists) { protected void buildChildNodes(List<T> totalNodes, T node, List<T> childNodeLists) {
if (totalNodes == null || node == null) { if (totalNodes == null || node == null) {
return; return;
} }
List<T> nodeSubLists = getSubChildsLevelOne(totalNodes, node); List<T> nodeSubLists = getSubChildsLevelOne(totalNodes, node);
if (nodeSubLists.size() == 0) { if (nodeSubLists.isEmpty()) {
} else { } else {
for (T nodeSubList : nodeSubLists) { for (T nodeSubList : nodeSubLists) {
@ -105,7 +105,7 @@ public class DefaultTreeBuildFactory<T extends AbstractTreeNode> implements Abst
* @param node model * @param node model
* @author fengshuonan * @author fengshuonan
*/ */
private List<T> getSubChildsLevelOne(List<T> list, T node) { protected List<T> getSubChildsLevelOne(List<T> list, T node) {
List<T> nodeList = new ArrayList<>(); List<T> nodeList = new ArrayList<>();
for (T nodeItem : list) { for (T nodeItem : list) {
if (nodeItem.getNodeParentId().equals(node.getNodeId())) { if (nodeItem.getNodeParentId().equals(node.getNodeId())) {