diff --git a/Api/Ewide.Core/Ewide.Core.xml b/Api/Ewide.Core/Ewide.Core.xml index 8d9d44b..6d76c63 100644 --- a/Api/Ewide.Core/Ewide.Core.xml +++ b/Api/Ewide.Core/Ewide.Core.xml @@ -3969,6 +3969,16 @@ 名称-对应字典值的value + + + 备注 + + + + + 排序 + + 子节点集合 diff --git a/Api/Ewide.Core/Service/Dict/Dto/DictTreeOutput.cs b/Api/Ewide.Core/Service/Dict/Dto/DictTreeOutput.cs index b2144b1..67d1505 100644 --- a/Api/Ewide.Core/Service/Dict/Dto/DictTreeOutput.cs +++ b/Api/Ewide.Core/Service/Dict/Dto/DictTreeOutput.cs @@ -1,11 +1,12 @@ -using System.Collections.Generic; +using System.Collections; +using System.Collections.Generic; namespace Ewide.Core.Service { /// /// 字典类型与字典值构造的树 /// - public class DictTreeOutput + public class DictTreeOutput : ITreeNode { /// /// Id @@ -27,9 +28,33 @@ namespace Ewide.Core.Service /// public string Name { get; set; } + /// + /// 备注 + /// + public string Remark { set; get; } + + /// + /// 排序 + /// + public int Sort { set; get; } /// /// 子节点集合 /// public List Children { get; set; } = new List(); + + public string GetId() + { + return Id; + } + + public string GetPid() + { + return Pid; + } + + public void SetChildren(IList children) + { + Children = (List)children; + } } } diff --git a/Api/Ewide.Core/Service/Dict/SysDictTypeService.cs b/Api/Ewide.Core/Service/Dict/SysDictTypeService.cs index 5532c86..f5ae5b1 100644 --- a/Api/Ewide.Core/Service/Dict/SysDictTypeService.cs +++ b/Api/Ewide.Core/Service/Dict/SysDictTypeService.cs @@ -178,19 +178,16 @@ namespace Ewide.Core.Service [HttpGet("/sysDictType/tree")] public async Task> GetDictTree() { - return await _sysDictTypeRep.DetachedEntities.Select(u => new DictTreeOutput + var DictTypeList = await _sysDictTypeRep.AsQueryable().ToListAsync(); + return new TreeBuildUtil().DoTreeBuild(DictTypeList.Select(u => new DictTreeOutput { - Id = u.Id, + Name=u.Name, Code = u.Code, - Name = u.Name, - Children = u.SysDictDatas.Select(c => new DictTreeOutput - { - Id = c.Id, - Pid = c.TypeId, - Code = c.Code, - Name = c.Value - }).ToList() - }).ToListAsync(); + Pid=u.Pid, + Id=u.Id, + Remark=u.Remark, + Sort =u.Sort + }).OrderBy(s => s.Sort).ToList()); } /// /// 创建Pids格式