设备固件信息

This commit is contained in:
ChenYi 2025-12-25 17:22:00 +08:00
parent fc0d6a8ae1
commit 1283b48de7
4 changed files with 4500 additions and 2 deletions

View File

@ -69,11 +69,11 @@ namespace JiShe.IoT.EntityFrameworkCore
// 设备管理 // 设备管理
public DbSet<DeviceManagementInfo> DeviceManagementInfo { get; set; } public DbSet<DeviceManagementInfo> DeviceManagementInfo { get; set; }
public DbSet<DeviceThingModelManagement> DeviceThingModelManagement { get; set; } public DbSet<DeviceThingModelManagement> DeviceThingModelManagement { get; set; }
public DbSet<DeviceThingModelPropertyInfo> DeviceThingModelDetailInfo { get; set; } public DbSet<DeviceThingModelPropertyInfo> DeviceThingModelDetailInfo { get; set; }
public DbSet<DeviceThingModelCommandInfo> DeviceThingModelCommandInfo { get; set; } public DbSet<DeviceThingModelCommandInfo> DeviceThingModelCommandInfo { get; set; }
public DbSet<DeviceFirmwareInfo> DeviceFirmwareInfo { get; set; }
public DbSet<DeviceUpgradeRecord> DeviceUpgradeRecord { get; set; }
/// <summary> /// <summary>
/// 平台端物模型信息 /// 平台端物模型信息

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,160 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace JiShe.IoT.Migrations
{
/// <inheritdoc />
public partial class DeviceFirmwareInfo : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "FirmwareVersion",
table: "ServiceProDeviceInfo",
type: "longtext",
nullable: true)
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<DateTime>(
name: "UpgradeDate",
table: "ServiceProDeviceInfo",
type: "datetime(6)",
nullable: true);
migrationBuilder.CreateTable(
name: "ServiceProDeviceFirmwareInfo",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
ProductDataId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "产品数据Id", 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"),
IoTPlatformProductName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false, comment: "物联网平台中对应的产品名称")
.Annotation("MySql:CharSet", "utf8mb4"),
FirmwareVersion = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "固件版本")
.Annotation("MySql:CharSet", "utf8mb4"),
FirmwareStorageAddress = table.Column<string>(type: "varchar(1024)", maxLength: 1024, nullable: false, comment: "指令设备端物模型的属性名称集合固件地址")
.Annotation("MySql:CharSet", "utf8mb4"),
IsEnable = table.Column<sbyte>(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: "bit(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_ServiceProDeviceFirmwareInfo", x => x.Id);
},
comment: "设备固件信息")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "ServiceProDeviceUpgradeRecord",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
DeviceDataId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "设备数据Id", collation: "ascii_general_ci"),
DeviceName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "设备名称")
.Annotation("MySql:CharSet", "utf8mb4"),
DeviceAddress = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "设备地址")
.Annotation("MySql:CharSet", "utf8mb4"),
OldFirmwareVersion = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "旧的固件版本")
.Annotation("MySql:CharSet", "utf8mb4"),
NowFirmwareVersion = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "当前固件版本")
.Annotation("MySql:CharSet", "utf8mb4"),
UpgradeDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
UpgradeSource = table.Column<int>(type: "int", nullable: false),
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: "bit(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_ServiceProDeviceUpgradeRecord", x => x.Id);
},
comment: "设备升级记录")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_ServiceProDeviceFirmwareInfo_CreationTime",
table: "ServiceProDeviceFirmwareInfo",
column: "CreationTime");
migrationBuilder.CreateIndex(
name: "IX_ServiceProDeviceFirmwareInfo_IoTPlatformProductId",
table: "ServiceProDeviceFirmwareInfo",
column: "IoTPlatformProductId");
migrationBuilder.CreateIndex(
name: "IX_ServiceProDeviceFirmwareInfo_IsNotUniqueKey",
table: "ServiceProDeviceFirmwareInfo",
columns: new[] { "Id", "IoTPlatformProductId", "FirmwareVersion", "CreationTime" },
descending: new bool[0]);
migrationBuilder.CreateIndex(
name: "IX_ServiceProDeviceUpgradeRecord_CreationTime",
table: "ServiceProDeviceUpgradeRecord",
column: "CreationTime");
migrationBuilder.CreateIndex(
name: "IX_ServiceProDeviceUpgradeRecord_DeviceDataId",
table: "ServiceProDeviceUpgradeRecord",
column: "DeviceDataId");
migrationBuilder.CreateIndex(
name: "IX_ServiceProDeviceUpgradeRecord_IsNotUniqueKey",
table: "ServiceProDeviceUpgradeRecord",
columns: new[] { "Id", "DeviceDataId", "NowFirmwareVersion", "CreationTime" },
descending: new bool[0]);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ServiceProDeviceFirmwareInfo");
migrationBuilder.DropTable(
name: "ServiceProDeviceUpgradeRecord");
migrationBuilder.DropColumn(
name: "FirmwareVersion",
table: "ServiceProDeviceInfo");
migrationBuilder.DropColumn(
name: "UpgradeDate",
table: "ServiceProDeviceInfo");
}
}
}

