create_cxf.sql 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. create table iot_device
  2. (
  3. id bigint unsigned auto_increment primary key,
  4. tenant_id varchar(128) not null default '' comment '租户id',
  5. company_id bigint unsigned not null default 0 comment '所属客户id',
  6. guid varchar(255) not null default '' comment '唯一标识[暂时保留]',
  7. device_code varchar(255) not null default '' comment '设备编号',
  8. sn varchar(255) not null default '' comment 'sn通常是:IMEI',
  9. mod_code varchar(255) not null default '' comment '物联网模型码值',
  10. device_name varchar(255) not null default '' comment '设备名称[旧系统的title]',
  11. brand varchar(255) not null default '' comment '设备品牌名称',
  12. model_code varchar(255) not null default '' comment '型号',
  13. description varchar(1024) not null default '' comment '最后一次设备更新信息值[旧系统的desc]',
  14. remarks varchar(255) charset utf8mb4 not null default '' comment '备注',
  15. status tinyint unsigned not null default 1 comment '1在线2离线3异常',
  16. longitude varchar(40) not null default '' comment '经度[lng]',
  17. latitude varchar(40) not null default '' comment '纬度[lat]',
  18. high varchar(40) not null default '' comment '高度',
  19. create_time datetime not null default current_timestamp comment '创建时间',
  20. update_time datetime not null default current_timestamp on update CURRENT_TIMESTAMP comment '更新时间',
  21. create_user varchar(255) not null default '' comment '创建人',
  22. update_user varchar(255) not null default '' comment '更新人',
  23. del_flag tinyint not null default 0 comment '0-未删除,1-删除',
  24. eg_id bigint not null default -1 comment '设备类别',
  25. constraint guid unique (guid)
  26. ) comment '设备表';
  27. create table iot_device_group
  28. (
  29. id bigint unsigned auto_increment primary key,
  30. device_group_code varchar(255) not null default '' comment '设备分组码值',
  31. tenant_id varchar(255) not null default '' comment '租户id',
  32. company_id bigint not null default 0 comment '所属客户id',
  33. title varchar(255) not null default '' comment '设备分组名称',
  34. large_type tinyint unsigned not null default 0 comment '[有点晕?]1-12(车辆、装载机、矿卡、人员、水表、电表、边坡监控、视频监控、皮带称重、环境监测、无人地磅、排放监测)',
  35. del_flag tinyint not null default 0 comment '0-未删除,1-删除',
  36. create_time datetime not null default CURRENT_TIMESTAMP comment '创建时间',
  37. update_time datetime not null default current_timestamp on update CURRENT_TIMESTAMP comment '更新时间',
  38. create_user varchar(255) not null default '' comment '创建人',
  39. update_user varchar(255) not null default '' comment '更新人'
  40. ) comment '设备分组表';
  41. create table iot_mod_group
  42. (
  43. id bigint unsigned auto_increment primary key,
  44. company_id bigint unsigned not null default 0 comment '所属客户id',
  45. tenant_id varchar(255) not null default '' comment '租户id',
  46. mode_group_code varchar(255) not null default '' comment '物理模型分组码值唯一标识',
  47. name varchar(255) not null default '' comment '物模型分组名称',
  48. create_time datetime not null default CURRENT_TIMESTAMP comment '创建时间',
  49. update_time datetime not null default current_timestamp on update CURRENT_TIMESTAMP,
  50. del_flag tinyint not null default 0 comment '0-未删除,1-删除',
  51. create_user varchar(255) not null default '' comment '创建人',
  52. update_user varchar(255) not null default '' comment '修改人',
  53. constraint name unique (mode_group_code)
  54. ) comment '物理模型分组表';
  55. create table iot_mod
  56. (
  57. id bigint unsigned auto_increment primary key,
  58. tenant_id varchar(255) not null default '' comment '租户id',
  59. mod_code varchar(255) not null default '' comment '物理模型码值',
  60. company_id bigint unsigned not null default 0 comment '所属客户id',
  61. mode_group_code varchar(255) not null default '' comment '物模型分组码值',
  62. guid varchar(255) collate utf8mb4_general_ci not null default '' comment '唯一标识',
  63. name varchar(255) not null default '' comment '物模型名称',
  64. description varchar(255) not null default '' comment '最后一次更新值[原来字段 desc]',
  65. remarks varchar(255) not null default '' comment '备注',
  66. tsl_json text null comment '包含JSON',
  67. version int unsigned not null default 1 comment '版本[原来字段 tsl_ver]',
  68. num int unsigned not null default 0 comment '设备数',
  69. del_flag tinyint not null default 0 comment '0-未删除,1-删除',
  70. create_user varchar(255) not null default '' comment '创建人',
  71. update_user varchar(255) not null default '' comment '更新人',
  72. create_time datetime not null default current_timestamp comment '创建时间',
  73. update_time datetime not null default current_timestamp on update CURRENT_TIMESTAMP comment '更新时间'
  74. )comment '物模型lot表' ;
  75. create table iot_device_error
  76. (
  77. id bigint unsigned auto_increment primary key,
  78. device_code varchar(255) not null default '' comment '设备编号',
  79. guid varchar(255) not null default '' comment '唯一标识[暂时保留]',
  80. error_reason text null comment '设备异常原因',
  81. create_time datetime not null default current_timestamp comment '创建时间',
  82. update_time datetime not null default current_timestamp on update CURRENT_TIMESTAMP comment '更新时间'
  83. )comment '设备异常记录表';
  84. create table iot_mod_error
  85. (
  86. id bigint unsigned auto_increment
  87. primary key,
  88. mod_code varchar(255) not null default '' comment '物理模型编号',
  89. error_reason text null comment '设备异常原因',
  90. create_time datetime not null default current_timestamp comment '创建时间',
  91. update_time datetime not null default current_timestamp on update CURRENT_TIMESTAMP comment '更新时间'
  92. )comment '物理模型设备异常记录表';
  93. create table time_Series_database_mapping
  94. (
  95. id bigint unsigned auto_increment
  96. primary key,
  97. tenant_id varchar(255) not null default '' comment '租户id',
  98. time_Series_table_name varchar(255) not null default '' comment '时序数据库子表名称',
  99. time_Series_super_name varchar(255) not null default '' comment '时序数据库超级表名称',
  100. guid varchar(255) not null default '' comment 'guid',
  101. create_time datetime not null default current_timestamp comment '创建时间',
  102. update_time datetime not null default current_timestamp on update CURRENT_TIMESTAMP comment '更新时间'
  103. )comment '时序数据库和关系型数据库映射表';
  104. -- create table iot_device_history
  105. -- (
  106. -- id int unsigned auto_increment
  107. -- primary key,
  108. -- guid varchar(255) not null default '' comment '设备guid标识',
  109. -- sn varchar(255) not null default '' comment '设备唯一sn码标识',
  110. -- value varchar(20) not null default '' comment '某天最后一条值',
  111. -- large_type tinyint not null default -1 comment '1-12(车辆、装载机、矿卡、人员、水表、电表、边坡监控、视频监控、皮带称重、环境监测、无人地磅、排放监测)',
  112. -- unit varchar(10) not null default '' comment '单位',
  113. -- create_time datetime not null default current_timestamp comment '对应某天时间'
  114. -- )comment '设备归档表';
  115. --
  116. --
  117. --
  118. --
  119. --
  120. --
  121. --
  122. --
  123. --
  124. -- create table saas_point_position_device
  125. -- (
  126. -- id bigint unsigned auto_increment
  127. -- primary key,
  128. -- p_id bigint not null default -1 comment '点位表id',
  129. -- guid varchar(120) not null default '' comment '设备id',
  130. -- device_group_code varchar(255) not null default '' comment '物联网设备的分组id或摄像头设备的标签id',
  131. -- category tinyint unsigned not null default 2 comment '1-iot ,2-device',
  132. -- create_time datetime not null default current_timestamp comment '创建时间',
  133. -- update_time datetime not null default current_timestamp on update CURRENT_TIMESTAMP comment '更新时间',
  134. -- del_flag tinyint not null default 0 comment '0-未删除,1-删除',
  135. -- status tinyint unsigned not null default 1 comment '1启用,2禁用',
  136. -- constraint p_id_2
  137. -- unique (p_id, guid, category)
  138. -- ) comment '大屏点位设备关系表';
  139. --
  140. -- create index guid
  141. -- on saas_point_position_device (guid);
  142. --
  143. -- create index p_id
  144. -- on saas_point_position_device (p_id);
  145. --
  146. --
  147. --
  148. --
  149. --
  150. -- create index guid
  151. -- on iot_device_history (guid);
  152. --
  153. -- create index guid_2
  154. -- on iot_device_history (guid, create_time);