update Tree
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Ewide.Core.Service
|
||||
{
|
||||
/// <summary>
|
||||
/// 字典类型与字典值构造的树
|
||||
/// </summary>
|
||||
public class DictTreeOutput
|
||||
public class DictTreeOutput : ITreeNode
|
||||
{
|
||||
/// <summary>
|
||||
/// Id
|
||||
@@ -27,9 +28,33 @@ namespace Ewide.Core.Service
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string Remark { set; get; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
public int Sort { set; get; }
|
||||
/// <summary>
|
||||
/// 子节点集合
|
||||
/// </summary>
|
||||
public List<DictTreeOutput> Children { get; set; } = new List<DictTreeOutput>();
|
||||
|
||||
public string GetId()
|
||||
{
|
||||
return Id;
|
||||
}
|
||||
|
||||
public string GetPid()
|
||||
{
|
||||
return Pid;
|
||||
}
|
||||
|
||||
public void SetChildren(IList children)
|
||||
{
|
||||
Children = (List<DictTreeOutput>)children;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,19 +178,16 @@ namespace Ewide.Core.Service
|
||||
[HttpGet("/sysDictType/tree")]
|
||||
public async Task<List<DictTreeOutput>> GetDictTree()
|
||||
{
|
||||
return await _sysDictTypeRep.DetachedEntities.Select(u => new DictTreeOutput
|
||||
var DictTypeList = await _sysDictTypeRep.AsQueryable().ToListAsync();
|
||||
return new TreeBuildUtil<DictTreeOutput>().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());
|
||||
}
|
||||
/// <summary>
|
||||
/// 创建Pids格式
|
||||
|
||||
Reference in New Issue
Block a user