create_cxf_20251107.sql 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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. mod_code varchar(255) not null default '' comment '物理模型码值',
  59. company_id bigint unsigned not null default 0 comment '所属客户id',
  60. mode_group_code varchar(255) not null default '' comment '物模型分组码值',
  61. guid varchar(255) collate utf8mb4_general_ci not null default '' comment '唯一标识',
  62. name varchar(255) not null default '' comment '物模型名称',
  63. description varchar(255) not null default '' comment '最后一次更新值[原来字段 desc]',
  64. remarks varchar(255) not null default '' comment '备注',
  65. tsl_json text null comment '包含JSON',
  66. version int unsigned not null default 1 comment '版本[原来字段 tsl_ver]',
  67. num int unsigned not null default 0 comment '设备数',
  68. del_flag tinyint not null default 0 comment '0-未删除,1-删除',
  69. create_user varchar(255) not null default '' comment '创建人',
  70. update_user varchar(255) not null default '' comment '更新人',
  71. create_time datetime not null default current_timestamp comment '创建时间',
  72. update_time datetime not null default current_timestamp on update CURRENT_TIMESTAMP comment '更新时间'
  73. )comment '物模型lot表' ;
  74. create table iot_device_error
  75. (
  76. id bigint unsigned auto_increment primary key,
  77. device_code varchar(255) not null default '' comment '设备编号',
  78. guid varchar(255) not null default '' comment '唯一标识[暂时保留]',
  79. error_reason text null comment '设备异常原因',
  80. create_time datetime not null default current_timestamp comment '创建时间',
  81. update_time datetime not null default current_timestamp on update CURRENT_TIMESTAMP comment '更新时间',
  82. create_user varchar(255) not null default '' comment '创建人',
  83. update_user varchar(255) not null default '' comment '更新人',
  84. del_flag tinyint not null default 0 comment '0-未删除,1-删除'
  85. )comment '设备异常记录表';
  86. create table iot_mod_error
  87. (
  88. id bigint unsigned auto_increment
  89. primary key,
  90. mod_code varchar(255) not null default '' comment '物理模型编号',
  91. error_reason text null comment '设备异常原因',
  92. create_time datetime not null default current_timestamp comment '创建时间',
  93. update_time datetime not null default current_timestamp on update CURRENT_TIMESTAMP comment '更新时间',
  94. create_user varchar(255) not null default '' comment '创建人',
  95. update_user varchar(255) not null default '' comment '更新人',
  96. del_flag tinyint not null default 0 comment '0-未删除,1-删除'
  97. )comment '物理模型设备异常记录表';
  98. create table iot_td_rutting
  99. (
  100. id bigint unsigned auto_increment
  101. primary key,
  102. table_name varchar(255) not null default '' comment 'td数据库表名',
  103. tenant_id varchar(128) not null default '' comment '租户id',
  104. guid varchar(255) not null default '' comment '设备唯一id',
  105. create_time datetime not null default current_timestamp comment '创建时间'
  106. )comment 'td数据库路由表';
  107. -- create table iot_device_history
  108. -- (
  109. -- id int unsigned auto_increment
  110. -- primary key,
  111. -- guid varchar(255) not null default '' comment '设备guid标识',
  112. -- sn varchar(255) not null default '' comment '设备唯一sn码标识',
  113. -- value varchar(20) not null default '' comment '某天最后一条值',
  114. -- large_type tinyint not null default -1 comment '1-12(车辆、装载机、矿卡、人员、水表、电表、边坡监控、视频监控、皮带称重、环境监测、无人地磅、排放监测)',
  115. -- unit varchar(10) not null default '' comment '单位',
  116. -- create_time datetime not null default current_timestamp comment '对应某天时间'
  117. -- )comment '设备归档表';
  118. --
  119. --
  120. --
  121. --
  122. --
  123. --
  124. --
  125. --
  126. --
  127. -- create table saas_point_position_device
  128. -- (
  129. -- id bigint unsigned auto_increment
  130. -- primary key,
  131. -- p_id bigint not null default -1 comment '点位表id',
  132. -- guid varchar(120) not null default '' comment '设备id',
  133. -- device_group_code varchar(255) not null default '' comment '物联网设备的分组id或摄像头设备的标签id',
  134. -- category tinyint unsigned not null default 2 comment '1-iot ,2-device',
  135. -- create_time datetime not null default current_timestamp comment '创建时间',
  136. -- update_time datetime not null default current_timestamp on update CURRENT_TIMESTAMP comment '更新时间',
  137. -- del_flag tinyint not null default 0 comment '0-未删除,1-删除',
  138. -- status tinyint unsigned not null default 1 comment '1启用,2禁用',
  139. -- constraint p_id_2
  140. -- unique (p_id, guid, category)
  141. -- ) comment '大屏点位设备关系表';
  142. --
  143. -- create index guid
  144. -- on saas_point_position_device (guid);
  145. --
  146. -- create index p_id
  147. -- on saas_point_position_device (p_id);
  148. --
  149. --
  150. --
  151. --
  152. --
  153. -- create index guid
  154. -- on iot_device_history (guid);
  155. --
  156. -- create index guid_2
  157. -- on iot_device_history (guid, create_time);