绑定设备端物模型

This commit is contained in:
ChenYi 2025-12-22 17:15:27 +08:00
parent 2ba44b5d30
commit 9f61d37129
15 changed files with 20 additions and 23414 deletions

View File

@ -1 +1,5 @@
CREATE TABLE IF NOT EXISTS CTWingAepReceiveMessageEntity(time TIMESTAMP TIME, IoTDataType STRING TAG, DeviceType STRING TAG, DeviceAddress STRING TAG, SubDevice STRING TAG, PlatformTenantId STRING FIELD, ProductId STRING FIELD, ServiceId STRING FIELD, IoTPlatformDeviceOpenInfo STRING FIELD, MessageType STRING FIELD, Protocol STRING FIELD, RawMessage STRING FIELD, ReceivedPayload STRING FIELD, ReceivedTimestamps INT64 FIELD, IMSI STRING FIELD, IMEI STRING FIELD ) COMMENT 'CTWingAepReceiveMessageEntity';CREATE TABLE IF NOT EXISTS DeviceTelemetryPacketTaskInfo(time TIMESTAMP TIME, IoTDataType STRING TAG, DeviceType STRING TAG, DeviceAddress STRING TAG, SubDevice STRING TAG, IoTPlatformProductId STRING FIELD, IoTPlatformDeviceOpenInfo STRING FIELD, IoTPlatformProductName STRING FIELD, IoTPlatformAccountId STRING FIELD, AccountPhoneNumber STRING FIELD, TelemetryType INT32 FIELD, IssueRawMessage STRING FIELD, IssuePayload STRING FIELD, ResponseRawMessage STRING FIELD, ResponsePayload STRING FIELD, TelemetrySource INT32 FIELD, IoTPlatform INT32 FIELD, RetryCount INT32 FIELD, LastIssueTime TIMESTAMP FIELD, IssueStatus INT32 FIELD ) COMMENT 'DeviceTelemetryPacketTaskInfo';CREATE TABLE IF NOT EXISTS OneNETReceiveMessageEntity(time TIMESTAMP TIME, IoTDataType STRING TAG, DeviceType STRING TAG, DeviceAddress STRING TAG, SubDevice STRING TAG, ProductId STRING FIELD, IoTPlatformDeviceOpenInfo STRING FIELD, MessageType STRING FIELD, Protocol STRING FIELD, RawMessage STRING FIELD, IsEncrypted BOOLEAN FIELD, PlaintextMessage STRING FIELD, ReceivedPayload STRING FIELD, ReceivedTimestamps INT64 FIELD ) COMMENT 'OneNETReceiveMessageEntity';
CREATE TABLE IF NOT EXISTS CTWingAepReceiveMessageEntity( time TIMESTAMP TIME, IoTDataType STRING TAG, DeviceType STRING TAG, DeviceAddress STRING TAG, SubDevice STRING TAG, PlatformTenantId STRING FIELD, ProductId STRING FIELD, ServiceId STRING FIELD, IoTPlatformDeviceOpenInfo STRING FIELD, MessageType STRING FIELD, Protocol STRING FIELD, RawMessage STRING FIELD, ReceivedPayload STRING FIELD, ReceivedTimestamps INT64 FIELD, IMSI STRING FIELD, IMEI STRING FIELD ) COMMENT 'CTWingAepReceiveMessageEntity';
CREATE TABLE IF NOT EXISTS DeviceTelemetryPacketTaskInfo( time TIMESTAMP TIME, IoTDataType STRING TAG, DeviceType STRING TAG, DeviceAddress STRING TAG, SubDevice STRING TAG, IoTPlatformProductId STRING FIELD, IoTPlatformDeviceOpenInfo STRING FIELD, IoTPlatformProductName STRING FIELD, IoTPlatformAccountId STRING FIELD, AccountPhoneNumber STRING FIELD, IssueRawMessage STRING FIELD, IssuePayload STRING FIELD, ResponseRawMessage STRING FIELD, ResponsePayload STRING FIELD, TelemetrySource INT32 FIELD, IoTPlatform INT32 FIELD, RetryCount INT32 FIELD, LastIssueTime TIMESTAMP FIELD, IssueStatus INT32 FIELD ) COMMENT 'DeviceTelemetryPacketTaskInfo';
CREATE TABLE IF NOT EXISTS OneNETReceiveMessageEntity( time TIMESTAMP TIME, IoTDataType STRING TAG, DeviceType STRING TAG, DeviceAddress STRING TAG, SubDevice STRING TAG, ProductId STRING FIELD, IoTPlatformDeviceOpenInfo STRING FIELD, MessageType STRING FIELD, Protocol STRING FIELD, RawMessage STRING FIELD, IsEncrypted BOOLEAN FIELD, PlaintextMessage STRING FIELD, ReceivedPayload STRING FIELD, ReceivedTimestamps INT64 FIELD ) COMMENT 'OneNETReceiveMessageEntity';

