nodeParser) {
return TreeBuilder.of(rootId, treeNodeConfig)
- .append(list, nodeParser).build();
+ .append(list, nodeParser).build();
}
/**
@@ -172,12 +176,13 @@ public class TreeUtil {
if (null != tree) {
final TreeNodeConfig config = tree.getConfig();
return TreeBuilder.of(rootId, config)
- .append(map)
- .build();
+ .append(map)
+ .build();
}
return createEmptyNode(rootId);
}
+ // endregion
/**
* 获取ID对应的节点,如果有多个ID相同的节点,只返回第一个。
@@ -230,7 +235,7 @@ public class TreeUtil {
}
/**
- * 获取所有父节点ID列表
+ * 获取所有父节点ID列表
*
*
* 比如有个人在研发1部,他上面有研发部,接着上面有技术中心
@@ -243,17 +248,17 @@ public class TreeUtil {
* @since 5.8.22
*/
public static List getParentsId(final MapTree node, final boolean includeCurrentNode) {
- return getParents(node, includeCurrentNode, MapTree::getId);
+ return getParents(node, includeCurrentNode, MapTree::getId);
}
/**
- * 获取所有父节点指定函数结果列表
+ * 获取所有父节点指定函数结果列表
*
* @param 节点ID类型
* @param 字段值类型
* @param node 节点
* @param includeCurrentNode 是否包含当前节点的名称
- * @param fieldFunc 获取父节点名称的函数
+ * @param fieldFunc 获取父节点名称的函数
* @return 所有父节点字段值列表,node为null返回空List
* @since 6.0.0
*/
@@ -272,7 +277,7 @@ public class TreeUtil {
while (null != parent) {
fieldValue = fieldFunc.apply(parent);
parent = parent.getParent();
- if(null != fieldValue || null != parent){
+ if (null != fieldValue || null != parent) {
// issue#I795IN,根节点的null不加入
result.add(fieldValue);
}
@@ -285,16 +290,16 @@ public class TreeUtil {
*
*
* 比如有个人在研发1部,他上面有研发部,接着上面有技术中心
- parent = parent.getParent();) {
- if(null != id || null != parent){
- // issue#I795IN,根节点的null不加入
- result.add(fieldFunc.apply(parent));
- }
- }
- return result;
- }
-
- /**
+ * parent = parent.getParent();) {
+ * if(null != id || null != parent){
+ * // issue#I795IN,根节点的null不加入
+ * result.add(fieldFunc.apply(parent));
+ * }
+ * }
+ * return result;
+ * }
+ *
+ * /**
* 创建空Tree的节点
*
* @param id 节点ID