7 changed files with 161 additions and 23 deletions
			
			
		| @ -0,0 +1,40 @@ | |||||
|  | namespace Cis.Application.Cb; | ||||
|  | 
 | ||||
|  | /// <summary>
 | ||||
|  | /// 相机节点表
 | ||||
|  | /// </summary>
 | ||||
|  | [SugarTable(CbInfo.CbCameraNodeTbName, CbInfo.CbCameraNodeTbDesc)] | ||||
|  | [Tenant(CbInfo.DbName)] | ||||
|  | public class CbCameraNode : EntityBase | ||||
|  | { | ||||
|  |     /// <summary>
 | ||||
|  |     /// 组标识
 | ||||
|  |     /// </summary>
 | ||||
|  |     [SugarColumn(ColumnDescription = "组标识")] | ||||
|  |     public bool IsGroup { get; set; } | ||||
|  | 
 | ||||
|  |     /// <summary>
 | ||||
|  |     /// 名称
 | ||||
|  |     /// </summary>
 | ||||
|  |     [SugarColumn(ColumnDescription = "名称", Length = 64)] | ||||
|  |     [Required, MaxLength(64)] | ||||
|  |     public string Name { get; set; } | ||||
|  | 
 | ||||
|  |     /// <summary>
 | ||||
|  |     /// 相机 Id
 | ||||
|  |     /// </summary>
 | ||||
|  |     [SugarColumn(ColumnDescription = "相机Id")] | ||||
|  |     public long CbCameraId { get; set; } | ||||
|  | 
 | ||||
|  |     /// <summary>
 | ||||
|  |     /// 父节点 Id
 | ||||
|  |     /// </summary>
 | ||||
|  |     [SugarColumn(ColumnDescription = "父节点Id")] | ||||
|  |     public long ParentId { get; set; } | ||||
|  | 
 | ||||
|  |     /// <summary>
 | ||||
|  |     /// 子节点列表
 | ||||
|  |     /// </summary>
 | ||||
|  |     [SugarColumn(IsIgnore = true)] | ||||
|  |     public List<CbCameraNode> Child { get; set; } | ||||
|  | } | ||||
| @ -0,0 +1,34 @@ | |||||
|  | 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; | ||||
|  |     } | ||||
|  | } | ||||
| @ -1,23 +1,15 @@ | |||||
| using Furion.Logging; |  | ||||
| 
 |  | ||||
| // 处理未捕获的异常
 |  | ||||
| AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); |  | ||||
| // 启动 webServer
 | // 启动 webServer
 | ||||
| Serve.Run(RunOptions.Default.AddWebComponent<WebComponent>().WithArgs(args)); | Serve.Run(RunOptions.Default.WithArgs(args)); | ||||
| 
 |  | ||||
| void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) |  | ||||
| { |  | ||||
|     Log.Error(sender?.ToString(), e); |  | ||||
| } |  | ||||
| 
 | 
 | ||||
| public class WebComponent : IWebComponent | //Serve.Run(RunOptions.Default.AddWebComponent<WebComponent>().WithArgs(args));
 | ||||
| { | //public class WebComponent : IWebComponent
 | ||||
|     public void Load(WebApplicationBuilder builder, ComponentContext componentContext) | //{
 | ||||
|     { | //    public void Load(WebApplicationBuilder builder, ComponentContext componentContext)
 | ||||
|         // 日志过滤
 | //    {
 | ||||
|         builder.Logging.AddFilter((provider, category, logLevel) => | //        // ÈÕÖ¾¹ýÂË
 | ||||
|         { | //        builder.Logging.AddFilter((provider, category, logLevel) =>
 | ||||
|             return !new[] { "Microsoft.Hosting", "Microsoft.AspNetCore" }.Any(u => category.StartsWith(u)) && logLevel >= LogLevel.Information; | //        {
 | ||||
|         }); | //            return !new[] { "Microsoft.Hosting", "Microsoft.AspNetCore" }.Any(u => category.StartsWith(u)) && logLevel >= LogLevel.Information;
 | ||||
|     } | //        });
 | ||||
| } | //    }
 | ||||
|  | //}
 | ||||
					Loading…
					
					
				
		Reference in new issue