View File

@ -1,42 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace JiShe.IoT.Migrations
{
/// <inheritdoc />
public partial class update20251212 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "IoTPlatformRawFieldExtension",
table: "ServiceProIoTPlatformThingModelInfo",
type: "text",
nullable: false,
comment: "物联网平台中对应产品物模型标识符扩展,用于扩展结构体类型")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<sbyte>(
name: "IsSpecialIdentifier",
table: "ServiceProIoTPlatformThingModelInfo",
type: "tinyint(1)",
nullable: false,
defaultValue: (sbyte)0,
comment: "是否是特殊物模型标识符");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IoTPlatformRawFieldExtension",
table: "ServiceProIoTPlatformThingModelInfo");
migrationBuilder.DropColumn(
name: "IsSpecialIdentifier",
table: "ServiceProIoTPlatformThingModelInfo");
}
}
}

View File

@ -1,50 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace JiShe.IoT.Migrations
{
/// <inheritdoc />
public partial class update20251217 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "IoTPlatformRawFieldExtension",
table: "ServiceProIoTPlatformThingModelInfo",
type: "text",
nullable: true,
comment: "物联网平台中对应产品物模型标识符扩展,用于扩展结构体类型",
oldClrType: typeof(string),
oldType: "text",
oldComment: "物联网平台中对应产品物模型标识符扩展,用于扩展结构体类型")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.UpdateData(
table: "ServiceProIoTPlatformThingModelInfo",
keyColumn: "IoTPlatformRawFieldExtension",
keyValue: null,
column: "IoTPlatformRawFieldExtension",
value: "");
migrationBuilder.AlterColumn<string>(
name: "IoTPlatformRawFieldExtension",
table: "ServiceProIoTPlatformThingModelInfo",
type: "text",
nullable: false,
comment: "物联网平台中对应产品物模型标识符扩展,用于扩展结构体类型",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true,
oldComment: "物联网平台中对应产品物模型标识符扩展,用于扩展结构体类型")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
}
}
}

View File

@ -1,112 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace JiShe.IoT.Migrations
{
/// <inheritdoc />
public partial class udpate202512181004 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "SkipNumber",
table: "ServiceProDeviceThingModelPropertylInfo");
migrationBuilder.DropColumn(
name: "TakeNumber",
table: "ServiceProDeviceThingModelPropertylInfo");
migrationBuilder.DropColumn(
name: "ParsingSequence",
table: "ServiceProDeviceThingModelManagement");
migrationBuilder.AddColumn<int>(
name: "NativeSkipNumber",
table: "ServiceProDeviceThingModelPropertylInfo",
type: "int",
nullable: false,
defaultValue: 0,
comment: "正序跳过数量");
migrationBuilder.AddColumn<int>(
name: "NativeTakeNumber",
table: "ServiceProDeviceThingModelPropertylInfo",
type: "int",
nullable: false,
defaultValue: 0,
comment: "正序获取数量");
migrationBuilder.AddColumn<int>(
name: "ParsingSequence",
table: "ServiceProDeviceThingModelPropertylInfo",
type: "int",
nullable: false,
defaultValue: 0,
comment: "解析顺序1234或者3412(高低反转)");
migrationBuilder.AddColumn<int>(
name: "ReversalSkipNumber",
table: "ServiceProDeviceThingModelPropertylInfo",
type: "int",
nullable: true,
comment: "反转跳过数量");
migrationBuilder.AddColumn<int>(
name: "ReversalTakeNumber",
table: "ServiceProDeviceThingModelPropertylInfo",
type: "int",
nullable: true,
comment: "反转获取数量");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "NativeSkipNumber",
table: "ServiceProDeviceThingModelPropertylInfo");
migrationBuilder.DropColumn(
name: "NativeTakeNumber",
table: "ServiceProDeviceThingModelPropertylInfo");
migrationBuilder.DropColumn(
name: "ParsingSequence",
table: "ServiceProDeviceThingModelPropertylInfo");
migrationBuilder.DropColumn(
name: "ReversalSkipNumber",
table: "ServiceProDeviceThingModelPropertylInfo");
migrationBuilder.DropColumn(
name: "ReversalTakeNumber",
table: "ServiceProDeviceThingModelPropertylInfo");
migrationBuilder.AddColumn<int>(
name: "SkipNumber",
table: "ServiceProDeviceThingModelPropertylInfo",
type: "int",
nullable: false,
defaultValue: 0,
comment: "跳过数量");
migrationBuilder.AddColumn<int>(
name: "TakeNumber",
table: "ServiceProDeviceThingModelPropertylInfo",
type: "int",
nullable: false,
defaultValue: 0,
comment: "获取数量");
migrationBuilder.AddColumn<int>(
name: "ParsingSequence",
table: "ServiceProDeviceThingModelManagement",
type: "int",
nullable: false,
defaultValue: 0,
comment: "解析顺序1234或者3412(高低位反转)");
}
}
}

