Former-commit-id: 90c757ba0db46b51b578a26cf6dbbf2461b55de5
Former-commit-id: f4874040f16c2c46c8615bf51a5fb9fbb713e6de
1.0
wanggang 5 years ago
parent 3dec769df2
commit 2ddfaf442c

@ -24,13 +24,14 @@ namespace IoT.Shared.Application.Domain.Entities
[Display(Name = "序号")] [Display(Name = "序号")]
public int DisplayOrder { get; set; } public int DisplayOrder { get; set; }
[Display(Name = "机构Id")] public Guid BuildingId { get; set; }
public Guid OrganId { get; set; }
public Guid? BuildingId { get; set; }
public Organ Organ { get; set; }
public Building Building { get; set; } public Building Building { get; set; }
public List<IoTSceneIoTCommand> IoTCommands { get; set; } = new List<IoTSceneIoTCommand>(); public List<IoTSceneIoTCommand> IoTCommands { get; set; } = new List<IoTSceneIoTCommand>();
public List<IoTTimer> IoTTimers { get; set; } = new List<IoTTimer>(); public List<IoTTimer> IoTTimers { get; set; } = new List<IoTTimer>();
public List<IoTTigger> IoTTiggers { get; set; } = new List<IoTTigger>(); public List<IoTTigger> IoTTiggers { get; set; } = new List<IoTTigger>();
} }
} }

@ -21,7 +21,6 @@ namespace IoT.Shared.Application.Domain.Entities
public bool IsReadOnly { get; set; } public bool IsReadOnly { get; set; }
public List<Building> Buildings { get; set; } = new List<Building>(); public List<Building> Buildings { get; set; } = new List<Building>();
public List<OrganUser> OrganUsers { get; set; } = new List<OrganUser>(); public List<OrganUser> OrganUsers { get; set; } = new List<OrganUser>();
public List<IoTScene> OrganScenes { get; set; } = new List<IoTScene>();
public List<OrganRole> Roles { get; set; } = new List<OrganRole>(); public List<OrganRole> Roles { get; set; } = new List<OrganRole>();
public List<PermissionCategory> Categories { get; set; } = new List<PermissionCategory>(); public List<PermissionCategory> Categories { get; set; } = new List<PermissionCategory>();
public List<Title> Titles { get; set; } = new List<Title>(); public List<Title> Titles { get; set; } = new List<Title>();

