|
@@ -1,7 +1,6 @@
|
|
|
create table iot_device
|
|
create table iot_device
|
|
|
(
|
|
(
|
|
|
id bigint unsigned auto_increment primary key,
|
|
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',
|
|
company_id bigint unsigned not null default 0 comment '所属客户id',
|
|
|
guid varchar(255) not null default '' comment '唯一标识[暂时保留]',
|
|
guid varchar(255) not null default '' comment '唯一标识[暂时保留]',
|
|
|
device_code varchar(255) not null default '' comment '设备编号',
|
|
device_code varchar(255) not null default '' comment '设备编号',
|
|
@@ -22,6 +21,7 @@ create table iot_device
|
|
|
update_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-删除',
|
|
del_flag tinyint not null default 0 comment '0-未删除,1-删除',
|
|
|
eg_id bigint not null default -1 comment '设备类别',
|
|
eg_id bigint not null default -1 comment '设备类别',
|
|
|
|
|
+ tenant_id varchar(128) not null default '' comment '租户id',
|
|
|
constraint guid unique (guid)
|
|
constraint guid unique (guid)
|
|
|
) comment '设备表';
|
|
) comment '设备表';
|
|
|
|
|
|
|
@@ -32,15 +32,15 @@ create table iot_device_group
|
|
|
(
|
|
(
|
|
|
id bigint unsigned auto_increment primary key,
|
|
id bigint unsigned auto_increment primary key,
|
|
|
device_group_code varchar(255) not null default '' comment '设备分组码值',
|
|
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',
|
|
company_id bigint not null default 0 comment '所属客户id',
|
|
|
title varchar(255) not null default '' comment '设备分组名称',
|
|
title varchar(255) not null default '' comment '设备分组名称',
|
|
|
large_type tinyint unsigned not null default 0 comment '[有点晕?]1-12(车辆、装载机、矿卡、人员、水表、电表、边坡监控、视频监控、皮带称重、环境监测、无人地磅、排放监测)',
|
|
large_type tinyint unsigned not null default 0 comment '[有点晕?]1-12(车辆、装载机、矿卡、人员、水表、电表、边坡监控、视频监控、皮带称重、环境监测、无人地磅、排放监测)',
|
|
|
del_flag tinyint not null default 0 comment '0-未删除,1-删除',
|
|
del_flag tinyint not null default 0 comment '0-未删除,1-删除',
|
|
|
create_time datetime not null default CURRENT_TIMESTAMP comment '创建时间',
|
|
create_time datetime not null default CURRENT_TIMESTAMP comment '创建时间',
|
|
|
update_time datetime not null default current_timestamp on update 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 '更新人'
|
|
|
|
|
|
|
+ create_user varchar(255) not null default '' comment '创建人',
|
|
|
|
|
+ update_user varchar(255) not null default '' comment '更新人',
|
|
|
|
|
+ tenant_id varchar(255) not null default '' comment '租户id'
|
|
|
) comment '设备分组表';
|
|
) comment '设备分组表';
|
|
|
|
|
|
|
|
|
|
|
|
@@ -48,7 +48,6 @@ create table iot_mod_group
|
|
|
(
|
|
(
|
|
|
id bigint unsigned auto_increment primary key,
|
|
id bigint unsigned auto_increment primary key,
|
|
|
company_id bigint unsigned not null default 0 comment '所属客户id',
|
|
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 '物理模型分组码值唯一标识',
|
|
mode_group_code varchar(255) not null default '' comment '物理模型分组码值唯一标识',
|
|
|
name varchar(255) not null default '' comment '物模型分组名称',
|
|
name varchar(255) not null default '' comment '物模型分组名称',
|
|
|
create_time datetime not null default CURRENT_TIMESTAMP comment '创建时间',
|
|
create_time datetime not null default CURRENT_TIMESTAMP comment '创建时间',
|
|
@@ -56,6 +55,7 @@ create table iot_mod_group
|
|
|
del_flag tinyint not null default 0 comment '0-未删除,1-删除',
|
|
del_flag tinyint not null default 0 comment '0-未删除,1-删除',
|
|
|
create_user varchar(255) not null default '' comment '创建人',
|
|
create_user varchar(255) not null default '' comment '创建人',
|
|
|
update_user varchar(255) not null default '' comment '修改人',
|
|
update_user varchar(255) not null default '' comment '修改人',
|
|
|
|
|
+ tenant_id varchar(255) not null default '' comment '租户id',
|
|
|
constraint name unique (mode_group_code)
|
|
constraint name unique (mode_group_code)
|
|
|
) comment '物理模型分组表';
|
|
) comment '物理模型分组表';
|
|
|
|
|
|
|
@@ -64,7 +64,6 @@ create table iot_mod_group
|
|
|
create table iot_mod
|
|
create table iot_mod
|
|
|
(
|
|
(
|
|
|
id bigint unsigned auto_increment primary key,
|
|
id bigint unsigned auto_increment primary key,
|
|
|
- tenant_id varchar(255) not null default '' comment '租户id',
|
|
|
|
|
mod_code varchar(255) not null default '' comment '物理模型码值',
|
|
mod_code varchar(255) not null default '' comment '物理模型码值',
|
|
|
company_id bigint unsigned not null default 0 comment '所属客户id',
|
|
company_id bigint unsigned not null default 0 comment '所属客户id',
|
|
|
mode_group_code varchar(255) not null default '' comment '物模型分组码值',
|
|
mode_group_code varchar(255) not null default '' comment '物模型分组码值',
|
|
@@ -79,7 +78,8 @@ create table iot_mod
|
|
|
create_user varchar(255) not null default '' comment '创建人',
|
|
create_user varchar(255) not null default '' comment '创建人',
|
|
|
update_user varchar(255) not null default '' comment '更新人',
|
|
update_user varchar(255) not null default '' comment '更新人',
|
|
|
create_time datetime not null default current_timestamp comment '创建时间',
|
|
create_time datetime not null default current_timestamp comment '创建时间',
|
|
|
- update_time datetime not null default current_timestamp on update CURRENT_TIMESTAMP comment '更新时间'
|
|
|
|
|
|
|
+ update_time datetime not null default current_timestamp on update CURRENT_TIMESTAMP comment '更新时间',
|
|
|
|
|
+ tenant_id varchar(255) not null default '' comment '租户id'
|
|
|
)comment '物模型lot表' ;
|
|
)comment '物模型lot表' ;
|
|
|
|
|
|
|
|
create table iot_device_error
|
|
create table iot_device_error
|
|
@@ -90,13 +90,11 @@ create table iot_device_error
|
|
|
error_reason text null comment '设备异常原因',
|
|
error_reason text null comment '设备异常原因',
|
|
|
create_time datetime not null default current_timestamp comment '创建时间',
|
|
create_time datetime not null default current_timestamp comment '创建时间',
|
|
|
update_time datetime not null default current_timestamp on update CURRENT_TIMESTAMP comment '更新时间'
|
|
update_time datetime not null default current_timestamp on update CURRENT_TIMESTAMP comment '更新时间'
|
|
|
-
|
|
|
|
|
)comment '设备异常记录表';
|
|
)comment '设备异常记录表';
|
|
|
|
|
|
|
|
create table iot_mod_error
|
|
create table iot_mod_error
|
|
|
(
|
|
(
|
|
|
- id bigint unsigned auto_increment
|
|
|
|
|
- primary key,
|
|
|
|
|
|
|
+ id bigint unsigned auto_increment primary key,
|
|
|
mod_code varchar(255) not null default '' comment '物理模型编号',
|
|
mod_code varchar(255) not null default '' comment '物理模型编号',
|
|
|
error_reason text null comment '设备异常原因',
|
|
error_reason text null comment '设备异常原因',
|
|
|
create_time datetime not null default current_timestamp comment '创建时间',
|
|
create_time datetime not null default current_timestamp comment '创建时间',
|
|
@@ -105,22 +103,20 @@ create table iot_mod_error
|
|
|
|
|
|
|
|
create table time_Series_database_mapping
|
|
create table time_Series_database_mapping
|
|
|
(
|
|
(
|
|
|
- id bigint unsigned auto_increment
|
|
|
|
|
- primary key,
|
|
|
|
|
- tenant_id varchar(255) not null default '' comment '租户id',
|
|
|
|
|
|
|
+ id bigint unsigned auto_increment primary key,
|
|
|
time_Series_table_name varchar(255) not null default '' comment '时序数据库子表名称',
|
|
time_Series_table_name varchar(255) not null default '' comment '时序数据库子表名称',
|
|
|
time_Series_super_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',
|
|
guid varchar(255) not null default '' comment 'guid',
|
|
|
create_time datetime not null default current_timestamp comment '创建时间',
|
|
create_time datetime not null default current_timestamp comment '创建时间',
|
|
|
- update_time datetime not null default current_timestamp on update CURRENT_TIMESTAMP comment '更新时间'
|
|
|
|
|
|
|
+ update_time datetime not null default current_timestamp on update CURRENT_TIMESTAMP comment '更新时间',
|
|
|
|
|
+ tenant_id varchar(255) not null default '' comment '租户id'
|
|
|
)comment '时序数据库和关系型数据库映射表';
|
|
)comment '时序数据库和关系型数据库映射表';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
create table saas_equipment_manage
|
|
create table saas_equipment_manage
|
|
|
(
|
|
(
|
|
|
- id int unsigned auto_increment
|
|
|
|
|
- primary key,
|
|
|
|
|
|
|
+ id int unsigned auto_increment primary key,
|
|
|
device_name varchar(60) not null default '' comment '设备名称',
|
|
device_name varchar(60) not null default '' comment '设备名称',
|
|
|
equipment_type varchar(100) not null default '' comment '设备类型',
|
|
equipment_type varchar(100) not null default '' comment '设备类型',
|
|
|
energy_type tinyint(1) not null default 1 comment '能源形式',
|
|
energy_type tinyint(1) not null default 1 comment '能源形式',
|
|
@@ -132,8 +128,7 @@ create table saas_equipment_manage
|
|
|
create_time datetime not null default current_timestamp comment '创建时间',
|
|
create_time datetime not null default current_timestamp comment '创建时间',
|
|
|
update_time datetime not null default current_timestamp on update current_timestamp comment '更新时间'
|
|
update_time datetime not null default current_timestamp on update current_timestamp comment '更新时间'
|
|
|
|
|
|
|
|
-)
|
|
|
|
|
- comment '设备基础管理表(关联物联网ID)';
|
|
|
|
|
|
|
+)comment '设备基础管理表(关联物联网ID)';
|
|
|
|
|
|
|
|
create index energy_type
|
|
create index energy_type
|
|
|
on saas_equipment_manage (energy_type);
|
|
on saas_equipment_manage (energy_type);
|