View File

@ -1,50 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace JiShe.IoT.Migrations
{
/// <inheritdoc />
public partial class udpate202512181626 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "FunctionScript",
table: "ServiceProDeviceThingModelManagement",
type: "text",
nullable: true,
comment: "脚本函数体",
oldClrType: typeof(string),
oldType: "text",
oldComment: "脚本函数体")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.UpdateData(
table: "ServiceProDeviceThingModelManagement",
keyColumn: "FunctionScript",
keyValue: null,
column: "FunctionScript",
value: "");
migrationBuilder.AlterColumn<string>(
name: "FunctionScript",
table: "ServiceProDeviceThingModelManagement",
type: "text",
nullable: false,
comment: "脚本函数体",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true,
oldComment: "脚本函数体")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
}
}
}

View File

@ -1,32 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace JiShe.IoT.Migrations
{
/// <inheritdoc />
public partial class udpate202512191140 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "IoTPlatformThingModelDataId",
table: "ServiceProDeviceThingModelPropertylInfo",
type: "char(36)",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
comment: "系统中平台端物模型数据Id",
collation: "ascii_general_ci");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IoTPlatformThingModelDataId",
table: "ServiceProDeviceThingModelPropertylInfo");
}
}
}

View File

@ -1,67 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace JiShe.IoT.Migrations
{
/// <inheritdoc />
public partial class udpate202512191347 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "IoTPlatformRawFieldDataType",
table: "ServiceProIoTPlatformThingModelInfo",
type: "varchar(64)",
maxLength: 64,
nullable: true,
comment: "物联网平台中对应的产品物模型属性或者事件数据类型")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "IoTPlatformRawFieldDataType",
table: "ServiceProDeviceThingModelPropertylInfo",
type: "varchar(20)",
maxLength: 20,
nullable: true,
comment: "物联网平台中对应的产品物模型属性或者事件数据类型",
oldClrType: typeof(string),
oldType: "varchar(20)",
oldMaxLength: 20,
oldComment: "物联网平台中对应的产品物模型属性或者事件数据类型")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IoTPlatformRawFieldDataType",
table: "ServiceProIoTPlatformThingModelInfo");
migrationBuilder.UpdateData(
table: "ServiceProDeviceThingModelPropertylInfo",
keyColumn: "IoTPlatformRawFieldDataType",
keyValue: null,
column: "IoTPlatformRawFieldDataType",
value: "");
migrationBuilder.AlterColumn<string>(
name: "IoTPlatformRawFieldDataType",
table: "ServiceProDeviceThingModelPropertylInfo",
type: "varchar(20)",
maxLength: 20,
nullable: false,
comment: "物联网平台中对应的产品物模型属性或者事件数据类型",
oldClrType: typeof(string),
oldType: "varchar(20)",
oldMaxLength: 20,
oldNullable: true,
oldComment: "物联网平台中对应的产品物模型属性或者事件数据类型")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
}
}
}

View File

@ -13,8 +13,8 @@ using Volo.Abp.EntityFrameworkCore;
namespace JiShe.IoT.Migrations
{
[DbContext(typeof(IoTDbContext))]
[Migration("20251219054834_udpate202512191347")]
partial class udpate202512191347
[Migration("20251222073841_InitialCreate")]
partial class InitialCreate
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)

View File

