设备物模型数据接口管理,字典种子数据处理逻辑梳理

This commit is contained in:
ChenYi 2025-10-20 15:34:51 +08:00
parent 0582e91bda
commit 6f51214891
5 changed files with 352 additions and 15 deletions

@ -1 +1 @@
Subproject commit 87668ccc6f5fea1111470327fa7da683b9756430 Subproject commit bebd41984adbf6ce1e722ce804b0a6922083e059

View File

@ -1,6 +1,6 @@
{ {
"ConnectionStrings": { "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": { "IoTDBOptions": {
"UserName": "root", "UserName": "root",

View File

@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore;
namespace JiShe.IoT.Migrations namespace JiShe.IoT.Migrations
{ {
[DbContext(typeof(IoTDbContext))] [DbContext(typeof(IoTDbContext))]
[Migration("20250804031635_InitialCreate")] [Migration("20251020061451_InitialCreate")]
partial class InitialCreate partial class InitialCreate
{ {
/// <inheritdoc /> /// <inheritdoc />
@ -506,7 +506,9 @@ namespace JiShe.IoT.Migrations
.HasColumnType("char(36)"); .HasColumnType("char(36)");
b.Property<string>("Code") b.Property<string>("Code")
.HasColumnType("longtext"); .IsRequired()
.HasMaxLength(64)
.HasColumnType("varchar(64)");
b.Property<DateTime>("CreationTime") b.Property<DateTime>("CreationTime")
.HasColumnType("datetime(6)") .HasColumnType("datetime(6)")
@ -520,10 +522,16 @@ namespace JiShe.IoT.Migrations
.HasColumnType("char(36)"); .HasColumnType("char(36)");
b.Property<string>("Description") b.Property<string>("Description")
.HasColumnType("longtext"); .HasMaxLength(1024)
.HasColumnType("varchar(1024)");
b.Property<string>("DisplayText") b.Property<string>("DisplayText")
.HasColumnType("longtext"); .HasMaxLength(64)
.HasColumnType("varchar(64)");
b.Property<string>("ExtendedAttribute")
.HasMaxLength(64)
.HasColumnType("varchar(64)");
b.Property<bool>("IsEnabled") b.Property<bool>("IsEnabled")
.HasColumnType("tinyint(1)"); .HasColumnType("tinyint(1)");
@ -599,7 +607,7 @@ namespace JiShe.IoT.Migrations
.HasColumnType("int") .HasColumnType("int")
.HasComment("设备在线状态"); .HasComment("设备在线状态");
b.Property<int?>("DeviceSourceTypeEnum") b.Property<int>("DeviceSourceTypeEnum")
.HasColumnType("int") .HasColumnType("int")
.HasComment("设备来源类型"); .HasComment("设备来源类型");
@ -708,6 +716,121 @@ namespace JiShe.IoT.Migrations
}); });
}); });
modelBuilder.Entity("JiShe.ServicePro.DeviceManagement.ThingModelInfos.DeviceThingModelInfo", b =>
{
b.Property<Guid>("Id")
.HasColumnType("char(36)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime(6)")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("char(36)")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("char(36)")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime(6)")
.HasColumnName("DeletionTime");
b.Property<string>("ExtraProperties")
.HasColumnType("longtext")
.HasColumnName("ExtraProperties")
.HasComment("扩展属性,用于存储自定义字段,JSON格式");
b.Property<string>("FiledType")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("varchar(128)")
.HasComment("物联网平台中对应产品物模型属性或者事件类型");
b.Property<int>("IoTPlatform")
.HasColumnType("int")
.HasComment("物联网平台类型,默认没有指定");
b.Property<string>("IoTPlatformProductId")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.HasComment("物联网平台中对应的产品Id");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("tinyint(1)")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<bool>("IsValueNeedConvert")
.HasColumnType("tinyint(1)")
.HasComment("是否需要值类型转换");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime(6)")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("char(36)")
.HasColumnName("LastModifierId");
b.Property<int?>("OSACreatorId")
.HasColumnType("int")
.HasComment("旧系统授权创建者Id");
b.Property<int?>("OSADeleterId")
.HasColumnType("int")
.HasComment("旧系统授权最后删除者Id");
b.Property<int?>("OSALastModifierId")
.HasColumnType("int")
.HasComment("旧系统授权最后修改者Id");
b.Property<string>("RawFieldName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.HasComment("物联网平台中对应的产品物模型属性或者事件名称");
b.Property<string>("Remark")
.HasColumnType("longtext")
.HasComment("备注");
b.Property<string>("StandardFieldName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.HasComment("管理后台产品标准的物模型属性或者事件名称");
b.Property<Guid?>("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 => modelBuilder.Entity("JiShe.ServicePro.DynamicMenuManagement.Menus.Menu", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
@ -828,6 +951,13 @@ namespace JiShe.IoT.Migrations
b.HasKey("Id"); 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 => b.ToTable("ServiceProMenus", null, t =>
{ {
t.HasComment("动态菜单管理"); t.HasComment("动态菜单管理");

View File

@ -886,7 +886,7 @@ namespace JiShe.IoT.Migrations
DeviceOnlineStatus = table.Column<int>(type: "int", nullable: true, comment: "设备在线状态"), DeviceOnlineStatus = table.Column<int>(type: "int", nullable: true, comment: "设备在线状态"),
LastOnlineTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "最后在线时间"), LastOnlineTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "最后在线时间"),
LastOfflineTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "最后离线时间"), LastOfflineTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "最后离线时间"),
DeviceSourceTypeEnum = table.Column<int>(type: "int", nullable: true, comment: "设备来源类型"), DeviceSourceTypeEnum = table.Column<int>(type: "int", nullable: false, comment: "设备来源类型"),
ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false) ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false), CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
@ -912,6 +912,46 @@ namespace JiShe.IoT.Migrations
comment: "设备信息") comment: "设备信息")
.Annotation("MySql:CharSet", "utf8mb4"); .Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "ServiceProDeviceThingModelInfo",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
IoTPlatform = table.Column<int>(type: "int", nullable: false, comment: "物联网平台类型,默认没有指定"),
IoTPlatformProductId = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "物联网平台中对应的产品Id")
.Annotation("MySql:CharSet", "utf8mb4"),
FiledType = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false, comment: "物联网平台中对应产品物模型属性或者事件类型")
.Annotation("MySql:CharSet", "utf8mb4"),
RawFieldName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "物联网平台中对应的产品物模型属性或者事件名称")
.Annotation("MySql:CharSet", "utf8mb4"),
StandardFieldName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "管理后台产品标准的物模型属性或者事件名称")
.Annotation("MySql:CharSet", "utf8mb4"),
IsValueNeedConvert = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "是否需要值类型转换"),
ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
DeletionTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
TenantId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "租户ID", collation: "ascii_general_ci"),
Remark = table.Column<string>(type: "longtext", nullable: true, comment: "备注")
.Annotation("MySql:CharSet", "utf8mb4"),
OSACreatorId = table.Column<int>(type: "int", nullable: true, comment: "旧系统授权创建者Id"),
OSALastModifierId = table.Column<int>(type: "int", nullable: true, comment: "旧系统授权最后修改者Id"),
OSADeleterId = table.Column<int>(type: "int", nullable: true, comment: "旧系统授权最后删除者Id"),
ExtraProperties = table.Column<string>(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( migrationBuilder.CreateTable(
name: "ServiceProMenus", name: "ServiceProMenus",
columns: table => new columns: table => new
@ -1196,14 +1236,16 @@ namespace JiShe.IoT.Migrations
{ {
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
DataDictionaryId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), DataDictionaryId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
Code = table.Column<string>(type: "longtext", nullable: true) Code = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
Order = table.Column<int>(type: "int", nullable: false), Order = table.Column<int>(type: "int", nullable: false),
DisplayText = table.Column<string>(type: "longtext", nullable: true) DisplayText = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
Description = table.Column<string>(type: "longtext", nullable: true) Description = table.Column<string>(type: "varchar(1024)", maxLength: 1024, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"), .Annotation("MySql:CharSet", "utf8mb4"),
IsEnabled = table.Column<bool>(type: "tinyint(1)", nullable: false), IsEnabled = table.Column<bool>(type: "tinyint(1)", nullable: false),
ExtendedAttribute = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false), CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true), LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
@ -1734,6 +1776,38 @@ namespace JiShe.IoT.Migrations
columns: new[] { "Id", "DeviceName", "DeviceAddress", "IoTPlatformProductId", "CreationTime" }, columns: new[] { "Id", "DeviceName", "DeviceAddress", "IoTPlatformProductId", "CreationTime" },
descending: new bool[0]); 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( migrationBuilder.CreateIndex(
name: "IX_ServiceProOneNETAccountInfo_CreationTime", name: "IX_ServiceProOneNETAccountInfo_CreationTime",
table: "ServiceProOneNETAccountInfo", table: "ServiceProOneNETAccountInfo",
@ -1875,6 +1949,9 @@ namespace JiShe.IoT.Migrations
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "ServiceProDeviceInfo"); name: "ServiceProDeviceInfo");
migrationBuilder.DropTable(
name: "ServiceProDeviceThingModelInfo");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "ServiceProMenus"); name: "ServiceProMenus");