@ -135,16 +135,6 @@ namespace IoT.Shared.Areas.IoTCenter.Controlls
return new JsonResult(this.GetProductApiSelectList(parentId, selected)); return new JsonResult(this.GetProductApiSelectList(parentId, selected));
} }
public SelectList GetCameraSelectList(string deviceNumber)
{
var list = this._deviceRepo.ReadOnlyTable()
.Where(o => o.Product.Number == "onvifcamera")
.WhereIf(!string.IsNullOrEmpty(deviceNumber), o => o.Number == deviceNumber)
.Select(o => new { Id = o.Number, Name = o.DisplayName })
.ToList();
return new SelectList(list, "Id", "Name", deviceNumber);
}
#pragma warning disable CA1822 // Mark members as static #pragma warning disable CA1822 // Mark members as static
public JsonResult CronValid(string cron) public JsonResult CronValid(string cron)
{ {

@ -167,9 +167,9 @@ CREATE TABLE "iot_IoTScene" (
"Image" TEXT NOT NULL, "Image" TEXT NOT NULL,
"Hidden" INTEGER NOT NULL, "Hidden" INTEGER NOT NULL,
"DisplayOrder" INTEGER NOT NULL, "DisplayOrder" INTEGER NOT NULL,
"OrganId" TEXT NOT NULL, "BuildingId" TEXT NOT NULL,
"BuildingId" TEXT NULL, "OrganId" TEXT NULL,
CONSTRAINT "FK_iot_IoTScene_iot_Organ_OrganId" FOREIGN KEY ("OrganId") REFERENCES "iot_Organ" ("Id") ON DELETE CASCADE CONSTRAINT "FK_iot_IoTScene_iot_Organ_OrganId" FOREIGN KEY ("OrganId") REFERENCES "iot_Organ" ("Id") ON DELETE RESTRICT
); );
CREATE TABLE "iot_OrganRole" ( CREATE TABLE "iot_OrganRole" (

@ -27,8 +27,8 @@ namespace Platform.Apis.Controllers
try try
{ {
var model = this._sceneRepo.ReadOnlyTable() var model = this._sceneRepo.ReadOnlyTable()
.Include(o => o.Organ) .Include(o => o.Building).ThenInclude(o=>o.Organ)
.WhereIf(organId.HasValue, o => o.OrganId == organId.Value) .WhereIf(organId.HasValue, o => o.Building.OrganId == organId.Value)
.Where(o => !o.Hidden) .Where(o => !o.Hidden)
.OrderBy(o => o.DisplayOrder); .OrderBy(o => o.DisplayOrder);
return Ok(model); return Ok(model);

@ -16,6 +16,7 @@ namespace Platform.Application.Models
[Display(Name = "建筑")] [Display(Name = "建筑")]
[SelectList] [SelectList]
[ReadOnlyForEdit] [ReadOnlyForEdit]
[Required(ErrorMessage = nameof(RequiredAttribute))]
public Guid? BuildingId { get; set; } public Guid? BuildingId { get; set; }
[Display(Name = "场景名称")] [Display(Name = "场景名称")]

@ -36,14 +36,14 @@ namespace Platform.Areas.IoTCenter.Controllers
public override IQueryable<IoTScene> Include(IQueryable<IoTScene> query) public override IQueryable<IoTScene> Include(IQueryable<IoTScene> query)
{ {
return query.Include(o => o.Organ).Include(o => o.Building); return query.Include(o => o.Building).ThenInclude(o => o.Organ);
} }
public override IQueryable<IoTScene> Query(PagedListModel<EditIoTSceneModel> model, IQueryable<IoTScene> query) public override IQueryable<IoTScene> Query(PagedListModel<EditIoTSceneModel> model, IQueryable<IoTScene> query)
{ {
ViewData.SelectList(o => model.Query.OrganId, () => this._ajax.GetOrgan(model.Query.OrganId).SelectList()); ViewData.SelectList(o => model.Query.OrganId, () => this._ajax.GetOrgan(model.Query.OrganId).SelectList());
return query return query
.WhereIf(model.Query.OrganId.HasValue, o => o.OrganId == model.Query.OrganId.Value) .WhereIf(model.Query.OrganId.HasValue, o => o.Building.OrganId == model.Query.OrganId.Value)
.WhereIf(model.Query.BuildingId.HasValue, o => o.BuildingId == model.Query.BuildingId.Value) .WhereIf(model.Query.BuildingId.HasValue, o => o.BuildingId == model.Query.BuildingId.Value)
.WhereIf(!string.IsNullOrEmpty(model.Query.Name), o => o.Name.Contains(model.Query.Name)) .WhereIf(!string.IsNullOrEmpty(model.Query.Name), o => o.Name.Contains(model.Query.Name))
.WhereIf(model.Query.Hidden.HasValue, o => o.Hidden == model.Query.Hidden.Value) .WhereIf(model.Query.Hidden.HasValue, o => o.Hidden == model.Query.Hidden.Value)
@ -52,6 +52,10 @@ namespace Platform.Areas.IoTCenter.Controllers
public override void ToDisplayModel(IoTScene entity, EditIoTSceneModel model) public override void ToDisplayModel(IoTScene entity, EditIoTSceneModel model)
{ {
if(entity!=null)
{
model.OrganId = entity.Building.OrganId;
}
if (model.BuildingId.HasValue) if (model.BuildingId.HasValue)
{ {
var name = this._buildingRepo.ReadOnlyTable() var name = this._buildingRepo.ReadOnlyTable()
@ -66,16 +70,20 @@ namespace Platform.Areas.IoTCenter.Controllers
{ {
var name = this._organRepo.ReadOnlyTable() var name = this._organRepo.ReadOnlyTable()
.Where(o => o.ParentId != null) .Where(o => o.ParentId != null)
.Where(o => o.Left <= entity.Organ.Left && o.Right >= entity.Organ.Right) .Where(o => o.Left <= entity.Building.Organ.Left && o.Right >= entity.Building.Organ.Right)
.ToList() .ToList()
.ToTree() .ToTree()
.FirstOrDefault(o => o.Id == entity.OrganId)?.GetDisplayName(); .FirstOrDefault(o => o.Id == entity.Building.OrganId)?.GetDisplayName();
ViewData.Add(model.OrganId, name); ViewData.Add(model.OrganId, name);
} }
} }
public override void ToEditModel(IoTScene entity, EditIoTSceneModel model) public override void ToEditModel(IoTScene entity, EditIoTSceneModel model)
{ {
if (entity != null)
{
model.OrganId = entity.Building.OrganId;
}
ViewData.SelectList(o => model.OrganId, () => this._ajax.GetOrgan(model.OrganId).SelectList()); ViewData.SelectList(o => model.OrganId, () => this._ajax.GetOrgan(model.OrganId).SelectList());
ViewData.SelectList(o => model.BuildingId, () => this._ajax.GetBuilding(model.OrganId.Value, model.BuildingId).SelectList(), model.OrganId.HasValue); ViewData.SelectList(o => model.BuildingId, () => this._ajax.GetBuilding(model.OrganId.Value, model.BuildingId).SelectList(), model.OrganId.HasValue);
} }

@ -30,7 +30,7 @@ namespace Platform.Areas.IoTCenter.Controllers
public override IQueryable<IoTSceneIoTCommand> Include(IQueryable<IoTSceneIoTCommand> query) public override IQueryable<IoTSceneIoTCommand> Include(IQueryable<IoTSceneIoTCommand> query)
{ {
return query return query
.Include(o => o.IoTScene).ThenInclude(o => o.Organ) .Include(o => o.IoTScene).ThenInclude(o=>o.Building).ThenInclude(o => o.Organ)
.Include(o => o.IoTCommand).ThenInclude(o => o.Device).ThenInclude(o => o.IoTGateway); .Include(o => o.IoTCommand).ThenInclude(o => o.Device).ThenInclude(o => o.IoTGateway);
} }
@ -53,9 +53,9 @@ namespace Platform.Areas.IoTCenter.Controllers
public override void ToDisplayModel(IoTSceneIoTCommand entity, EditIoTSceneIoTCommandModel model) public override void ToDisplayModel(IoTSceneIoTCommand entity, EditIoTSceneIoTCommandModel model)
{ {
model.OrganId = entity?.IoTScene.OrganId; model.OrganId = entity?.IoTScene?.Building?.OrganId;
model.IoTGatewayId = entity?.IoTCommand.Device.IoTGatewayId; model.IoTGatewayId = entity?.IoTCommand.Device.IoTGatewayId;
ViewData.Add(model.OrganId, entity?.IoTScene?.Organ?.Name); ViewData.Add(model.OrganId, entity?.IoTScene?.Building?.Organ?.Name);
ViewData.Add(model.IoTSceneId, entity?.IoTScene?.Name); ViewData.Add(model.IoTSceneId, entity?.IoTScene?.Name);
ViewData.Add(model.IoTGatewayId, entity?.IoTCommand?.Device?.IoTGateway?.Name); ViewData.Add(model.IoTGatewayId, entity?.IoTCommand?.Device?.IoTGateway?.Name);
ViewData.Add(model.CommandId, entity?.IoTCommand?.Name); ViewData.Add(model.CommandId, entity?.IoTCommand?.Name);

@ -40,7 +40,7 @@ namespace Platform.Areas.IoTCenter.Controllers
public override IQueryable<IoTTigger> Query(PagedListModel<EditIoTTiggerModel> model, IQueryable<IoTTigger> query) public override IQueryable<IoTTigger> Query(PagedListModel<EditIoTTiggerModel> model, IQueryable<IoTTigger> query)
{ {
return query return query
.WhereIf(model.Query.OrganId.HasValue, o => o.IoTScene.OrganId == model.Query.OrganId.Value) .WhereIf(model.Query.OrganId.HasValue, o => o.IoTScene.Building.OrganId == model.Query.OrganId.Value)
.WhereIf(model.Query.IoTGatewayId.HasValue, o => o.Data.Device.IoTGatewayId == model.Query.IoTGatewayId.Value) .WhereIf(model.Query.IoTGatewayId.HasValue, o => o.Data.Device.IoTGatewayId == model.Query.IoTGatewayId.Value)
.WhereIf(model.Query.OrganSceneId.HasValue, o => o.IoTSceneId == model.Query.OrganSceneId.Value) .WhereIf(model.Query.OrganSceneId.HasValue, o => o.IoTSceneId == model.Query.OrganSceneId.Value)
.WhereIf(model.Query.DeviceId.HasValue, o => o.Data.DeviceId == model.Query.DeviceId.Value) .WhereIf(model.Query.DeviceId.HasValue, o => o.Data.DeviceId == model.Query.DeviceId.Value)
@ -57,13 +57,13 @@ namespace Platform.Areas.IoTCenter.Controllers
ViewData.SelectList(o => model.OrganId, () => this._ajax.GetOrgan(model.OrganId).SelectList()); ViewData.SelectList(o => model.OrganId, () => this._ajax.GetOrgan(model.OrganId).SelectList());
ViewData.SelectList(o => model.IoTGatewayId, () => this._ajax.GetIoTGateway(model.IoTGatewayId).SelectList(), model.OrganId.HasValue); ViewData.SelectList(o => model.IoTGatewayId, () => this._ajax.GetIoTGateway(model.IoTGatewayId).SelectList(), model.OrganId.HasValue);
ViewData.SelectList(o => model.OrganSceneId, () => this._ajax.GetOrganSceneSelectList(model.OrganId.Value, model.OrganSceneId), model.OrganId.HasValue); ViewData.SelectList(o => model.OrganSceneId, () => this._ajax.GetOrganSceneSelectList(model.OrganId.Value, model.OrganSceneId), model.OrganId.HasValue);
ViewData.SelectList(o => model.DeviceId, () => this._ajax.GetIoTDevice(model.IoTGatewayId.Value, model.DeviceId).SelectList()); ViewData.SelectList(o => model.DeviceId, () => this._ajax.GetIoTDevice(model.IoTGatewayId.Value, model.DeviceId).SelectList(), model.IoTGatewayId.HasValue);
ViewData.SelectList(o => model.DataId, () => this._ajax.GetDataSelectList(model.DeviceId.Value), model.DeviceId.HasValue); ViewData.SelectList(o => model.DataId, () => this._ajax.GetDataSelectList(model.DeviceId.Value), model.DeviceId.HasValue);
} }
public override void ToDisplayModel(IoTTigger entity, EditIoTTiggerModel model) public override void ToDisplayModel(IoTTigger entity, EditIoTTiggerModel model)
{ {
model.OrganId = entity?.IoTScene?.OrganId; model.OrganId = entity?.IoTScene?.Building?.OrganId;
model.DeviceId = entity?.Data?.DeviceId; model.DeviceId = entity?.Data?.DeviceId;
model.IoTGatewayId = entity?.Data?.Device?.IoTGatewayId; model.IoTGatewayId = entity?.Data?.Device?.IoTGatewayId;
ViewData.Add(model.IoTGatewayId, entity?.Data?.Device?.IoTGateway?.Name); ViewData.Add(model.IoTGatewayId, entity?.Data?.Device?.IoTGateway?.Name);

@ -33,7 +33,7 @@ namespace Platform.Areas.IoTCenter.Controllers
public override IQueryable<IoTTimer> Query(PagedListModel<EditIoTTimerModel> model, IQueryable<IoTTimer> query) public override IQueryable<IoTTimer> Query(PagedListModel<EditIoTTimerModel> model, IQueryable<IoTTimer> query)
{ {
return query return query
.WhereIf(model.Query.OrganId.HasValue, o => o.IoTScene.OrganId == model.Query.OrganId.Value) .WhereIf(model.Query.OrganId.HasValue, o => o.IoTScene.Building.OrganId == model.Query.OrganId.Value)
.WhereIf(model.Query.OrganSceneId.HasValue, o => o.IoTSceneId == model.Query.OrganSceneId.Value) .WhereIf(model.Query.OrganSceneId.HasValue, o => o.IoTSceneId == model.Query.OrganSceneId.Value)
.WhereIf(!string.IsNullOrEmpty(model.Query.Name), o => o.Name.Contains(model.Query.Name)) .WhereIf(!string.IsNullOrEmpty(model.Query.Name), o => o.Name.Contains(model.Query.Name))
.WhereIf(model.Query.Disabled.HasValue, o => o.Disabled == model.Query.Disabled.Value); .WhereIf(model.Query.Disabled.HasValue, o => o.Disabled == model.Query.Disabled.Value);
@ -41,7 +41,7 @@ namespace Platform.Areas.IoTCenter.Controllers
public override IQueryable<IoTTimer> Include(IQueryable<IoTTimer> query) public override IQueryable<IoTTimer> Include(IQueryable<IoTTimer> query)
{ {
return query.Include(o => o.IoTScene).ThenInclude(o => o.Organ); return query.Include(o => o.IoTScene).ThenInclude(o=>o.Building).ThenInclude(o => o.Organ);
} }
public override void ToEditModel(IoTTimer entity, EditIoTTimerModel model) public override void ToEditModel(IoTTimer entity, EditIoTTimerModel model)
@ -53,8 +53,8 @@ namespace Platform.Areas.IoTCenter.Controllers
public override void ToDisplayModel(IoTTimer entity, EditIoTTimerModel model) public override void ToDisplayModel(IoTTimer entity, EditIoTTimerModel model)
{ {
model.OrganId = entity?.IoTScene.OrganId; model.OrganId = entity?.IoTScene?.Building.OrganId;
ViewData.Add(model.OrganId, entity?.IoTScene?.Organ?.Name); ViewData.Add(model.OrganId, entity?.IoTScene?.Building?.Organ?.Name);
ViewData.Add(model.OrganSceneId, entity?.IoTScene?.Name); ViewData.Add(model.OrganSceneId, entity?.IoTScene?.Name);
} }
} }

@ -203,7 +203,17 @@ namespace Platform.Areas.IoTCenter.Controllers
} }
return new JsonResult(new SelectList(list, "Id", "Name", selected)); return new JsonResult(new SelectList(list, "Id", "Name", selected));
} }
public SelectList GetCameraSelectList(string deviceNumber)
{
using var scope = this._services.CreateScope();
var repo = scope.ServiceProvider.GetRequiredService<IRepository<IoTDevice>>();
var list = repo.ReadOnlyTable()
.Where(o => o.Product.Number == "onvifcamera")
.WhereIf(!string.IsNullOrEmpty(deviceNumber), o => o.Number == deviceNumber)
.Select(o => new { Id = o.Number, Name = o.DisplayName })
.ToList();
return new SelectList(list, "Id", "Name", deviceNumber);
}
public SelectList GetOrganNodeSelectList(Guid parentId, Guid? selected = null) public SelectList GetOrganNodeSelectList(Guid parentId, Guid? selected = null)
{ {
using var scope = this._services.CreateScope(); using var scope = this._services.CreateScope();
@ -221,7 +231,7 @@ namespace Platform.Areas.IoTCenter.Controllers
using var scope = this._services.CreateScope(); using var scope = this._services.CreateScope();
var repo = scope.ServiceProvider.GetRequiredService<IRepository<IoTScene>>(); var repo = scope.ServiceProvider.GetRequiredService<IRepository<IoTScene>>();
var list = repo.ReadOnlyTable() var list = repo.ReadOnlyTable()
.Where(o => o.OrganId == parentId) .Where(o => o.Building.OrganId == parentId)
.Select(o => new { o.Id, o.Name }) .Select(o => new { o.Id, o.Name })
.ToList(); .ToList();
return new SelectList(list, "Id", "Name", selected); return new SelectList(list, "Id", "Name", selected);

@ -74,11 +74,11 @@ namespace Platform.Controllers
{//即未选中建筑也未选中机构,则用户所在机构为当前机构 {//即未选中建筑也未选中机构,则用户所在机构为当前机构
model.Organ = organList.FirstOrDefault(o => o.Id == userOrganId); model.Organ = organList.FirstOrDefault(o => o.Id == userOrganId);
} }
model.Scenes = this._organRepo.ReadOnlyTable() model.Scenes = this._buildingRepo.ReadOnlyTable()
.Where(o => o.Id == model.Organ.Id) .Where(o => o.OrganId == model.Organ.Id)
.SelectMany(o => o.OrganScenes) .SelectMany(o=>o.Scenes)
.Where(o => o.Hidden == false) .Where(o => o.Hidden == false)
.Where(o => o.BuildingId == null) .WhereIf(model.BuildingId.HasValue,o => o.BuildingId == model.BuildingId.Value)
.ToList(); .ToList();
} }
model.OrganId = model.Organ.Id; model.OrganId = model.Organ.Id;

@ -92,15 +92,14 @@ namespace Platform.Data
//modelBuilder.Entity<IoTProductCategoryIoTProduct>().HasIndex(o => o.ProductId).IsUnique();//通过唯一约束,保证一个商品只有一个分类 //modelBuilder.Entity<IoTProductCategoryIoTProduct>().HasIndex(o => o.ProductId).IsUnique();//通过唯一约束,保证一个商品只有一个分类
//IoTCommand //IoTCommand
modelBuilder.Entity<IoTCommand>().HasOne(o => o.Api).WithMany().HasForeignKey(o => o.ApiId); modelBuilder.Entity<IoTCommand>().HasOne(o => o.Api).WithMany().HasForeignKey(o => o.ApiId);
//OrganIoTScene //IoTScene
modelBuilder.Entity<IoTScene>().HasOne(o => o.Organ).WithMany(o => o.OrganScenes).HasForeignKey(o => o.OrganId); modelBuilder.Entity<IoTScene>().HasOne(o => o.Building).WithMany(o => o.Scenes).HasForeignKey(o => o.BuildingId);
modelBuilder.Entity<IoTScene>().HasOne(o => o.Building).WithMany(o => o.Scenes).HasForeignKey(o => o.BuildingId).OnDelete(DeleteBehavior.Cascade); //IoTSceneIoTCommand
//OrganIoTSceneIoTCommand
modelBuilder.Entity<IoTSceneIoTCommand>().HasOne(o => o.IoTScene).WithMany(o => o.IoTCommands).HasForeignKey(o => o.IoTSceneId); modelBuilder.Entity<IoTSceneIoTCommand>().HasOne(o => o.IoTScene).WithMany(o => o.IoTCommands).HasForeignKey(o => o.IoTSceneId);
modelBuilder.Entity<IoTSceneIoTCommand>().HasOne(o => o.IoTCommand).WithMany().HasForeignKey(o => o.IoTCommandId); modelBuilder.Entity<IoTSceneIoTCommand>().HasOne(o => o.IoTCommand).WithMany().HasForeignKey(o => o.IoTCommandId);
//OrganIoTSceneTimer //IoTTimer
modelBuilder.Entity<IoTTimer>().HasOne(o => o.IoTScene).WithMany(o => o.IoTTimers).HasForeignKey(o => o.IoTSceneId); modelBuilder.Entity<IoTTimer>().HasOne(o => o.IoTScene).WithMany(o => o.IoTTimers).HasForeignKey(o => o.IoTSceneId);
//OrganIoTSceneTigger //IoTTigger
modelBuilder.Entity<IoTTigger>().HasOne(o => o.IoTScene).WithMany(o => o.IoTTiggers).HasForeignKey(o => o.IoTSceneId); modelBuilder.Entity<IoTTigger>().HasOne(o => o.IoTScene).WithMany(o => o.IoTTiggers).HasForeignKey(o => o.IoTSceneId);
modelBuilder.Entity<IoTTigger>().HasOne(o => o.Data).WithMany().HasForeignKey(o => o.DataId); modelBuilder.Entity<IoTTigger>().HasOne(o => o.Data).WithMany().HasForeignKey(o => o.DataId);
//LiveRecord //LiveRecord

@ -243,11 +243,9 @@ CREATE TABLE `iot_IoTScene` (
`Image` longtext CHARACTER SET utf8mb4 NOT NULL, `Image` longtext CHARACTER SET utf8mb4 NOT NULL,
`Hidden` tinyint(1) NOT NULL, `Hidden` tinyint(1) NOT NULL,
`DisplayOrder` int NOT NULL, `DisplayOrder` int NOT NULL,
`OrganId` char(36) NOT NULL, `BuildingId` char(36) NOT NULL,
`BuildingId` char(36) NULL,
CONSTRAINT `PK_iot_IoTScene` PRIMARY KEY (`Id`), CONSTRAINT `PK_iot_IoTScene` PRIMARY KEY (`Id`),
CONSTRAINT `FK_iot_IoTScene_iot_Building_BuildingId` FOREIGN KEY (`BuildingId`) REFERENCES `iot_Building` (`Id`) ON DELETE CASCADE, CONSTRAINT `FK_iot_IoTScene_iot_Building_BuildingId` FOREIGN KEY (`BuildingId`) REFERENCES `iot_Building` (`Id`) ON DELETE CASCADE
CONSTRAINT `FK_iot_IoTScene_iot_Organ_OrganId` FOREIGN KEY (`OrganId`) REFERENCES `iot_Organ` (`Id`) ON DELETE CASCADE
); );
CREATE TABLE `iot_OrganUserRole` ( CREATE TABLE `iot_OrganUserRole` (
@ -470,8 +468,6 @@ CREATE INDEX `IX_iot_IoTProductCategory_ParentId` ON `iot_IoTProductCategory` (`
CREATE INDEX `IX_iot_IoTScene_BuildingId` ON `iot_IoTScene` (`BuildingId`); CREATE INDEX `IX_iot_IoTScene_BuildingId` ON `iot_IoTScene` (`BuildingId`);
CREATE INDEX `IX_iot_IoTScene_OrganId` ON `iot_IoTScene` (`OrganId`);
CREATE INDEX `IX_iot_IoTSceneIoTCommand_IoTCommandId` ON `iot_IoTSceneIoTCommand` (`IoTCommandId`); CREATE INDEX `IX_iot_IoTSceneIoTCommand_IoTCommandId` ON `iot_IoTSceneIoTCommand` (`IoTCommandId`);
CREATE INDEX `IX_iot_IoTSceneIoTCommand_IoTCommandId1` ON `iot_IoTSceneIoTCommand` (`IoTCommandId1`); CREATE INDEX `IX_iot_IoTSceneIoTCommand_IoTCommandId1` ON `iot_IoTSceneIoTCommand` (`IoTCommandId1`);

Loading…
Cancel
Save