@ -984,9 +984,8 @@ namespace JiShe.IoT.Migrations
.Annotation("MySql:CharSet", "utf8mb4"),
ScriptName = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false, comment: "脚本函数名称")
.Annotation("MySql:CharSet", "utf8mb4"),
FunctionScript = table.Column<string>(type: "text", nullable: false, comment: "脚本函数体")
FunctionScript = table.Column<string>(type: "text", nullable: true, comment: "脚本函数体")
.Annotation("MySql:CharSet", "utf8mb4"),
ParsingSequence = table.Column<int>(type: "int", nullable: false, comment: "解析顺序1234或者3412(高低位反转)"),
FunctionAnalysisFlag = table.Column<sbyte>(type: "tinyint(1)", nullable: false, comment: "函数解析标记默认为false 不能解析"),
ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
@ -1022,11 +1021,12 @@ namespace JiShe.IoT.Migrations
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"),
IoTPlatformThingModelDataId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "系统中平台端物模型数据Id", collation: "ascii_general_ci"),
FiledType = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "物联网平台中对应产品物模型属性或者事件类型")
.Annotation("MySql:CharSet", "utf8mb4"),
IoTPlatformRawFieldName = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false, comment: "物联网平台中对应的产品物模型属性或者事件名称")
.Annotation("MySql:CharSet", "utf8mb4"),
IoTPlatformRawFieldDataType = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: false, comment: "物联网平台中对应的产品物模型属性或者事件数据类型")
IoTPlatformRawFieldDataType = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: true, comment: "物联网平台中对应的产品物模型属性或者事件数据类型")
.Annotation("MySql:CharSet", "utf8mb4"),
StandardFieldName = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false, comment: "管理后台产品标准的物模型属性或者事件名称")
.Annotation("MySql:CharSet", "utf8mb4"),
@ -1035,8 +1035,11 @@ namespace JiShe.IoT.Migrations
StandardFieldDisplayName = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false, comment: "管理后台产品标准的物模型属性或者事件名称")
.Annotation("MySql:CharSet", "utf8mb4"),
IsValueNeedConvert = table.Column<sbyte>(type: "tinyint(1)", nullable: false, comment: "是否需要值类型转换"),
SkipNumber = table.Column<int>(type: "int", nullable: false, comment: "跳过数量"),
TakeNumber = table.Column<int>(type: "int", nullable: false, comment: "获取数量"),
NativeSkipNumber = table.Column<int>(type: "int", nullable: false, comment: "正序跳过数量"),
NativeTakeNumber = table.Column<int>(type: "int", nullable: false, comment: "正序获取数量"),
ParsingSequence = table.Column<int>(type: "int", nullable: false, comment: "解析顺序1234或者3412(高低反转)"),
ReversalSkipNumber = table.Column<int>(type: "int", nullable: true, comment: "反转跳过数量"),
ReversalTakeNumber = table.Column<int>(type: "int", nullable: true, 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),
@ -1074,6 +1077,8 @@ namespace JiShe.IoT.Migrations
.Annotation("MySql:CharSet", "utf8mb4"),
IoTPlatformRawFieldName = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false, comment: "物联网平台中对应的产品物模型属性或者事件名称")
.Annotation("MySql:CharSet", "utf8mb4"),
IoTPlatformRawFieldDataType = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: true, comment: "物联网平台中对应的产品物模型属性或者事件数据类型")
.Annotation("MySql:CharSet", "utf8mb4"),
StandardFieldName = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false, comment: "管理后台产品标准的物模型属性或者事件名称")
.Annotation("MySql:CharSet", "utf8mb4"),
StandardFieldValueType = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: false, comment: "标准物模型字段值类型")
@ -1081,6 +1086,9 @@ namespace JiShe.IoT.Migrations
StandardFieldDisplayName = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false, comment: "管理后台产品标准的物模型属性或者事件名称")
.Annotation("MySql:CharSet", "utf8mb4"),
IsValueNeedConvert = table.Column<sbyte>(type: "tinyint(1)", nullable: false, comment: "是否需要值类型转换"),
IsSpecialIdentifier = table.Column<sbyte>(type: "tinyint(1)", nullable: false, comment: "是否是特殊物模型标识符"),
IoTPlatformRawFieldExtension = table.Column<string>(type: "text", nullable: true, comment: "物联网平台中对应产品物模型标识符扩展,用于扩展结构体类型")
.Annotation("MySql:CharSet", "utf8mb4"),
ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),