update:树节点工具根节点值

This commit is contained in:
2021-04-27 17:45:19 +08:00
parent cffb6d2f0c
commit 6e83abf8d0

View File

@@ -1,4 +1,5 @@
using System.Collections;
using System;
using System.Collections;
using System.Collections.Generic;
namespace Ewide.Core
@@ -36,7 +37,7 @@ namespace Ewide.Core
/// <summary>
/// 顶级节点的父节点Id(默认0)
/// </summary>
private readonly string _rootParentId = System.Guid.Empty.ToString().ToLower();
private readonly List<string> _rootParentIds = new List<string> {string.Empty,Guid.Empty.ToString() };
/// <summary>
/// 构造树节点
@@ -50,7 +51,7 @@ namespace Ewide.Core
var results = new List<T>();
nodes.ForEach(u =>
{
if (_rootParentId == u.GetPid())
if (_rootParentIds.Contains(u.GetPid()))
results.Add(u);
});
return results;