You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
990 B
34 lines
990 B
using Cis.Core.Common;
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
namespace Cis.Application.Cb;
|
|
|
|
/// <summary>
|
|
/// 相机节点服务
|
|
/// </summary>
|
|
[ApiDescriptionSettings(CbInfo.GroupName, Order = CbInfo.CbCameraNodeGroupOrder)]
|
|
public class CbCameraNodeService : ServiceBase<CbCameraNode>, ITransient
|
|
{
|
|
public CbCameraNodeService(SqlSugarRepository<CbCameraNode> baseRep) : base(baseRep)
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取树
|
|
/// </summary>
|
|
/// <param name="queryJson">equal:ParentId(default:0);</param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public virtual async Task<List<CbCameraNode>> GetTree(string queryJson = "")
|
|
{
|
|
JObject queryObj = queryJson.ToJObject();
|
|
queryObj.TryAdd("ParentId", 0);
|
|
|
|
long parentId = (long)queryObj.GetValue("ParentId");
|
|
|
|
var tree = await _baseRep.AsQueryable()
|
|
.OrderBy(it => it.CreateTime)
|
|
.ToTreeAsync(it => it.Child, it => it.ParentId, parentId);
|
|
return tree;
|
|
}
|
|
}
|