create_cxf.sql 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. create table iot_device
  2. (
  3. id bigint unsigned auto_increment primary key,
  4. company_id bigint unsigned not null default 0 comment '所属客户id',
  5. guid varchar(255) not null default '' comment '唯一标识[暂时保留]',
  6. device_group_code 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. tenant_id varchar(128) not null default '' comment '租户id',
  26. constraint guid unique (guid)
  27. ) comment '设备表';
  28. create table iot_device_group
  29. (
  30. id bigint unsigned auto_increment primary key,
  31. device_group_code varchar(255) not null default '' comment '设备分组码值',
  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. tenant_id varchar(255) not null default '' comment '租户id'
  41. ) comment '设备分组表';
  42. create table iot_mod_group
  43. (
  44. id bigint unsigned auto_increment primary key,
  45. company_id bigint unsigned not null default 0 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. tenant_id varchar(255) not null default '' comment '租户id',
  54. constraint name unique (mode_group_code)
  55. ) comment '物理模型分组表';
  56. create table iot_mod
  57. (
  58. id bigint unsigned auto_increment primary key,
  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. tenant_id varchar(255) not null default '' comment '租户id'
  75. )comment '物模型lot表' ;
  76. create table iot_device_error
  77. (
  78. id bigint unsigned auto_increment primary key,
  79. device_code varchar(255) not null default '' comment '设备编号',
  80. guid varchar(255) not null default '' comment '唯一标识[暂时保留]',
  81. error_reason text null comment '设备异常原因',
  82. create_time datetime not null default current_timestamp comment '创建时间',
  83. update_time datetime not null default current_timestamp on update CURRENT_TIMESTAMP comment '更新时间'
  84. )comment '设备异常记录表';
  85. create table iot_mod_error
  86. (
  87. id bigint unsigned auto_increment 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 primary key,
  96. time_Series_table_name varchar(255) not null default '' comment '时序数据库子表名称',
  97. time_Series_super_name varchar(255) not null default '' comment '时序数据库超级表名称',
  98. guid varchar(255) not null default '' comment 'guid',
  99. create_time datetime not null default current_timestamp comment '创建时间',
  100. update_time datetime not null default current_timestamp on update CURRENT_TIMESTAMP comment '更新时间',
  101. tenant_id varchar(255) not null default '' comment '租户id'
  102. )comment '时序数据库和关系型数据库映射表';
  103. create table saas_equipment_manage
  104. (
  105. id int unsigned auto_increment primary key,
  106. device_name varchar(60) not null default '' comment '设备名称',
  107. equipment_type varchar(100) not null default '' comment '设备类型',
  108. energy_type tinyint(1) not null default 1 comment '能源形式',
  109. equipment_guid varchar(40) not null default '' comment '设备GUID',
  110. mod_guid varchar(40) not null default '' comment '物联网模型GUID',
  111. pay_time datetime not null default '1000-01-01 00:00:00' comment '购买时间',
  112. depreciation_period int not null default -1 comment '折旧年限',
  113. total_depreciation_value decimal(15, 2) not null default 0.00 comment '折旧总值',
  114. create_time datetime not null default current_timestamp comment '创建时间',
  115. update_time datetime not null default current_timestamp on update current_timestamp comment '更新时间'
  116. )comment '设备基础管理表(关联物联网ID)';
  117. create table vehicle_data
  118. (
  119. id bigint unsigned auto_increment primary key,
  120. car_no varchar(10) not null default '' comment '车牌',
  121. fleet_id varchar(50) not null default '' comment '车队id',
  122. fleet_name varchar(50) not null default '' comment '车队名称',
  123. device_id varchar(50) not null default '' comment '设备唯一id',
  124. device_name varchar(50) not null default '' comment '设备名称',
  125. group_id varchar(50) not null default '' comment '区域ID',
  126. group_name varchar(50) not null default '' comment '区域名称',
  127. biz_id varchar(50) not null default '' comment '业务ID',
  128. biz_name varchar(50) not null default '' comment '业务名称',
  129. project_id varchar(50) not null default '' comment '项目ID',
  130. project_name varchar(50) not null default '' comment '项目名称',
  131. del_flag tinyint not null default 0 comment '0-未删除,1-删除',
  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. create_user varchar(255) not null default '' comment '创建人',
  135. update_user varchar(255) not null default '' comment '更新人',
  136. tenant_id varchar(255) not null default '' comment '租户id'
  137. ) comment '车辆表';
  138. create index energy_type
  139. on saas_equipment_manage (energy_type);
  140. create index guid
  141. on saas_equipment_manage (mod_guid);
  142. create index type
  143. on saas_equipment_manage (equipment_type);
  144. -- create table iot_device_history
  145. -- (
  146. -- id int unsigned auto_increment
  147. -- primary key,
  148. -- guid varchar(255) not null default '' comment '设备guid标识',
  149. -- sn varchar(255) not null default '' comment '设备唯一sn码标识',
  150. -- value varchar(20) not null default '' comment '某天最后一条值',
  151. -- large_type tinyint not null default -1 comment '1-12(车辆、装载机、矿卡、人员、水表、电表、边坡监控、视频监控、皮带称重、环境监测、无人地磅、排放监测)',
  152. -- unit varchar(10) not null default '' comment '单位',
  153. -- create_time datetime not null default current_timestamp comment '对应某天时间'
  154. -- )comment '设备归档表';
  155. --
  156. --
  157. --
  158. --
  159. --
  160. --
  161. --
  162. --
  163. --
  164. -- create table saas_point_position_device
  165. -- (
  166. -- id bigint unsigned auto_increment
  167. -- primary key,
  168. -- p_id bigint not null default -1 comment '点位表id',
  169. -- guid varchar(120) not null default '' comment '设备id',
  170. -- device_group_code varchar(255) not null default '' comment '物联网设备的分组id或摄像头设备的标签id',
  171. -- category tinyint unsigned not null default 2 comment '1-iot ,2-device',
  172. -- create_time datetime not null default current_timestamp comment '创建时间',
  173. -- update_time datetime not null default current_timestamp on update CURRENT_TIMESTAMP comment '更新时间',
  174. -- del_flag tinyint not null default 0 comment '0-未删除,1-删除',
  175. -- status tinyint unsigned not null default 1 comment '1启用,2禁用',
  176. -- constraint p_id_2
  177. -- unique (p_id, guid, category)
  178. -- ) comment '大屏点位设备关系表';
  179. --
  180. -- create index guid
  181. -- on saas_point_position_device (guid);
  182. --
  183. -- create index p_id
  184. -- on saas_point_position_device (p_id);
  185. --
  186. --
  187. --
  188. --
  189. --
  190. -- create index guid
  191. -- on iot_device_history (guid);
  192. --
  193. -- create index guid_2
  194. -- on iot_device_history (guid, create_time);