mirror of https://gitee.com/stylefeng/roses
【8.3.0】【rule】完善default树排序工具
parent
60f1fbb740
commit
2f2218a2a9
|
@ -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())) {
|
||||||
|
|
Loading…
Reference in New Issue