|
|
@@ -0,0 +1,173 @@
|
|
|
+create table iot_device
|
|
|
+(
|
|
|
+ id bigint unsigned auto_increment primary key,
|
|
|
+ tenant_id varchar(128) not null default '' comment '租户id',
|
|
|
+ company_id bigint unsigned not null default 0 comment '所属客户id',
|
|
|
+ guid varchar(255) not null default '' comment '唯一标识[暂时保留]',
|
|
|
+ device_code varchar(255) not null default '' comment '设备编号',
|
|
|
+ sn varchar(255) not null default '' comment 'sn通常是:IMEI',
|
|
|
+ mod_code varchar(255) not null default '' comment '物联网模型码值',
|
|
|
+ device_name varchar(255) not null default '' comment '设备名称[旧系统的title]',
|
|
|
+ brand varchar(255) not null default '' comment '设备品牌名称',
|
|
|
+ model_code varchar(255) not null default '' comment '型号',
|
|
|
+ description varchar(1024) not null default '' comment '最后一次设备更新信息值[旧系统的desc]',
|
|
|
+ remarks varchar(255) charset utf8mb4 not null default '' comment '备注',
|
|
|
+ status tinyint unsigned not null default 1 comment '1在线2离线3异常',
|
|
|
+ longitude varchar(40) not null default '' comment '经度[lng]',
|
|
|
+ latitude varchar(40) not null default '' comment '纬度[lat]',
|
|
|
+ high varchar(40) not null default '' comment '高度',
|
|
|
+ create_time datetime not null default current_timestamp comment '创建时间',
|
|
|
+ update_time datetime not null default current_timestamp on update CURRENT_TIMESTAMP comment '更新时间',
|
|
|
+ create_user varchar(255) not null default '' comment '创建人',
|
|
|
+ update_user varchar(255) not null default '' comment '更新人',
|
|
|
+ del_flag tinyint not null default 0 comment '0-未删除,1-删除',
|
|
|
+ eg_id bigint not null default -1 comment '设备类别',
|
|
|
+ constraint guid unique (guid)
|
|
|
+) comment '设备表';
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+create table iot_device_group
|
|
|
+(
|
|
|
+ id bigint unsigned auto_increment primary key,
|
|
|
+ device_group_code varchar(255) not null default '' comment '设备分组码值',
|
|
|
+ tenant_id varchar(255) not null default '' comment '租户id',
|
|
|
+ company_id bigint not null default 0 comment '所属客户id',
|
|
|
+ title varchar(255) not null default '' comment '设备分组名称',
|
|
|
+ large_type tinyint unsigned not null default 0 comment '[有点晕?]1-12(车辆、装载机、矿卡、人员、水表、电表、边坡监控、视频监控、皮带称重、环境监测、无人地磅、排放监测)',
|
|
|
+ del_flag tinyint not null default 0 comment '0-未删除,1-删除',
|
|
|
+ create_time datetime not null default CURRENT_TIMESTAMP comment '创建时间',
|
|
|
+ update_time datetime not null default current_timestamp on update CURRENT_TIMESTAMP comment '更新时间',
|
|
|
+ create_user varchar(255) not null default '' comment '创建人',
|
|
|
+ update_user varchar(255) not null default '' comment '更新人'
|
|
|
+) comment '设备分组表';
|
|
|
+
|
|
|
+
|
|
|
+create table iot_mod_group
|
|
|
+(
|
|
|
+ id bigint unsigned auto_increment primary key,
|
|
|
+ company_id bigint unsigned not null default 0 comment '所属客户id',
|
|
|
+ tenant_id varchar(255) not null default '' comment '租户id',
|
|
|
+ mode_group_code varchar(255) not null default '' comment '物理模型分组码值唯一标识',
|
|
|
+ name varchar(255) not null default '' comment '物模型分组名称',
|
|
|
+ create_time datetime not null default CURRENT_TIMESTAMP comment '创建时间',
|
|
|
+ update_time datetime not null default current_timestamp on update CURRENT_TIMESTAMP,
|
|
|
+ del_flag tinyint not null default 0 comment '0-未删除,1-删除',
|
|
|
+ create_user varchar(255) not null default '' comment '创建人',
|
|
|
+ update_user varchar(255) not null default '' comment '修改人',
|
|
|
+ constraint name unique (mode_group_code)
|
|
|
+) comment '物理模型分组表';
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+create table iot_mod
|
|
|
+(
|
|
|
+ id bigint unsigned auto_increment primary key,
|
|
|
+ tenant_id varchar(255) not null default '' comment '租户id',
|
|
|
+ mod_code varchar(255) not null default '' comment '物理模型码值',
|
|
|
+ company_id bigint unsigned not null default 0 comment '所属客户id',
|
|
|
+ mode_group_code varchar(255) not null default '' comment '物模型分组码值',
|
|
|
+ guid varchar(255) collate utf8mb4_general_ci not null default '' comment '唯一标识',
|
|
|
+ name varchar(255) not null default '' comment '物模型名称',
|
|
|
+ description varchar(255) not null default '' comment '最后一次更新值[原来字段 desc]',
|
|
|
+ remarks varchar(255) not null default '' comment '备注',
|
|
|
+ tsl_json text null comment '包含JSON',
|
|
|
+ version int unsigned not null default 1 comment '版本[原来字段 tsl_ver]',
|
|
|
+ num int unsigned not null default 0 comment '设备数',
|
|
|
+ del_flag tinyint not null default 0 comment '0-未删除,1-删除',
|
|
|
+ create_user varchar(255) not null default '' comment '创建人',
|
|
|
+ update_user varchar(255) not null default '' comment '更新人',
|
|
|
+ create_time datetime not null default current_timestamp comment '创建时间',
|
|
|
+ update_time datetime not null default current_timestamp on update CURRENT_TIMESTAMP comment '更新时间'
|
|
|
+)comment '物模型lot表' ;
|
|
|
+
|
|
|
+create table iot_device_error
|
|
|
+(
|
|
|
+ id bigint unsigned auto_increment primary key,
|
|
|
+ device_code varchar(255) not null default '' comment '设备编号',
|
|
|
+ guid varchar(255) not null default '' comment '唯一标识[暂时保留]',
|
|
|
+ error_reason text null comment '设备异常原因',
|
|
|
+ create_time datetime not null default current_timestamp comment '创建时间',
|
|
|
+ update_time datetime not null default current_timestamp on update CURRENT_TIMESTAMP comment '更新时间',
|
|
|
+
|
|
|
+)comment '设备异常记录表';
|
|
|
+
|
|
|
+create table iot_mod_error
|
|
|
+(
|
|
|
+ id bigint unsigned auto_increment
|
|
|
+ primary key,
|
|
|
+ mod_code varchar(255) not null default '' comment '物理模型编号',
|
|
|
+ error_reason text null comment '设备异常原因',
|
|
|
+ create_time datetime not null default current_timestamp comment '创建时间',
|
|
|
+ update_time datetime not null default current_timestamp on update CURRENT_TIMESTAMP comment '更新时间',
|
|
|
+)comment '物理模型设备异常记录表';
|
|
|
+
|
|
|
+create table time_Series_database_mapping
|
|
|
+(
|
|
|
+ id bigint unsigned auto_increment
|
|
|
+ primary key,
|
|
|
+ time_Series_table_name varchar(255) not null default '' comment '时序数据库子表名称',
|
|
|
+ time_Series_super_name varchar(255) not null default '' comment '时序数据库超级表名称',
|
|
|
+ guid varchar(255) not null default '' comment 'guid',
|
|
|
+ create_time datetime not null default current_timestamp comment '创建时间',
|
|
|
+ update_time datetime not null default current_timestamp on update CURRENT_TIMESTAMP comment '更新时间',
|
|
|
+)comment '时序数据库和关系型数据库映射表';
|
|
|
+
|
|
|
+-- create table iot_device_history
|
|
|
+-- (
|
|
|
+-- id int unsigned auto_increment
|
|
|
+-- primary key,
|
|
|
+-- guid varchar(255) not null default '' comment '设备guid标识',
|
|
|
+-- sn varchar(255) not null default '' comment '设备唯一sn码标识',
|
|
|
+-- value varchar(20) not null default '' comment '某天最后一条值',
|
|
|
+-- large_type tinyint not null default -1 comment '1-12(车辆、装载机、矿卡、人员、水表、电表、边坡监控、视频监控、皮带称重、环境监测、无人地磅、排放监测)',
|
|
|
+-- unit varchar(10) not null default '' comment '单位',
|
|
|
+-- create_time datetime not null default current_timestamp comment '对应某天时间'
|
|
|
+-- )comment '设备归档表';
|
|
|
+--
|
|
|
+--
|
|
|
+--
|
|
|
+--
|
|
|
+--
|
|
|
+--
|
|
|
+--
|
|
|
+--
|
|
|
+--
|
|
|
+-- create table saas_point_position_device
|
|
|
+-- (
|
|
|
+-- id bigint unsigned auto_increment
|
|
|
+-- primary key,
|
|
|
+-- p_id bigint not null default -1 comment '点位表id',
|
|
|
+-- guid varchar(120) not null default '' comment '设备id',
|
|
|
+-- device_group_code varchar(255) not null default '' comment '物联网设备的分组id或摄像头设备的标签id',
|
|
|
+-- category tinyint unsigned not null default 2 comment '1-iot ,2-device',
|
|
|
+-- create_time datetime not null default current_timestamp comment '创建时间',
|
|
|
+-- update_time datetime not null default current_timestamp on update CURRENT_TIMESTAMP comment '更新时间',
|
|
|
+-- del_flag tinyint not null default 0 comment '0-未删除,1-删除',
|
|
|
+-- status tinyint unsigned not null default 1 comment '1启用,2禁用',
|
|
|
+-- constraint p_id_2
|
|
|
+-- unique (p_id, guid, category)
|
|
|
+-- ) comment '大屏点位设备关系表';
|
|
|
+--
|
|
|
+-- create index guid
|
|
|
+-- on saas_point_position_device (guid);
|
|
|
+--
|
|
|
+-- create index p_id
|
|
|
+-- on saas_point_position_device (p_id);
|
|
|
+--
|
|
|
+--
|
|
|
+--
|
|
|
+--
|
|
|
+--
|
|
|
+-- create index guid
|
|
|
+-- on iot_device_history (guid);
|
|
|
+--
|
|
|
+-- create index guid_2
|
|
|
+-- on iot_device_history (guid, create_time);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|