From 2e66968e863e4de0927b0537d7191d07f4376fe3 Mon Sep 17 00:00:00 2001 From: ChenYi <296215406@outlook.com> Date: Mon, 1 Dec 2025 12:00:51 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8F=9C=E5=8D=95=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../configs/appsettings.Development.json | 2 +- ... 20251201031653_InitialCreate.Designer.cs} | 285 +++++++++++++++++- ...ate.cs => 20251201031653_InitialCreate.cs} | 155 +++++++++- .../Migrations/IoTDbContextModelSnapshot.cs | 283 ++++++++++++++++- 4 files changed, 695 insertions(+), 30 deletions(-) rename src/JiShe.IoT.EntityFrameworkCore/Migrations/{20251029012420_InitialCreate.Designer.cs => 20251201031653_InitialCreate.Designer.cs} (91%) rename src/JiShe.IoT.EntityFrameworkCore/Migrations/{20251029012420_InitialCreate.cs => 20251201031653_InitialCreate.cs} (91%) diff --git a/host/JiShe.IoT.HttpApi.Host/configs/appsettings.Development.json b/host/JiShe.IoT.HttpApi.Host/configs/appsettings.Development.json index 6ff0927..2aedf0c 100644 --- a/host/JiShe.IoT.HttpApi.Host/configs/appsettings.Development.json +++ b/host/JiShe.IoT.HttpApi.Host/configs/appsettings.Development.json @@ -4,7 +4,7 @@ "CorsOrigins": "https://*.IoT.com,http://localhost:4200,http://localhost:3100,http://localhost:80,http://10.10.90.3:4200" }, "ConnectionStrings": { - "Default": "Data Source=192.168.111.174;Port=13306;Database=JiSheIoTProDB;uid=root;pwd=JiShe!aqG#5kGgh&0;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true;TreatTinyAsBoolean=false;SslMode=None;Pooling=true;" + "Default": "Data Source=192.168.111.174;Port=13306;Database=JiSheIoTProDB2;uid=root;pwd=JiShe!aqG#5kGgh&0;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true;TreatTinyAsBoolean=false;SslMode=None;Pooling=true;" }, "Hangfire": { "Redis": { diff --git a/src/JiShe.IoT.EntityFrameworkCore/Migrations/20251029012420_InitialCreate.Designer.cs b/src/JiShe.IoT.EntityFrameworkCore/Migrations/20251201031653_InitialCreate.Designer.cs similarity index 91% rename from src/JiShe.IoT.EntityFrameworkCore/Migrations/20251029012420_InitialCreate.Designer.cs rename to src/JiShe.IoT.EntityFrameworkCore/Migrations/20251201031653_InitialCreate.Designer.cs index 35d075e..92da946 100644 --- a/src/JiShe.IoT.EntityFrameworkCore/Migrations/20251029012420_InitialCreate.Designer.cs +++ b/src/JiShe.IoT.EntityFrameworkCore/Migrations/20251201031653_InitialCreate.Designer.cs @@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore; namespace JiShe.IoT.Migrations { [DbContext(typeof(IoTDbContext))] - [Migration("20251029012420_InitialCreate")] + [Migration("20251201031653_InitialCreate")] partial class InitialCreate { /// @@ -607,10 +607,14 @@ namespace JiShe.IoT.Migrations .HasColumnType("int") .HasComment("设备在线状态"); - b.Property("DeviceSourceTypeEnum") + b.Property("DeviceSource") .HasColumnType("int") .HasComment("设备来源类型"); + b.Property("DeviceType") + .HasColumnType("int") + .HasComment("设备类型,与业务系统无关,主要区分是网关设备、直连设备"); + b.Property("ExtraProperties") .HasColumnType("longtext") .HasColumnName("ExtraProperties") @@ -654,8 +658,8 @@ namespace JiShe.IoT.Migrations .HasDefaultValue(false) .HasColumnName("IsDeleted"); - b.Property("IsPlatformPushSuccess") - .HasColumnType("bit(1)") + b.Property("IsPlatformPushSuccess") + .HasColumnType("tinyint(1)") .HasComment("物联网平台推送是否成功"); b.Property("LastModificationTime") @@ -716,7 +720,266 @@ namespace JiShe.IoT.Migrations }); }); - modelBuilder.Entity("JiShe.ServicePro.DeviceManagement.ThingModelInfos.DeviceThingModelInfo", b => + modelBuilder.Entity("JiShe.ServicePro.DeviceManagement.ThingModelInfos.DeviceThingModelDetailInfo", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .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("DeviceRawFieldName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)") + .HasComment("设备端物模型属性或者事件名称"); + + b.Property("DeviceThingModelId") + .HasColumnType("char(36)") + .HasComment("设备端物模型Id"); + + b.Property("ExtraProperties") + .HasColumnType("longtext") + .HasColumnName("ExtraProperties") + .HasComment("扩展属性,用于存储自定义字段,JSON格式"); + + b.Property("FiledType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasComment("物联网平台中对应产品物模型属性或者事件类型"); + + b.Property("IoTPlatformProductId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasComment("物联网平台中对应的产品Id"); + + b.Property("IoTPlatformRawFieldDataType") + .HasColumnType("longtext"); + + b.Property("IoTPlatformRawFieldName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)") + .HasComment("物联网平台中对应的产品物模型属性或者事件名称"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit(1)") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsValueNeedConvert") + .HasColumnType("tinyint(1)") + .HasComment("是否需要值类型转换"); + + b.Property("IssueCommand") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)") + .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("ParsingSequence") + .HasColumnType("int") + .HasComment("解析顺序,1234或者3412(高低位反转)"); + + b.Property("Remark") + .HasColumnType("longtext") + .HasComment("备注"); + + b.Property("StandardFieldDisplayName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)") + .HasComment("管理后台产品标准的物模型属性或者事件名称"); + + b.Property("StandardFieldName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)") + .HasComment("管理后台产品标准的物模型属性或者事件名称"); + + b.Property("StandardFieldValueType") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .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", "IoTPlatformRawFieldName", "StandardFieldName", "CreationTime" }, "IX_ServiceProIoTPlatformThingModelInfo_IsNotUniqueKey") + .IsDescending(); + + b.ToTable("ServiceProDeviceThingModelDetailInfo", null, t => + { + t.HasComment("设备端物模型详情信息"); + }); + }); + + modelBuilder.Entity("JiShe.ServicePro.DeviceManagement.ThingModelInfos.DeviceThingModelManagement", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .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("DeviceModelName") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasComment("设备端物模型名称"); + + b.Property("ExtraProperties") + .HasColumnType("longtext") + .HasColumnName("ExtraProperties") + .HasComment("扩展属性,用于存储自定义字段,JSON格式"); + + b.Property("FunctionScript") + .IsRequired() + .HasColumnType("text") + .HasComment("脚本函数体"); + + b.Property("IoTPlatform") + .HasColumnType("int") + .HasComment("物联网平台类型,默认没有指定"); + + b.Property("IoTPlatformProductId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasComment("物联网平台中对应的产品Id"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit(1)") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + 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("Remark") + .HasColumnType("longtext") + .HasComment("备注"); + + b.Property("ScriptName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)") + .HasComment("脚本函数名称"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId") + .HasComment("租户ID"); + + b.HasKey("Id"); + + b.HasIndex("CreationTime"); + + b.HasIndex("IoTPlatformProductId"); + + b.HasIndex(new[] { "Id", "DeviceModelName", "IoTPlatformProductId", "CreationTime" }, "IX_ServiceProIoTPlatformThingModelInfo_IsNotUniqueKey") + .IsDescending() + .HasDatabaseName("IX_ServiceProIoTPlatformThingModelInfo_IsNotUniqueKey1"); + + b.ToTable("ServiceProDeviceThingModelManagement", null, t => + { + t.HasComment("设备端物模型管理"); + }); + }); + + modelBuilder.Entity("JiShe.ServicePro.DeviceManagement.ThingModelInfos.IoTPlatformThingModelInfo", b => { b.Property("Id") .HasColumnType("char(36)"); @@ -834,12 +1097,13 @@ namespace JiShe.IoT.Migrations b.HasIndex("IoTPlatformProductId"); - b.HasIndex(new[] { "Id", "IoTPlatformProductId", "IoTPlatformRawFieldName", "StandardFieldName", "CreationTime" }, "IX_ServiceProDeviceThingModelInfo_IsNotUniqueKey") - .IsDescending(); + b.HasIndex(new[] { "Id", "IoTPlatformProductId", "IoTPlatformRawFieldName", "StandardFieldName", "CreationTime" }, "IX_ServiceProIoTPlatformThingModelInfo_IsNotUniqueKey") + .IsDescending() + .HasDatabaseName("IX_ServiceProIoTPlatformThingModelInfo_IsNotUniqueKey2"); - b.ToTable("ServiceProDeviceThingModelInfo", null, t => + b.ToTable("ServiceProIoTPlatformThingModelInfo", null, t => { - t.HasComment("设备物模型信息"); + t.HasComment("平台端物模型信息"); }); }); @@ -1687,6 +1951,9 @@ namespace JiShe.IoT.Migrations .HasColumnName("TenantId") .HasComment("租户ID"); + b.Property("ThingModelInfos") + .HasColumnType("longtext"); + b.HasKey("Id"); b.HasIndex("CreationTime"); diff --git a/src/JiShe.IoT.EntityFrameworkCore/Migrations/20251029012420_InitialCreate.cs b/src/JiShe.IoT.EntityFrameworkCore/Migrations/20251201031653_InitialCreate.cs similarity index 91% rename from src/JiShe.IoT.EntityFrameworkCore/Migrations/20251029012420_InitialCreate.cs rename to src/JiShe.IoT.EntityFrameworkCore/Migrations/20251201031653_InitialCreate.cs index b186089..06b4bd3 100644 --- a/src/JiShe.IoT.EntityFrameworkCore/Migrations/20251029012420_InitialCreate.cs +++ b/src/JiShe.IoT.EntityFrameworkCore/Migrations/20251201031653_InitialCreate.cs @@ -868,6 +868,7 @@ namespace JiShe.IoT.Migrations DeviceAddress = table.Column(type: "varchar(40)", maxLength: 40, nullable: false, comment: "设备地址") .Annotation("MySql:CharSet", "utf8mb4"), IoTPlatform = table.Column(type: "int", nullable: false, comment: "物联网平台类型,默认没有指定"), + DeviceType = table.Column(type: "int", nullable: false, comment: "设备类型,与业务系统无关,主要区分是网关设备、直连设备"), IoTPlatformDeviceOpenInfo = table.Column(type: "varchar(128)", maxLength: 128, nullable: false, comment: "物联网平台中对应的设备Id或者名称") .Annotation("MySql:CharSet", "utf8mb4"), PlatformPassword = table.Column(type: "varchar(128)", maxLength: 128, nullable: false, comment: "物联网平台设备密码") @@ -882,11 +883,11 @@ namespace JiShe.IoT.Migrations .Annotation("MySql:CharSet", "utf8mb4"), IoTPlatformResponse = table.Column(type: "text", nullable: true, comment: "物联网平台返回的响应信息") .Annotation("MySql:CharSet", "utf8mb4"), - IsPlatformPushSuccess = table.Column(type: "bit(1)", nullable: false, comment: "物联网平台推送是否成功"), + IsPlatformPushSuccess = table.Column(type: "tinyint(1)", nullable: false, comment: "物联网平台推送是否成功"), 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: false, comment: "设备来源类型"), + DeviceSource = 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), @@ -913,7 +914,97 @@ namespace JiShe.IoT.Migrations .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( - name: "ServiceProDeviceThingModelInfo", + name: "ServiceProDeviceThingModelDetailInfo", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + DeviceThingModelId = table.Column(type: "char(36)", nullable: false, comment: "设备端物模型Id", collation: "ascii_general_ci"), + IoTPlatformProductId = table.Column(type: "varchar(50)", maxLength: 50, nullable: false, comment: "物联网平台中对应的产品Id") + .Annotation("MySql:CharSet", "utf8mb4"), + FiledType = table.Column(type: "varchar(50)", maxLength: 50, nullable: false, comment: "物联网平台中对应产品物模型属性或者事件类型") + .Annotation("MySql:CharSet", "utf8mb4"), + IoTPlatformRawFieldName = table.Column(type: "varchar(64)", maxLength: 64, nullable: false, comment: "物联网平台中对应的产品物模型属性或者事件名称") + .Annotation("MySql:CharSet", "utf8mb4"), + IoTPlatformRawFieldDataType = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), + StandardFieldName = table.Column(type: "varchar(64)", maxLength: 64, nullable: false, comment: "管理后台产品标准的物模型属性或者事件名称") + .Annotation("MySql:CharSet", "utf8mb4"), + StandardFieldValueType = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, comment: "标准物模型字段值类型") + .Annotation("MySql:CharSet", "utf8mb4"), + StandardFieldDisplayName = table.Column(type: "varchar(64)", maxLength: 64, nullable: false, comment: "管理后台产品标准的物模型属性或者事件名称") + .Annotation("MySql:CharSet", "utf8mb4"), + IsValueNeedConvert = table.Column(type: "tinyint(1)", nullable: false, comment: "是否需要值类型转换"), + DeviceRawFieldName = table.Column(type: "varchar(64)", maxLength: 64, nullable: false, comment: "设备端物模型属性或者事件名称") + .Annotation("MySql:CharSet", "utf8mb4"), + IssueCommand = table.Column(type: "varchar(256)", maxLength: 256, nullable: false, comment: "下发指令") + .Annotation("MySql:CharSet", "utf8mb4"), + ParsingSequence = table.Column(type: "int", nullable: false, comment: "解析顺序,1234或者3412(高低位反转)"), + 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: "bit(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_ServiceProDeviceThingModelDetailInfo", x => x.Id); + }, + comment: "设备端物模型详情信息") + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ServiceProDeviceThingModelManagement", + columns: table => new + { + Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), + DeviceModelName = table.Column(type: "varchar(50)", maxLength: 50, nullable: false, comment: "设备端物模型名称") + .Annotation("MySql:CharSet", "utf8mb4"), + IoTPlatform = table.Column(type: "int", nullable: false, comment: "物联网平台类型,默认没有指定"), + IoTPlatformProductId = table.Column(type: "varchar(50)", maxLength: 50, nullable: false, comment: "物联网平台中对应的产品Id") + .Annotation("MySql:CharSet", "utf8mb4"), + ScriptName = table.Column(type: "varchar(64)", maxLength: 64, nullable: false, comment: "脚本函数名称") + .Annotation("MySql:CharSet", "utf8mb4"), + FunctionScript = table.Column(type: "text", nullable: false, comment: "脚本函数体") + .Annotation("MySql:CharSet", "utf8mb4"), + 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: "bit(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_ServiceProDeviceThingModelManagement", x => x.Id); + }, + comment: "设备端物模型管理") + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "ServiceProIoTPlatformThingModelInfo", columns: table => new { Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), @@ -951,9 +1042,9 @@ namespace JiShe.IoT.Migrations }, constraints: table => { - table.PrimaryKey("PK_ServiceProDeviceThingModelInfo", x => x.Id); + table.PrimaryKey("PK_ServiceProIoTPlatformThingModelInfo", x => x.Id); }, - comment: "设备物模型信息") + comment: "平台端物模型信息") .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( @@ -1085,6 +1176,8 @@ namespace JiShe.IoT.Migrations .Annotation("MySql:CharSet", "utf8mb4"), CommunicationAddressTLS = table.Column(type: "varchar(256)", maxLength: 256, nullable: true, comment: "TLS通讯服务地址") .Annotation("MySql:CharSet", "utf8mb4"), + ThingModelInfos = table.Column(type: "longtext", nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"), ConcurrencyStamp = table.Column(type: "varchar(40)", maxLength: 40, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), CreationTime = table.Column(type: "datetime(6)", nullable: false), @@ -1781,18 +1874,50 @@ namespace JiShe.IoT.Migrations descending: new bool[0]); migrationBuilder.CreateIndex( - name: "IX_ServiceProDeviceThingModelInfo_CreationTime", - table: "ServiceProDeviceThingModelInfo", + name: "IX_ServiceProDeviceThingModelDetailInfo_CreationTime", + table: "ServiceProDeviceThingModelDetailInfo", column: "CreationTime"); migrationBuilder.CreateIndex( - name: "IX_ServiceProDeviceThingModelInfo_IoTPlatformProductId", - table: "ServiceProDeviceThingModelInfo", + name: "IX_ServiceProDeviceThingModelDetailInfo_IoTPlatformProductId", + table: "ServiceProDeviceThingModelDetailInfo", column: "IoTPlatformProductId"); migrationBuilder.CreateIndex( - name: "IX_ServiceProDeviceThingModelInfo_IsNotUniqueKey", - table: "ServiceProDeviceThingModelInfo", + name: "IX_ServiceProIoTPlatformThingModelInfo_IsNotUniqueKey", + table: "ServiceProDeviceThingModelDetailInfo", + columns: new[] { "Id", "IoTPlatformProductId", "IoTPlatformRawFieldName", "StandardFieldName", "CreationTime" }, + descending: new bool[0]); + + migrationBuilder.CreateIndex( + name: "IX_ServiceProDeviceThingModelManagement_CreationTime", + table: "ServiceProDeviceThingModelManagement", + column: "CreationTime"); + + migrationBuilder.CreateIndex( + name: "IX_ServiceProDeviceThingModelManagement_IoTPlatformProductId", + table: "ServiceProDeviceThingModelManagement", + column: "IoTPlatformProductId"); + + migrationBuilder.CreateIndex( + name: "IX_ServiceProIoTPlatformThingModelInfo_IsNotUniqueKey1", + table: "ServiceProDeviceThingModelManagement", + columns: new[] { "Id", "DeviceModelName", "IoTPlatformProductId", "CreationTime" }, + descending: new bool[0]); + + migrationBuilder.CreateIndex( + name: "IX_ServiceProIoTPlatformThingModelInfo_CreationTime", + table: "ServiceProIoTPlatformThingModelInfo", + column: "CreationTime"); + + migrationBuilder.CreateIndex( + name: "IX_ServiceProIoTPlatformThingModelInfo_IoTPlatformProductId", + table: "ServiceProIoTPlatformThingModelInfo", + column: "IoTPlatformProductId"); + + migrationBuilder.CreateIndex( + name: "IX_ServiceProIoTPlatformThingModelInfo_IsNotUniqueKey2", + table: "ServiceProIoTPlatformThingModelInfo", columns: new[] { "Id", "IoTPlatformProductId", "IoTPlatformRawFieldName", "StandardFieldName", "CreationTime" }, descending: new bool[0]); @@ -1954,7 +2079,13 @@ namespace JiShe.IoT.Migrations name: "ServiceProDeviceInfo"); migrationBuilder.DropTable( - name: "ServiceProDeviceThingModelInfo"); + name: "ServiceProDeviceThingModelDetailInfo"); + + migrationBuilder.DropTable( + name: "ServiceProDeviceThingModelManagement"); + + migrationBuilder.DropTable( + name: "ServiceProIoTPlatformThingModelInfo"); migrationBuilder.DropTable( name: "ServiceProMenus"); diff --git a/src/JiShe.IoT.EntityFrameworkCore/Migrations/IoTDbContextModelSnapshot.cs b/src/JiShe.IoT.EntityFrameworkCore/Migrations/IoTDbContextModelSnapshot.cs index 51101b3..621c6bc 100644 --- a/src/JiShe.IoT.EntityFrameworkCore/Migrations/IoTDbContextModelSnapshot.cs +++ b/src/JiShe.IoT.EntityFrameworkCore/Migrations/IoTDbContextModelSnapshot.cs @@ -604,10 +604,14 @@ namespace JiShe.IoT.Migrations .HasColumnType("int") .HasComment("设备在线状态"); - b.Property("DeviceSourceTypeEnum") + b.Property("DeviceSource") .HasColumnType("int") .HasComment("设备来源类型"); + b.Property("DeviceType") + .HasColumnType("int") + .HasComment("设备类型,与业务系统无关,主要区分是网关设备、直连设备"); + b.Property("ExtraProperties") .HasColumnType("longtext") .HasColumnName("ExtraProperties") @@ -651,8 +655,8 @@ namespace JiShe.IoT.Migrations .HasDefaultValue(false) .HasColumnName("IsDeleted"); - b.Property("IsPlatformPushSuccess") - .HasColumnType("bit(1)") + b.Property("IsPlatformPushSuccess") + .HasColumnType("tinyint(1)") .HasComment("物联网平台推送是否成功"); b.Property("LastModificationTime") @@ -713,7 +717,266 @@ namespace JiShe.IoT.Migrations }); }); - modelBuilder.Entity("JiShe.ServicePro.DeviceManagement.ThingModelInfos.DeviceThingModelInfo", b => + modelBuilder.Entity("JiShe.ServicePro.DeviceManagement.ThingModelInfos.DeviceThingModelDetailInfo", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .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("DeviceRawFieldName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)") + .HasComment("设备端物模型属性或者事件名称"); + + b.Property("DeviceThingModelId") + .HasColumnType("char(36)") + .HasComment("设备端物模型Id"); + + b.Property("ExtraProperties") + .HasColumnType("longtext") + .HasColumnName("ExtraProperties") + .HasComment("扩展属性,用于存储自定义字段,JSON格式"); + + b.Property("FiledType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasComment("物联网平台中对应产品物模型属性或者事件类型"); + + b.Property("IoTPlatformProductId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasComment("物联网平台中对应的产品Id"); + + b.Property("IoTPlatformRawFieldDataType") + .HasColumnType("longtext"); + + b.Property("IoTPlatformRawFieldName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)") + .HasComment("物联网平台中对应的产品物模型属性或者事件名称"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit(1)") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsValueNeedConvert") + .HasColumnType("tinyint(1)") + .HasComment("是否需要值类型转换"); + + b.Property("IssueCommand") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)") + .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("ParsingSequence") + .HasColumnType("int") + .HasComment("解析顺序,1234或者3412(高低位反转)"); + + b.Property("Remark") + .HasColumnType("longtext") + .HasComment("备注"); + + b.Property("StandardFieldDisplayName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)") + .HasComment("管理后台产品标准的物模型属性或者事件名称"); + + b.Property("StandardFieldName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)") + .HasComment("管理后台产品标准的物模型属性或者事件名称"); + + b.Property("StandardFieldValueType") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("varchar(20)") + .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", "IoTPlatformRawFieldName", "StandardFieldName", "CreationTime" }, "IX_ServiceProIoTPlatformThingModelInfo_IsNotUniqueKey") + .IsDescending(); + + b.ToTable("ServiceProDeviceThingModelDetailInfo", null, t => + { + t.HasComment("设备端物模型详情信息"); + }); + }); + + modelBuilder.Entity("JiShe.ServicePro.DeviceManagement.ThingModelInfos.DeviceThingModelManagement", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .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("DeviceModelName") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasComment("设备端物模型名称"); + + b.Property("ExtraProperties") + .HasColumnType("longtext") + .HasColumnName("ExtraProperties") + .HasComment("扩展属性,用于存储自定义字段,JSON格式"); + + b.Property("FunctionScript") + .IsRequired() + .HasColumnType("text") + .HasComment("脚本函数体"); + + b.Property("IoTPlatform") + .HasColumnType("int") + .HasComment("物联网平台类型,默认没有指定"); + + b.Property("IoTPlatformProductId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)") + .HasComment("物联网平台中对应的产品Id"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit(1)") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + 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("Remark") + .HasColumnType("longtext") + .HasComment("备注"); + + b.Property("ScriptName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)") + .HasComment("脚本函数名称"); + + b.Property("TenantId") + .HasColumnType("char(36)") + .HasColumnName("TenantId") + .HasComment("租户ID"); + + b.HasKey("Id"); + + b.HasIndex("CreationTime"); + + b.HasIndex("IoTPlatformProductId"); + + b.HasIndex(new[] { "Id", "DeviceModelName", "IoTPlatformProductId", "CreationTime" }, "IX_ServiceProIoTPlatformThingModelInfo_IsNotUniqueKey") + .IsDescending() + .HasDatabaseName("IX_ServiceProIoTPlatformThingModelInfo_IsNotUniqueKey1"); + + b.ToTable("ServiceProDeviceThingModelManagement", null, t => + { + t.HasComment("设备端物模型管理"); + }); + }); + + modelBuilder.Entity("JiShe.ServicePro.DeviceManagement.ThingModelInfos.IoTPlatformThingModelInfo", b => { b.Property("Id") .HasColumnType("char(36)"); @@ -831,12 +1094,13 @@ namespace JiShe.IoT.Migrations b.HasIndex("IoTPlatformProductId"); - b.HasIndex(new[] { "Id", "IoTPlatformProductId", "IoTPlatformRawFieldName", "StandardFieldName", "CreationTime" }, "IX_ServiceProDeviceThingModelInfo_IsNotUniqueKey") - .IsDescending(); + b.HasIndex(new[] { "Id", "IoTPlatformProductId", "IoTPlatformRawFieldName", "StandardFieldName", "CreationTime" }, "IX_ServiceProIoTPlatformThingModelInfo_IsNotUniqueKey") + .IsDescending() + .HasDatabaseName("IX_ServiceProIoTPlatformThingModelInfo_IsNotUniqueKey2"); - b.ToTable("ServiceProDeviceThingModelInfo", null, t => + b.ToTable("ServiceProIoTPlatformThingModelInfo", null, t => { - t.HasComment("设备物模型信息"); + t.HasComment("平台端物模型信息"); }); }); @@ -1684,6 +1948,9 @@ namespace JiShe.IoT.Migrations .HasColumnName("TenantId") .HasComment("租户ID"); + b.Property("ThingModelInfos") + .HasColumnType("longtext"); + b.HasKey("Id"); b.HasIndex("CreationTime");