using Cis.Core.Common; using Newtonsoft.Json.Linq; namespace Cis.Application.Cb; /// /// 相机节点服务 /// [ApiDescriptionSettings(CbInfo.GroupName, Order = CbInfo.CbCameraNodeGroupOrder)] public class CbCameraNodeService : ServiceBase, ITransient { public CbCameraNodeService(SqlSugarRepository baseRep) : base(baseRep) { } /// /// 获取树 /// /// equal:ParentId(default:0); /// [HttpGet] public virtual async Task> 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; } }