diff --git a/docs/研发/技术选型.xmind b/docs/研发/技术选型.xmind index 8b4e4918..9296cffe 100644 Binary files a/docs/研发/技术选型.xmind and b/docs/研发/技术选型.xmind differ diff --git a/docs/资料/Elasticsearch 中国开发者调查报告.pdf b/docs/资料/Elasticsearch 中国开发者调查报告.pdf new file mode 100644 index 00000000..4a8145f5 Binary files /dev/null and b/docs/资料/Elasticsearch 中国开发者调查报告.pdf differ diff --git a/docs/资料/JavaScript语言...1576751825.pdf b/docs/资料/JavaScript语言...1576751825.pdf new file mode 100644 index 00000000..22572f4b Binary files /dev/null and b/docs/资料/JavaScript语言...1576751825.pdf differ diff --git a/docs/资料/Java开发手册.pdf b/docs/资料/Java开发手册.pdf new file mode 100644 index 00000000..7cf51a91 Binary files /dev/null and b/docs/资料/Java开发手册.pdf differ diff --git a/docs/资料/基于WebAssembl...1576752147.pdf b/docs/资料/基于WebAssembl...1576752147.pdf new file mode 100644 index 00000000..9e0e580b Binary files /dev/null and b/docs/资料/基于WebAssembl...1576752147.pdf differ diff --git a/docs/资料/微前端架构体系--...1576752745.pdf b/docs/资料/微前端架构体系--...1576752745.pdf new file mode 100644 index 00000000..ed12421d Binary files /dev/null and b/docs/资料/微前端架构体系--...1576752745.pdf differ diff --git a/docs/资料/标准微前端架构在...1576752061.pdf b/docs/资料/标准微前端架构在...1576752061.pdf new file mode 100644 index 00000000..0d042cb2 Binary files /dev/null and b/docs/资料/标准微前端架构在...1576752061.pdf differ diff --git a/docs/资料/阿里云AIoT开发手册.pdf b/docs/资料/阿里云AIoT开发手册.pdf new file mode 100644 index 00000000..9352c58c Binary files /dev/null and b/docs/资料/阿里云AIoT开发手册.pdf differ diff --git a/docs/资料/阿里巴巴大数据及...1577948707.pdf b/docs/资料/阿里巴巴大数据及...1577948707.pdf new file mode 100644 index 00000000..6759106d Binary files /dev/null and b/docs/资料/阿里巴巴大数据及...1577948707.pdf differ diff --git a/projects/IoTCenter/Api/NodeController.cs b/projects/IoTCenter/Api/NodeController.cs index 3bac4639..229ce2db 100644 --- a/projects/IoTCenter/Api/NodeController.cs +++ b/projects/IoTCenter/Api/NodeController.cs @@ -18,14 +18,17 @@ namespace UserCenter.Controllers private readonly IConfiguration _cfg; private readonly IRepository _nodeRepo; private readonly IRepository _nodeCategoryRepo; + private readonly IRepository _deviceRepo; public NodeController(IConfiguration cfg, IRepository nodeRepo, - IRepository nodeCategoryRepo) + IRepository nodeCategoryRepo, + IRepository deviceRepo) { this._cfg = cfg; this._nodeRepo = nodeRepo; this._nodeCategoryRepo = nodeCategoryRepo; + this._deviceRepo = deviceRepo; } [HttpPost] @@ -34,6 +37,7 @@ namespace UserCenter.Controllers try { var model = this._nodeRepo.ReadOnlyTable() + .ToList() .Select(o => new { o.Id, @@ -41,7 +45,7 @@ namespace UserCenter.Controllers o.Number, o.Image, o.DisplayOrder, - Count = o.Devices.Count() + Count = _deviceRepo.ReadOnlyTable().Count(d => d.NodeId == o.Id) }); return Ok(model); } diff --git a/projects/IoTCenter/Api/ProductController.cs b/projects/IoTCenter/Api/ProductController.cs index f51899c3..80c51304 100644 --- a/projects/IoTCenter/Api/ProductController.cs +++ b/projects/IoTCenter/Api/ProductController.cs @@ -35,6 +35,7 @@ namespace UserCenter.Controllers { var model = this._productRepo.ReadOnlyTable() .OrderBy(o => o.DisplayOrder) + .ToList() .Select(o => new { o.Id, @@ -42,7 +43,7 @@ namespace UserCenter.Controllers o.Number, o.Image, o.DisplayOrder, - Count = o.Devices.Count() + Count = _deviceRepo.ReadOnlyTable().Count(d => d.ProductId == o.Id) }); return Ok(model); } diff --git a/projects/IoTCenter/Areas/Admin/Controllers/HomeController.cs b/projects/IoTCenter/Areas/Admin/Controllers/HomeController.cs index a2a01663..0fa00fb9 100644 --- a/projects/IoTCenter/Areas/Admin/Controllers/HomeController.cs +++ b/projects/IoTCenter/Areas/Admin/Controllers/HomeController.cs @@ -13,41 +13,49 @@ namespace IoTCenter.Areas.Admin.Controllers { private readonly IRepository _nodeRepo; private readonly IRepository _productRepo; + private readonly IRepository _deviceRepo; private readonly IRepository _categoryRepo; - public HomeController(IRepository nodeRepo, IRepository categoryRepo, IRepository productRepo) + public HomeController(IRepository nodeRepo, IRepository categoryRepo, IRepository productRepo, IRepository deviceRepo) { this._nodeRepo = nodeRepo; this._categoryRepo = categoryRepo; this._productRepo = productRepo; + this._deviceRepo = deviceRepo; } public IActionResult Index() { var model = new HomeIndexViewModel { - Nodes = this._nodeRepo.ReadOnlyTable().Select(o => new NodeViewModel + Nodes = this._nodeRepo.ReadOnlyTable() + .ToList() + .Select(o => new NodeViewModel { Id = o.Id, Number = o.Number, Name = o.Name, Image = o.Image, - DeviceCount = o.Devices.Count() + DeviceCount = _deviceRepo.ReadOnlyTable().Count(d => d.NodeId == o.Id) }).ToList(), - Categories = this._categoryRepo.ReadOnlyTable().Select(o => new CategoryViewModel + Categories = this._categoryRepo.ReadOnlyTable() + .ToList() + .Select(o => new CategoryViewModel { Id = o.Id, Name = o.Name, Image = o.Image, Number = o.Number, - DeviceCount = o.Products.SelectMany(o => o.Devices).Count() + DeviceCount = _deviceRepo.ReadOnlyTable().Count(d => d.Product.CategoryId == o.Id) }).ToList(), - Products = this._productRepo.ReadOnlyTable().Select(o => new ProductViewModel + Products = this._productRepo.ReadOnlyTable() + .ToList() + .Select(o => new ProductViewModel { Id = o.Id, Name = o.Name, Image = o.Image, - DeviceCount = o.Devices.Count() + DeviceCount = _deviceRepo.ReadOnlyTable().Count(d => d.ProductId == o.Id) }).ToList() }; return View(model); diff --git a/projects/IoTCenter/Controllers/AppController.cs b/projects/IoTCenter/Controllers/AppController.cs index 544a7778..bb10ea17 100644 --- a/projects/IoTCenter/Controllers/AppController.cs +++ b/projects/IoTCenter/Controllers/AppController.cs @@ -92,6 +92,7 @@ namespace IoTCenter.Controllers .Include(o => o.Scenes) .OrderBy(o => o.DisplayOrder) .ThenBy(o => o.Name) + .ToList() .Select(o => new { o.Id, @@ -100,7 +101,7 @@ namespace IoTCenter.Controllers o.Image, o.DisplayOrder, o.Scenes, - DeviceCount = o.Devices.Count() + DeviceCount = this._deviceRepo.ReadOnlyTable().Count(d => d.NodeId == o.Id) }) .ToList(); return Json(model); diff --git a/projects/IoTCenter/appsettings.json b/projects/IoTCenter/appsettings.json index 8a12ca42..491fc343 100644 --- a/projects/IoTCenter/appsettings.json +++ b/projects/IoTCenter/appsettings.json @@ -12,7 +12,7 @@ "redis": "127.0.0.1:6379,allowAdmin=true" }, "AppSettings": { - "database": "sqlite", + "database": "postgresql", "UseCookieSessionStore": false } } \ No newline at end of file