View File

@ -554,6 +554,125 @@ namespace JiShe.IoT.Migrations
}); });
}); });
modelBuilder.Entity("JiShe.ServicePro.DeviceManagement.DeviceInfos.DeviceFirmwareInfo", 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>("FirmwareStorageAddress")
.IsRequired()
.HasMaxLength(1024)
.HasColumnType("varchar(1024)")
.HasComment("指令设备端物模型的属性名称集合固件地址");
b.Property<string>("FirmwareVersion")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.HasComment("固件版本");
b.Property<int>("IoTPlatform")
.HasColumnType("int")
.HasComment("物联网平台类型");
b.Property<string>("IoTPlatformProductId")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.HasComment("物联网平台中对应的产品Id");
b.Property<string>("IoTPlatformProductName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("varchar(256)")
.HasComment("物联网平台中对应的产品名称");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit(1)")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<sbyte>("IsEnable")
.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<Guid>("ProductDataId")
.HasColumnType("char(36)")
.HasComment("产品数据Id");
b.Property<string>("Remark")
.HasColumnType("longtext")
.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", "FirmwareVersion", "CreationTime" }, "IX_ServiceProDeviceFirmwareInfo_IsNotUniqueKey")
.IsDescending();
b.ToTable("ServiceProDeviceFirmwareInfo", null, t =>
{
t.HasComment("设备固件信息");
});
});
modelBuilder.Entity("JiShe.ServicePro.DeviceManagement.DeviceInfos.DeviceManagementInfo", b => modelBuilder.Entity("JiShe.ServicePro.DeviceManagement.DeviceInfos.DeviceManagementInfo", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
@ -621,6 +740,9 @@ namespace JiShe.IoT.Migrations
.HasColumnName("ExtraProperties") .HasColumnName("ExtraProperties")
.HasComment("扩展属性,用于存储自定义字段,JSON格式"); .HasComment("扩展属性,用于存储自定义字段,JSON格式");
b.Property<string>("FirmwareVersion")
.HasColumnType("longtext");
b.Property<int>("IoTPlatform") b.Property<int>("IoTPlatform")
.HasColumnType("int") .HasColumnType("int")
.HasComment("物联网平台类型,默认没有指定"); .HasComment("物联网平台类型,默认没有指定");
@ -710,6 +832,9 @@ namespace JiShe.IoT.Migrations
.HasColumnName("TenantId") .HasColumnName("TenantId")
.HasComment("租户ID"); .HasComment("租户ID");
b.Property<DateTime?>("UpgradeDate")
.HasColumnType("datetime(6)");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("CreationTime"); b.HasIndex("CreationTime");
@ -725,6 +850,123 @@ namespace JiShe.IoT.Migrations
}); });
}); });
modelBuilder.Entity("JiShe.ServicePro.DeviceManagement.DeviceInfos.DeviceUpgradeRecord", 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>("DeviceAddress")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.HasComment("设备地址");
b.Property<Guid>("DeviceDataId")
.HasColumnType("char(36)")
.HasComment("设备数据Id");
b.Property<string>("DeviceName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.HasComment("设备名称");
b.Property<string>("ExtraProperties")
.HasColumnType("longtext")
.HasColumnName("ExtraProperties")
.HasComment("扩展属性,用于存储自定义字段,JSON格式");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit(1)")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime(6)")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("char(36)")
.HasColumnName("LastModifierId");
b.Property<string>("NowFirmwareVersion")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.HasComment("当前固件版本");
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>("OldFirmwareVersion")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.HasComment("旧的固件版本");
b.Property<string>("Remark")
.HasColumnType("longtext")
.HasComment("备注");
b.Property<Guid?>("TenantId")
.HasColumnType("char(36)")
.HasColumnName("TenantId")
.HasComment("租户ID");
b.Property<DateTime>("UpgradeDate")
.HasColumnType("datetime(6)");
b.Property<int>("UpgradeSource")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("CreationTime");
b.HasIndex("DeviceDataId");
b.HasIndex(new[] { "Id", "DeviceDataId", "NowFirmwareVersion", "CreationTime" }, "IX_ServiceProDeviceUpgradeRecord_IsNotUniqueKey")
.IsDescending();
b.ToTable("ServiceProDeviceUpgradeRecord", null, t =>
{
t.HasComment("设备升级记录");
});
});
modelBuilder.Entity("JiShe.ServicePro.DeviceManagement.ThingModelInfos.DeviceThingModelCommandInfo", b => modelBuilder.Entity("JiShe.ServicePro.DeviceManagement.ThingModelInfos.DeviceThingModelCommandInfo", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")