27 lines
800 B
C#
27 lines
800 B
C#
using Dlhis.Entity.Basic.Entity;
|
|
using Dlhis.Entity.Device.Entities;
|
|
|
|
namespace Dlhis.ScheduledTask;
|
|
|
|
public static class RecursionHelper
|
|
{
|
|
|
|
public static List<Guid> HandlerDeviceGroupNextCodes(Guid current, List<DeviceGroupEntity> data)
|
|
{
|
|
var result = new List<Guid> { current };
|
|
|
|
InternalHandlerCodes(current, data, result);
|
|
|
|
return result;
|
|
|
|
static void InternalHandlerCodes(Guid internalCurrent, List<DeviceGroupEntity> internalData, List<Guid> internalResult)
|
|
{
|
|
var next = internalData.Where(x => x.PCode == internalCurrent);
|
|
foreach (var item in next)
|
|
{
|
|
internalResult.Add(item.Code);
|
|
InternalHandlerCodes(item.Code, internalData, internalResult);
|
|
}
|
|
}
|
|
}
|
|
} |