View File

@ -503,7 +503,9 @@ namespace JiShe.IoT.Migrations
.HasColumnType("char(36)"); .HasColumnType("char(36)");
b.Property<string>("Code") b.Property<string>("Code")
.HasColumnType("longtext"); .IsRequired()
.HasMaxLength(64)
.HasColumnType("varchar(64)");
b.Property<DateTime>("CreationTime") b.Property<DateTime>("CreationTime")
.HasColumnType("datetime(6)") .HasColumnType("datetime(6)")
@ -517,10 +519,16 @@ namespace JiShe.IoT.Migrations
.HasColumnType("char(36)"); .HasColumnType("char(36)");
b.Property<string>("Description") b.Property<string>("Description")
.HasColumnType("longtext"); .HasMaxLength(1024)
.HasColumnType("varchar(1024)");
b.Property<string>("DisplayText") b.Property<string>("DisplayText")
.HasColumnType("longtext"); .HasMaxLength(64)
.HasColumnType("varchar(64)");
b.Property<string>("ExtendedAttribute")
.HasMaxLength(64)
.HasColumnType("varchar(64)");
b.Property<bool>("IsEnabled") b.Property<bool>("IsEnabled")
.HasColumnType("tinyint(1)"); .HasColumnType("tinyint(1)");
@ -596,7 +604,7 @@ namespace JiShe.IoT.Migrations
.HasColumnType("int") .HasColumnType("int")
.HasComment("设备在线状态"); .HasComment("设备在线状态");
b.Property<int?>("DeviceSourceTypeEnum") b.Property<int>("DeviceSourceTypeEnum")
.HasColumnType("int") .HasColumnType("int")
.HasComment("设备来源类型"); .HasComment("设备来源类型");
@ -705,6 +713,121 @@ namespace JiShe.IoT.Migrations
}); });
}); });
modelBuilder.Entity("JiShe.ServicePro.DeviceManagement.ThingModelInfos.DeviceThingModelInfo", b =>
{
b.Property<Guid>("Id")
.HasColumnType("char(36)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime(6)")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("char(36)")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("char(36)")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime(6)")
.HasColumnName("DeletionTime");
b.Property<string>("ExtraProperties")
.HasColumnType("longtext")
.HasColumnName("ExtraProperties")
.HasComment("扩展属性,用于存储自定义字段,JSON格式");
b.Property<string>("FiledType")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("varchar(128)")
.HasComment("物联网平台中对应产品物模型属性或者事件类型");
b.Property<int>("IoTPlatform")
.HasColumnType("int")
.HasComment("物联网平台类型,默认没有指定");
b.Property<string>("IoTPlatformProductId")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.HasComment("物联网平台中对应的产品Id");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("tinyint(1)")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<bool>("IsValueNeedConvert")
.HasColumnType("tinyint(1)")
.HasComment("是否需要值类型转换");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime(6)")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("char(36)")
.HasColumnName("LastModifierId");
b.Property<int?>("OSACreatorId")
.HasColumnType("int")
.HasComment("旧系统授权创建者Id");
b.Property<int?>("OSADeleterId")
.HasColumnType("int")
.HasComment("旧系统授权最后删除者Id");
b.Property<int?>("OSALastModifierId")
.HasColumnType("int")
.HasComment("旧系统授权最后修改者Id");
b.Property<string>("RawFieldName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.HasComment("物联网平台中对应的产品物模型属性或者事件名称");
b.Property<string>("Remark")
.HasColumnType("longtext")
.HasComment("备注");
b.Property<string>("StandardFieldName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.HasComment("管理后台产品标准的物模型属性或者事件名称");
b.Property<Guid?>("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 => modelBuilder.Entity("JiShe.ServicePro.DynamicMenuManagement.Menus.Menu", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
@ -825,6 +948,13 @@ namespace JiShe.IoT.Migrations
b.HasKey("Id"); 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 => b.ToTable("ServiceProMenus", null, t =>
{ {
t.HasComment("动态菜单管理"); t.HasComment("动态菜单管理");