diff --git a/JiShe.ServicePro b/JiShe.ServicePro index 87668cc..bebd419 160000 --- a/JiShe.ServicePro +++ b/JiShe.ServicePro @@ -1 +1 @@ -Subproject commit 87668ccc6f5fea1111470327fa7da683b9756430 +Subproject commit bebd41984adbf6ce1e722ce804b0a6922083e059 diff --git a/src/JiShe.IoT.DbMigrator/appsettings.json b/src/JiShe.IoT.DbMigrator/appsettings.json index 5406a18..f4af9a2 100644 --- a/src/JiShe.IoT.DbMigrator/appsettings.json +++ b/src/JiShe.IoT.DbMigrator/appsettings.json @@ -1,6 +1,6 @@ { "ConnectionStrings": { - "Default": "Data Source=192.168.111.42;Port=13306;Database=JiSheIoTProDB;uid=root;pwd=JiShe!aqG#5kGgh&0;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true;" + "Default": "Data Source=localhost;Port=3306;Database=JiSheIoTProDB;uid=root;pwd=admin123;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true;" }, "IoTDBOptions": { "UserName": "root", diff --git a/src/JiShe.IoT.EntityFrameworkCore/Migrations/20250804031635_InitialCreate.Designer.cs b/src/JiShe.IoT.EntityFrameworkCore/Migrations/20251020061451_InitialCreate.Designer.cs similarity index 95% rename from src/JiShe.IoT.EntityFrameworkCore/Migrations/20250804031635_InitialCreate.Designer.cs rename to src/JiShe.IoT.EntityFrameworkCore/Migrations/20251020061451_InitialCreate.Designer.cs index 1f789aa..f120e98 100644 --- a/src/JiShe.IoT.EntityFrameworkCore/Migrations/20250804031635_InitialCreate.Designer.cs +++ b/src/JiShe.IoT.EntityFrameworkCore/Migrations/20251020061451_InitialCreate.Designer.cs @@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore; namespace JiShe.IoT.Migrations { [DbContext(typeof(IoTDbContext))] - [Migration("20250804031635_InitialCreate")] + [Migration("20251020061451_InitialCreate")] partial class InitialCreate { /// @@ -506,7 +506,9 @@ namespace JiShe.IoT.Migrations .HasColumnType("char(36)"); b.Property("Code") - .HasColumnType("longtext"); + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); b.Property("CreationTime") .HasColumnType("datetime(6)") @@ -520,10 +522,16 @@ namespace JiShe.IoT.Migrations .HasColumnType("char(36)"); b.Property("Description") - .HasColumnType("longtext"); + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); b.Property("DisplayText") - .HasColumnType("longtext"); + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ExtendedAttribute") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); b.Property("IsEnabled") .HasColumnType("tinyint(1)"); @@ -599,7 +607,7 @@ namespace JiShe.IoT.Migrations .HasColumnType("int") .HasComment("设备在线状态"); - b.Property("DeviceSourceTypeEnum") + b.Property("DeviceSourceTypeEnum") .HasColumnType("int") .HasComment("设备来源类型"); @@ -708,6 +716,121 @@ namespace JiShe.IoT.Migrations }); }); + modelBuilder.Entity("JiShe.ServicePro.DeviceManagement.ThingModelInfos.DeviceThingModelInfo", b => + { + b.Property("Id") + .HasColumnType("char(36)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("char(36)") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("longtext") + .HasColumnName("ExtraProperties") + .HasComment("扩展属性,用于存储自定义字段,JSON格式"); + + b.Property("FiledType") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)") + .HasComment("物联网平台中对应产品物模型属性或者事件类型"); + + b.Property("IoTPlatform") + .HasColumnType("int") + .HasComment("物联网平台类型,默认没有指定"); + + b.Property("IoTPlatformProductId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasComment("物联网平台中对应的产品Id"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsValueNeedConvert") + .HasColumnType("tinyint(1)") + .HasComment("是否需要值类型转换"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("OSACreatorId") + .HasColumnType("int") + .HasComment("旧系统授权创建者Id"); + + b.Property("OSADeleterId") + .HasColumnType("int") + .HasComment("旧系统授权最后删除者Id"); + + b.Property("OSALastModifierId") + .HasColumnType("int") + .HasComment("旧系统授权最后修改者Id"); + + b.Property("RawFieldName") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasComment("物联网平台中对应的产品物模型属性或者事件名称"); + + b.Property("Remark") + .HasColumnType("longtext") + .HasComment("备注"); + + b.Property("StandardFieldName") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasComment("管理后台产品标准的物模型属性或者事件名称"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId") + .HasComment("租户ID"); + + b.HasKey("Id"); + + b.HasIndex("CreationTime"); + + b.HasIndex("IoTPlatformProductId"); + + b.HasIndex(new[] { "Id", "IoTPlatformProductId", "RawFieldName", "StandardFieldName", "CreationTime" }, "IX_ServiceProDeviceThingModelInfo_IsNotUniqueKey") + .IsDescending(); + + b.ToTable("ServiceProDeviceThingModelInfo", null, t => + { + t.HasComment("设备物模型信息"); + }); + }); + modelBuilder.Entity("JiShe.ServicePro.DynamicMenuManagement.Menus.Menu", b => { b.Property("Id") @@ -828,6 +951,13 @@ namespace JiShe.IoT.Migrations b.HasKey("Id"); + b.HasIndex("CreationTime"); + + b.HasIndex("Name"); + + b.HasIndex(new[] { "Id", "Name", "Path", "MenuType", "CreationTime" }, "IX_Menus_IsNotUniqueKey") + .IsDescending(); + b.ToTable("ServiceProMenus", null, t => { t.HasComment("动态菜单管理"); diff --git a/src/JiShe.IoT.EntityFrameworkCore/Migrations/20250804031635_InitialCreate.cs b/src/JiShe.IoT.EntityFrameworkCore/Migrations/20251020061451_InitialCreate.cs similarity index 95% rename from src/JiShe.IoT.EntityFrameworkCore/Migrations/20250804031635_InitialCreate.cs rename to src/JiShe.IoT.EntityFrameworkCore/Migrations/20251020061451_InitialCreate.cs index ee929c7..5952f8e 100644 --- a/src/JiShe.IoT.EntityFrameworkCore/Migrations/20250804031635_InitialCreate.cs +++ b/src/JiShe.IoT.EntityFrameworkCore/Migrations/20251020061451_InitialCreate.cs @@ -886,7 +886,7 @@ namespace JiShe.IoT.Migrations DeviceOnlineStatus = table.Column(type: "int", nullable: true, comment: "设备在线状态"), LastOnlineTime = table.Column(type: "datetime(6)", nullable: true, comment: "最后在线时间"), LastOfflineTime = table.Column(type: "datetime(6)", nullable: true, comment: "最后离线时间"), - DeviceSourceTypeEnum = table.Column(type: "int", nullable: true, comment: "设备来源类型"), + DeviceSourceTypeEnum = table.Column(type: "int", nullable: false, comment: "设备来源类型"), ConcurrencyStamp = table.Column(type: "varchar(40)", maxLength: 40, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), CreationTime = table.Column(type: "datetime(6)", nullable: false), @@ -912,6 +912,46 @@ namespace JiShe.IoT.Migrations comment: "设备信息") .Annotation("MySql:CharSet", "utf8mb4"); + migrationBuilder.CreateTable( + name: "ServiceProDeviceThingModelInfo", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + IoTPlatform = table.Column(type: "int", nullable: false, comment: "物联网平台类型,默认没有指定"), + IoTPlatformProductId = table.Column(type: "varchar(50)", maxLength: 50, nullable: false, comment: "物联网平台中对应的产品Id") + .Annotation("MySql:CharSet", "utf8mb4"), + FiledType = table.Column(type: "varchar(128)", maxLength: 128, nullable: false, comment: "物联网平台中对应产品物模型属性或者事件类型") + .Annotation("MySql:CharSet", "utf8mb4"), + RawFieldName = table.Column(type: "varchar(50)", maxLength: 50, nullable: false, comment: "物联网平台中对应的产品物模型属性或者事件名称") + .Annotation("MySql:CharSet", "utf8mb4"), + StandardFieldName = table.Column(type: "varchar(50)", maxLength: 50, nullable: false, comment: "管理后台产品标准的物模型属性或者事件名称") + .Annotation("MySql:CharSet", "utf8mb4"), + IsValueNeedConvert = table.Column(type: "tinyint(1)", nullable: false, comment: "是否需要值类型转换"), + ConcurrencyStamp = table.Column(type: "varchar(40)", maxLength: 40, nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + CreationTime = table.Column(type: "datetime(6)", nullable: false), + CreatorId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), + LastModificationTime = table.Column(type: "datetime(6)", nullable: true), + LastModifierId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), + IsDeleted = table.Column(type: "tinyint(1)", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), + DeletionTime = table.Column(type: "datetime(6)", nullable: true), + TenantId = table.Column(type: "char(36)", nullable: true, comment: "租户ID", collation: "ascii_general_ci"), + Remark = table.Column(type: "longtext", nullable: true, comment: "备注") + .Annotation("MySql:CharSet", "utf8mb4"), + OSACreatorId = table.Column(type: "int", nullable: true, comment: "旧系统授权创建者Id"), + OSALastModifierId = table.Column(type: "int", nullable: true, comment: "旧系统授权最后修改者Id"), + OSADeleterId = table.Column(type: "int", nullable: true, comment: "旧系统授权最后删除者Id"), + ExtraProperties = table.Column(type: "longtext", nullable: true, comment: "扩展属性,用于存储自定义字段,JSON格式") + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_ServiceProDeviceThingModelInfo", x => x.Id); + }, + comment: "设备物模型信息") + .Annotation("MySql:CharSet", "utf8mb4"); + migrationBuilder.CreateTable( name: "ServiceProMenus", columns: table => new @@ -1196,14 +1236,16 @@ namespace JiShe.IoT.Migrations { Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), DataDictionaryId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), - Code = table.Column(type: "longtext", nullable: true) + Code = table.Column(type: "varchar(64)", maxLength: 64, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Order = table.Column(type: "int", nullable: false), - DisplayText = table.Column(type: "longtext", nullable: true) + DisplayText = table.Column(type: "varchar(64)", maxLength: 64, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), - Description = table.Column(type: "longtext", nullable: true) + Description = table.Column(type: "varchar(1024)", maxLength: 1024, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), IsEnabled = table.Column(type: "tinyint(1)", nullable: false), + ExtendedAttribute = table.Column(type: "varchar(64)", maxLength: 64, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), CreationTime = table.Column(type: "datetime(6)", nullable: false), CreatorId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), LastModificationTime = table.Column(type: "datetime(6)", nullable: true), @@ -1734,6 +1776,38 @@ namespace JiShe.IoT.Migrations columns: new[] { "Id", "DeviceName", "DeviceAddress", "IoTPlatformProductId", "CreationTime" }, descending: new bool[0]); + migrationBuilder.CreateIndex( + name: "IX_ServiceProDeviceThingModelInfo_CreationTime", + table: "ServiceProDeviceThingModelInfo", + column: "CreationTime"); + + migrationBuilder.CreateIndex( + name: "IX_ServiceProDeviceThingModelInfo_IoTPlatformProductId", + table: "ServiceProDeviceThingModelInfo", + column: "IoTPlatformProductId"); + + migrationBuilder.CreateIndex( + name: "IX_ServiceProDeviceThingModelInfo_IsNotUniqueKey", + table: "ServiceProDeviceThingModelInfo", + columns: new[] { "Id", "IoTPlatformProductId", "RawFieldName", "StandardFieldName", "CreationTime" }, + descending: new bool[0]); + + migrationBuilder.CreateIndex( + name: "IX_Menus_IsNotUniqueKey", + table: "ServiceProMenus", + columns: new[] { "Id", "Name", "Path", "MenuType", "CreationTime" }, + descending: new bool[0]); + + migrationBuilder.CreateIndex( + name: "IX_ServiceProMenus_CreationTime", + table: "ServiceProMenus", + column: "CreationTime"); + + migrationBuilder.CreateIndex( + name: "IX_ServiceProMenus_Name", + table: "ServiceProMenus", + column: "Name"); + migrationBuilder.CreateIndex( name: "IX_ServiceProOneNETAccountInfo_CreationTime", table: "ServiceProOneNETAccountInfo", @@ -1875,6 +1949,9 @@ namespace JiShe.IoT.Migrations migrationBuilder.DropTable( name: "ServiceProDeviceInfo"); + migrationBuilder.DropTable( + name: "ServiceProDeviceThingModelInfo"); + migrationBuilder.DropTable( name: "ServiceProMenus"); diff --git a/src/JiShe.IoT.EntityFrameworkCore/Migrations/IoTDbContextModelSnapshot.cs b/src/JiShe.IoT.EntityFrameworkCore/Migrations/IoTDbContextModelSnapshot.cs index 5da23cb..0d1d273 100644 --- a/src/JiShe.IoT.EntityFrameworkCore/Migrations/IoTDbContextModelSnapshot.cs +++ b/src/JiShe.IoT.EntityFrameworkCore/Migrations/IoTDbContextModelSnapshot.cs @@ -503,7 +503,9 @@ namespace JiShe.IoT.Migrations .HasColumnType("char(36)"); b.Property("Code") - .HasColumnType("longtext"); + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); b.Property("CreationTime") .HasColumnType("datetime(6)") @@ -517,10 +519,16 @@ namespace JiShe.IoT.Migrations .HasColumnType("char(36)"); b.Property("Description") - .HasColumnType("longtext"); + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); b.Property("DisplayText") - .HasColumnType("longtext"); + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ExtendedAttribute") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); b.Property("IsEnabled") .HasColumnType("tinyint(1)"); @@ -596,7 +604,7 @@ namespace JiShe.IoT.Migrations .HasColumnType("int") .HasComment("设备在线状态"); - b.Property("DeviceSourceTypeEnum") + b.Property("DeviceSourceTypeEnum") .HasColumnType("int") .HasComment("设备来源类型"); @@ -705,6 +713,121 @@ namespace JiShe.IoT.Migrations }); }); + modelBuilder.Entity("JiShe.ServicePro.DeviceManagement.ThingModelInfos.DeviceThingModelInfo", b => + { + b.Property("Id") + .HasColumnType("char(36)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("varchar(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("char(36)") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("char(36)") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnType("longtext") + .HasColumnName("ExtraProperties") + .HasComment("扩展属性,用于存储自定义字段,JSON格式"); + + b.Property("FiledType") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)") + .HasComment("物联网平台中对应产品物模型属性或者事件类型"); + + b.Property("IoTPlatform") + .HasColumnType("int") + .HasComment("物联网平台类型,默认没有指定"); + + b.Property("IoTPlatformProductId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasComment("物联网平台中对应的产品Id"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsValueNeedConvert") + .HasColumnType("tinyint(1)") + .HasComment("是否需要值类型转换"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("char(36)") + .HasColumnName("LastModifierId"); + + b.Property("OSACreatorId") + .HasColumnType("int") + .HasComment("旧系统授权创建者Id"); + + b.Property("OSADeleterId") + .HasColumnType("int") + .HasComment("旧系统授权最后删除者Id"); + + b.Property("OSALastModifierId") + .HasColumnType("int") + .HasComment("旧系统授权最后修改者Id"); + + b.Property("RawFieldName") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasComment("物联网平台中对应的产品物模型属性或者事件名称"); + + b.Property("Remark") + .HasColumnType("longtext") + .HasComment("备注"); + + b.Property("StandardFieldName") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasComment("管理后台产品标准的物模型属性或者事件名称"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId") + .HasComment("租户ID"); + + b.HasKey("Id"); + + b.HasIndex("CreationTime"); + + b.HasIndex("IoTPlatformProductId"); + + b.HasIndex(new[] { "Id", "IoTPlatformProductId", "RawFieldName", "StandardFieldName", "CreationTime" }, "IX_ServiceProDeviceThingModelInfo_IsNotUniqueKey") + .IsDescending(); + + b.ToTable("ServiceProDeviceThingModelInfo", null, t => + { + t.HasComment("设备物模型信息"); + }); + }); + modelBuilder.Entity("JiShe.ServicePro.DynamicMenuManagement.Menus.Menu", b => { b.Property("Id") @@ -825,6 +948,13 @@ namespace JiShe.IoT.Migrations b.HasKey("Id"); + b.HasIndex("CreationTime"); + + b.HasIndex("Name"); + + b.HasIndex(new[] { "Id", "Name", "Path", "MenuType", "CreationTime" }, "IX_Menus_IsNotUniqueKey") + .IsDescending(); + b.ToTable("ServiceProMenus", null, t => { t.HasComment("动态菜单管理");