iot-dc3.sql 60 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789
  1. /*
  2. * Copyright (c) 2022. Pnoker. All Rights Reserved.
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. * http://www.apache.org/licenses/LICENSE-2.0
  7. * Unless required by applicable law or agreed to in writing, software
  8. * distributed under the License is distributed on an "AS IS" BASIS,
  9. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. * See the License for the specific language governing permissions and
  11. * limitations under the License.
  12. */
  13. SET NAMES utf8mb4;
  14. SET FOREIGN_KEY_CHECKS = 0;
  15. CREATE DATABASE dc3;
  16. USE dc3;
  17. -- ----------------------------
  18. -- Table structure for dc3_tenant
  19. -- ----------------------------
  20. drop table if exists dc3_tenant;
  21. create table dc3_tenant
  22. (
  23. id bigint unsigned auto_increment primary key not null comment '主键ID',
  24. tenant_name varchar(128) default '' not null comment '租户名称',
  25. tenant_code varchar(128) default '' not null comment '租户编号',
  26. enable_flag tinyint(4) default 1 not null comment '使能标识',
  27. remark varchar(512) default '' not null comment '描述',
  28. creator_id bigint default 0 not null comment '创建者ID',
  29. creator_name varchar(128) default '' not null comment '创建者名称',
  30. create_time datetime default CURRENT_TIMESTAMP(0) not null comment '创建时间',
  31. operator_id bigint default 0 not null comment '操作者ID',
  32. operator_name varchar(128) default '' not null comment '操作者名称',
  33. operate_time datetime default CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) not null comment '操作时间',
  34. deleted tinyint(4) default 0 not null comment '逻辑删除标识,0:未删除,1:已删除',
  35. INDEX idx_tenant_name (tenant_name) USING BTREE,
  36. INDEX idx_tenant_code (tenant_code) USING BTREE
  37. ) engine = InnoDB
  38. character set = utf8
  39. collate = utf8_general_ci
  40. comment = '租户表';
  41. -- ----------------------------
  42. -- Table structure for dc3_user_login
  43. -- ----------------------------
  44. drop table if exists dc3_user_login;
  45. create table dc3_user_login
  46. (
  47. id bigint unsigned auto_increment primary key not null comment '主键ID',
  48. login_name varchar(128) default '' not null comment '登录名称,加密存储',
  49. user_id bigint default 0 not null comment '用户ID',
  50. user_password_id bigint default 0 not null comment '用户密码ID',
  51. enable_flag tinyint(4) default 1 not null comment '使能标识',
  52. remark varchar(512) default '' not null comment '描述',
  53. creator_id bigint default 0 not null comment '创建者ID',
  54. creator_name varchar(128) default '' not null comment '创建者名称',
  55. create_time datetime default CURRENT_TIMESTAMP(0) not null comment '创建时间',
  56. operator_id bigint default 0 not null comment '操作者ID',
  57. operator_name varchar(128) default '' not null comment '操作者名称',
  58. operate_time datetime default CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) not null comment '操作时间',
  59. deleted tinyint(4) default 0 not null comment '逻辑删除标识,0:未删除,1:已删除',
  60. INDEX idx_login_name (login_name) USING BTREE,
  61. INDEX idx_user_id (user_id) USING BTREE,
  62. INDEX idx_user_password_id (user_password_id) USING BTREE
  63. ) engine = InnoDB
  64. character set = utf8
  65. collate = utf8_general_ci
  66. comment = '用户登录表';
  67. -- ----------------------------
  68. -- Table structure for dc3_user_password
  69. -- ----------------------------
  70. drop table if exists dc3_user_password;
  71. create table dc3_user_password
  72. (
  73. id bigint unsigned auto_increment primary key not null comment '主键ID',
  74. login_password varchar(512) default '' not null comment '登录密码',
  75. remark varchar(512) default '' not null comment '描述',
  76. creator_id bigint default 0 not null comment '创建者ID',
  77. creator_name varchar(128) default '' not null comment '创建者名称',
  78. create_time datetime default CURRENT_TIMESTAMP(0) not null comment '创建时间',
  79. operator_id bigint default 0 not null comment '操作者ID',
  80. operator_name varchar(128) default '' not null comment '操作者名称',
  81. operate_time datetime default CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) not null comment '操作时间',
  82. deleted tinyint(4) default 0 not null comment '逻辑删除标识,0:未删除,1:已删除'
  83. ) engine = InnoDB
  84. character set = utf8
  85. collate = utf8_general_ci
  86. comment = '用户密码表';
  87. -- ----------------------------
  88. -- Table structure for dc3_user
  89. -- ----------------------------
  90. drop table if exists dc3_user;
  91. create table dc3_user
  92. (
  93. id bigint unsigned auto_increment primary key not null comment '主键ID',
  94. nick_name varchar(128) default '' not null comment '用户昵称,加密存储',
  95. user_name varchar(128) default '' not null comment '用户名称,加密存储',
  96. phone varchar(32) default '' not null comment '手机号,加密存储',
  97. email varchar(128) default '' not null comment '邮箱,加密存储',
  98. social_ext json not null comment '社交相关拓展信息,加密存储',
  99. identity_ext json not null comment '身份相关拓展信息,加密存储',
  100. remark varchar(512) default '' not null comment '描述',
  101. creator_id bigint default 0 not null comment '创建者ID',
  102. creator_name varchar(128) default '' not null comment '创建者名称',
  103. create_time datetime default CURRENT_TIMESTAMP(0) not null comment '创建时间',
  104. operator_id bigint default 0 not null comment '操作者ID',
  105. operator_name varchar(128) default '' not null comment '操作者名称',
  106. operate_time datetime default CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) not null comment '操作时间',
  107. deleted tinyint(4) default 0 not null comment '逻辑删除标识,0:未删除,1:已删除',
  108. INDEX idx_nick_name (nick_name) USING BTREE,
  109. INDEX idx_user_name (user_name) USING BTREE,
  110. INDEX idx_phone (phone) USING BTREE,
  111. INDEX idx_email (email) USING BTREE
  112. ) engine = InnoDB
  113. character set = utf8
  114. collate = utf8_general_ci
  115. comment = '用户表';
  116. -- ----------------------------
  117. -- Table structure for dc3_tenant_bind
  118. -- ----------------------------
  119. drop table if exists dc3_tenant_bind;
  120. create table dc3_tenant_bind
  121. (
  122. id bigint unsigned auto_increment primary key not null comment '主键ID',
  123. tenant_id bigint default 0 not null comment '租户ID',
  124. user_id bigint default 0 not null comment '用户ID',
  125. remark varchar(512) default '' not null comment '描述',
  126. creator_id bigint default 0 not null comment '创建者ID',
  127. creator_name varchar(128) default '' not null comment '创建者名称',
  128. create_time datetime default CURRENT_TIMESTAMP(0) not null comment '创建时间',
  129. operator_id bigint default 0 not null comment '操作者ID',
  130. operator_name varchar(128) default '' not null comment '操作者名称',
  131. operate_time datetime default CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) not null comment '操作时间',
  132. deleted tinyint(4) default 0 not null comment '逻辑删除标识,0:未删除,1:已删除',
  133. INDEX idx_tenant_id (tenant_id) USING BTREE,
  134. INDEX idx_user_id (user_id) USING BTREE
  135. ) engine = InnoDB
  136. character set = utf8
  137. collate = utf8_general_ci
  138. comment = '租户关联表';
  139. -- ----------------------------
  140. -- Table structure for dc3_driver
  141. -- ----------------------------
  142. drop table if exists dc3_driver;
  143. create table dc3_driver
  144. (
  145. id bigint unsigned auto_increment primary key not null comment '主键ID',
  146. driver_name varchar(128) default '' not null comment '驱动名称',
  147. driver_code varchar(128) default '' not null comment '驱动编号',
  148. service_name varchar(128) default '' not null comment '驱动服务名称',
  149. service_host varchar(128) default '' not null comment '服务主机',
  150. driver_type_flag tinyint(4) default 0 not null comment '驱动类型标识',
  151. enable_flag tinyint(4) default 1 not null comment '使能标识',
  152. tenant_id bigint default 0 not null comment '租户ID',
  153. remark varchar(512) default '' not null comment '描述',
  154. creator_id bigint default 0 not null comment '创建者ID',
  155. creator_name varchar(128) default '' not null comment '创建者名称',
  156. create_time datetime default CURRENT_TIMESTAMP(0) not null comment '创建时间',
  157. operator_id bigint default 0 not null comment '操作者ID',
  158. operator_name varchar(128) default '' not null comment '操作者名称',
  159. operate_time datetime default CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) not null comment '操作时间',
  160. deleted tinyint(4) default 0 not null comment '逻辑删除标识,0:未删除,1:已删除',
  161. INDEX idx_driver_name (driver_name) USING BTREE,
  162. INDEX idx_driver_code (driver_code) USING BTREE
  163. ) engine = InnoDB
  164. character set = utf8
  165. collate = utf8_general_ci
  166. comment = '协议驱动表';
  167. -- ----------------------------
  168. -- Table structure for dc3_driver_attribute
  169. -- ----------------------------
  170. drop table if exists dc3_driver_attribute;
  171. create table dc3_driver_attribute
  172. (
  173. id bigint unsigned auto_increment primary key not null comment '主键ID',
  174. display_name varchar(128) default '' not null comment '显示名称',
  175. attribute_name varchar(128) default '' not null comment '属性名称',
  176. attribute_type_flag tinyint(4) default 0 not null comment '属性类型标识',
  177. default_value varchar(128) default '' not null comment '默认值',
  178. driver_id bigint default 0 not null comment '驱动ID',
  179. enable_flag tinyint(4) default 1 not null comment '使能标识',
  180. tenant_id bigint default 0 not null comment '租户ID',
  181. remark varchar(512) default '' not null comment '描述',
  182. creator_id bigint default 0 not null comment '创建者ID',
  183. creator_name varchar(128) default '' not null comment '创建者名称',
  184. create_time datetime default CURRENT_TIMESTAMP(0) not null comment '创建时间',
  185. operator_id bigint default 0 not null comment '操作者ID',
  186. operator_name varchar(128) default '' not null comment '操作者名称',
  187. operate_time datetime default CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) not null comment '操作时间',
  188. deleted tinyint(4) default 0 not null comment '逻辑删除标识,0:未删除,1:已删除',
  189. INDEX idx_driver_id (driver_id) USING BTREE
  190. ) engine = InnoDB
  191. character set = utf8
  192. collate = utf8_general_ci
  193. comment = '连接配置信息表';
  194. -- ----------------------------
  195. -- Table structure for dc3_point_attribute
  196. -- ----------------------------
  197. drop table if exists dc3_point_attribute;
  198. create table dc3_point_attribute
  199. (
  200. id bigint unsigned auto_increment primary key not null comment '主键ID',
  201. display_name varchar(128) default '' not null comment '显示名称',
  202. attribute_name varchar(128) default '' not null comment '属性名称',
  203. attribute_type_flag tinyint(4) default 0 not null comment '属性类型标识',
  204. default_value varchar(128) default '' not null comment '默认值',
  205. driver_id bigint default 0 not null comment '驱动ID',
  206. enable_flag tinyint(4) default 1 not null comment '使能标识',
  207. tenant_id bigint default 0 not null comment '租户ID',
  208. remark varchar(512) default '' not null comment '描述',
  209. creator_id bigint default 0 not null comment '创建者ID',
  210. creator_name varchar(128) default '' not null comment '创建者名称',
  211. create_time datetime default CURRENT_TIMESTAMP(0) not null comment '创建时间',
  212. operator_id bigint default 0 not null comment '操作者ID',
  213. operator_name varchar(128) default '' not null comment '操作者名称',
  214. operate_time datetime default CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) not null comment '操作时间',
  215. deleted tinyint(4) default 0 not null comment '逻辑删除标识,0:未删除,1:已删除',
  216. INDEX idx_driver_id (driver_id) USING BTREE
  217. ) engine = InnoDB
  218. character set = utf8
  219. collate = utf8_general_ci
  220. comment = '模板配置信息表';
  221. -- ----------------------------
  222. -- Table structure for dc3_profile
  223. -- ----------------------------
  224. drop table if exists dc3_profile;
  225. create table dc3_profile
  226. (
  227. id bigint unsigned auto_increment primary key not null comment '主键ID',
  228. profile_name varchar(128) default '' not null comment '模板名称',
  229. profile_code varchar(128) default '' not null comment '模板编号',
  230. profile_share_flag tinyint(4) default 0 not null comment '模板共享类型标识',
  231. profile_type_flag tinyint(4) default 0 not null comment '模板类型标识',
  232. group_id bigint default 0 not null comment '分组ID',
  233. enable_flag tinyint(4) default 1 not null comment '使能标识',
  234. tenant_id bigint default 0 not null comment '租户ID',
  235. remark varchar(512) default '' not null comment '描述',
  236. creator_id bigint default 0 not null comment '创建者ID',
  237. creator_name varchar(128) default '' not null comment '创建者名称',
  238. create_time datetime default CURRENT_TIMESTAMP(0) not null comment '创建时间',
  239. operator_id bigint default 0 not null comment '操作者ID',
  240. operator_name varchar(128) default '' not null comment '操作者名称',
  241. operate_time datetime default CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) not null comment '操作时间',
  242. deleted tinyint(4) default 0 not null comment '逻辑删除标识,0:未删除,1:已删除',
  243. INDEX idx_profile_name (profile_name) USING BTREE,
  244. INDEX idx_profile_code (profile_code) USING BTREE
  245. ) engine = InnoDB
  246. character set = utf8
  247. collate = utf8_general_ci
  248. comment = '设备模板表';
  249. -- ----------------------------
  250. -- Table structure for dc3_point
  251. -- ----------------------------
  252. drop table if exists dc3_point;
  253. create table dc3_point
  254. (
  255. id bigint unsigned auto_increment primary key not null comment '主键ID',
  256. point_name varchar(128) default '' not null comment '位号名称',
  257. point_code varchar(128) default '' not null comment '位号编号',
  258. point_type_flag tinyint(4) default 0 not null comment '位号类型标识',
  259. rw_flag tinyint(4) default 0 not null comment '读写标识',
  260. base_value decimal(15, 6) default 0 not null comment '基础值',
  261. multiple decimal(15, 6) default 1 not null comment '比例系数',
  262. value_decimal tinyint(4) default 6 not null comment '数据精度',
  263. unit varchar(32) default '' not null comment '单位',
  264. profile_id bigint default 0 not null comment '模板ID',
  265. alarm_notify_profile_id bigint default 0 not null comment '报警通知模板ID',
  266. alarm_message_profile_id bigint default 0 not null comment '报警信息模板ID',
  267. group_id bigint default 0 not null comment '分组ID',
  268. enable_flag tinyint(4) default 1 not null comment '使能标识',
  269. tenant_id bigint default 0 not null comment '租户ID',
  270. remark varchar(512) default '' not null comment '描述',
  271. creator_id bigint default 0 not null comment '创建者ID',
  272. creator_name varchar(128) default '' not null comment '创建者名称',
  273. create_time datetime default CURRENT_TIMESTAMP(0) not null comment '创建时间',
  274. operator_id bigint default 0 not null comment '操作者ID',
  275. operator_name varchar(128) default '' not null comment '操作者名称',
  276. operate_time datetime default CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) not null comment '操作时间',
  277. deleted tinyint(4) default 0 not null comment '逻辑删除标识,0:未删除,1:已删除',
  278. INDEX idx_point_name (point_name) USING BTREE,
  279. INDEX idx_point_code (point_code) USING BTREE,
  280. INDEX idx_profile_id (profile_id) USING BTREE,
  281. INDEX idx_alarm_notify_profile_id (alarm_notify_profile_id) USING BTREE,
  282. INDEX idx_alarm_message_profile_id (alarm_message_profile_id) USING BTREE
  283. ) engine = InnoDB
  284. character set = utf8
  285. collate = utf8_general_ci
  286. comment = '设备位号表';
  287. -- ----------------------------
  288. -- Table structure for dc3_device
  289. -- ----------------------------
  290. drop table if exists dc3_device;
  291. create table dc3_device
  292. (
  293. id bigint unsigned auto_increment primary key not null comment '主键ID',
  294. device_name varchar(128) default '' not null comment '设备名称',
  295. device_code varchar(128) default '' not null comment '设备编号',
  296. driver_id bigint default 0 not null comment '驱动ID',
  297. group_id bigint default 0 not null comment '分组ID',
  298. enable_flag tinyint(4) default 1 not null comment '使能标识',
  299. tenant_id bigint default 0 not null comment '租户ID',
  300. remark varchar(512) default '' not null comment '描述',
  301. creator_id bigint default 0 not null comment '创建者ID',
  302. creator_name varchar(128) default '' not null comment '创建者名称',
  303. create_time datetime default CURRENT_TIMESTAMP(0) not null comment '创建时间',
  304. operator_id bigint default 0 not null comment '操作者ID',
  305. operator_name varchar(128) default '' not null comment '操作者名称',
  306. operate_time datetime default CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) not null comment '操作时间',
  307. deleted tinyint(4) default 0 not null comment '逻辑删除标识,0:未删除,1:已删除',
  308. INDEX idx_device_name (device_name) USING BTREE,
  309. INDEX idx_device_code (device_code) USING BTREE,
  310. INDEX idx_driver_id (driver_id) USING BTREE
  311. ) engine = InnoDB
  312. character set = utf8
  313. collate = utf8_general_ci
  314. comment = '设备表';
  315. -- ----------------------------
  316. -- Table structure for dc3_profile_bind
  317. -- ----------------------------
  318. drop table if exists dc3_profile_bind;
  319. create table dc3_profile_bind
  320. (
  321. id bigint unsigned auto_increment primary key not null comment '主键ID',
  322. profile_id bigint default 0 not null comment '模版ID',
  323. device_id bigint default 0 not null comment '设备ID',
  324. remark varchar(512) default '' not null comment '描述',
  325. creator_id bigint default 0 not null comment '创建者ID',
  326. creator_name varchar(128) default '' not null comment '创建者名称',
  327. create_time datetime default CURRENT_TIMESTAMP(0) not null comment '创建时间',
  328. operator_id bigint default 0 not null comment '操作者ID',
  329. operator_name varchar(128) default '' not null comment '操作者名称',
  330. operate_time datetime default CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) not null comment '操作时间',
  331. deleted tinyint(4) default 0 not null comment '逻辑删除标识,0:未删除,1:已删除',
  332. INDEX idx_profile_id (profile_id) USING BTREE,
  333. INDEX idx_device_id (device_id) USING BTREE
  334. ) engine = InnoDB
  335. character set = utf8
  336. collate = utf8_general_ci
  337. comment = '模板-设备关联表';
  338. -- ----------------------------
  339. -- Table structure for dc3_driver_attribute_config
  340. -- ----------------------------
  341. drop table if exists dc3_driver_attribute_config;
  342. create table dc3_driver_attribute_config
  343. (
  344. id bigint unsigned auto_increment primary key not null comment '主键ID',
  345. driver_attribute_id bigint default 0 not null comment '驱动配置ID',
  346. config_value varchar(128) default '' not null comment '驱动配置值',
  347. device_id bigint default 0 not null comment '设备ID',
  348. enable_flag tinyint(4) default 1 not null comment '使能标识',
  349. tenant_id bigint default 0 not null comment '租户ID',
  350. remark varchar(512) default '' not null comment '描述',
  351. creator_id bigint default 0 not null comment '创建者ID',
  352. creator_name varchar(128) default '' not null comment '创建者名称',
  353. create_time datetime default CURRENT_TIMESTAMP(0) not null comment '创建时间',
  354. operator_id bigint default 0 not null comment '操作者ID',
  355. operator_name varchar(128) default '' not null comment '操作者名称',
  356. operate_time datetime default CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) not null comment '操作时间',
  357. deleted tinyint(4) default 0 not null comment '逻辑删除标识,0:未删除,1:已删除',
  358. INDEX idx_driver_attribute_id (driver_attribute_id) USING BTREE,
  359. INDEX idx_device_id (device_id) USING BTREE
  360. ) engine = InnoDB
  361. character set = utf8
  362. collate = utf8_general_ci
  363. comment = '驱动属性配置表';
  364. -- ----------------------------
  365. -- Table structure for dc3_point_attribute_config
  366. -- ----------------------------
  367. drop table if exists dc3_point_attribute_config;
  368. create table dc3_point_attribute_config
  369. (
  370. id bigint unsigned auto_increment primary key not null comment '主键ID',
  371. point_attribute_id bigint default 0 not null comment '位号配置ID',
  372. config_value varchar(128) default '' not null comment '位号配置值',
  373. device_id bigint default 0 not null comment '设备ID',
  374. point_id bigint default 0 not null comment '位号ID',
  375. enable_flag tinyint(4) default 1 not null comment '使能标识',
  376. tenant_id bigint default 0 not null comment '租户ID',
  377. remark varchar(512) default '' not null comment '描述',
  378. creator_id bigint default 0 not null comment '创建者ID',
  379. creator_name varchar(128) default '' not null comment '创建者名称',
  380. create_time datetime default CURRENT_TIMESTAMP(0) not null comment '创建时间',
  381. operator_id bigint default 0 not null comment '操作者ID',
  382. operator_name varchar(128) default '' not null comment '操作者名称',
  383. operate_time datetime default CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) not null comment '操作时间',
  384. deleted tinyint(4) default 0 not null comment '逻辑删除标识,0:未删除,1:已删除',
  385. INDEX idx_point_attribute_id (point_attribute_id) USING BTREE,
  386. INDEX idx_device_id (device_id) USING BTREE,
  387. INDEX idx_point_id (point_id) USING BTREE
  388. ) engine = InnoDB
  389. character set = utf8
  390. collate = utf8_general_ci
  391. comment = '位号属性配置表';
  392. -- ----------------------------
  393. -- Table structure for dc3_alarm_notify_profile
  394. -- ----------------------------
  395. drop table if exists dc3_alarm_notify_profile;
  396. create table dc3_alarm_notify_profile
  397. (
  398. id bigint unsigned auto_increment primary key not null comment '主键ID',
  399. auto_confirm_flag tinyint(4) default 0 not null comment '自动确认标识',
  400. notify_interval bigint default 0 not null comment '通知间隔,毫秒',
  401. alarm_notify_ext json not null comment '报警通知拓展信息',
  402. enable_flag tinyint(4) default 1 not null comment '使能标识',
  403. tenant_id bigint default 0 not null comment '租户ID',
  404. remark varchar(512) default '' not null comment '描述',
  405. creator_id bigint default 0 not null comment '创建者ID',
  406. creator_name varchar(128) default '' not null comment '创建者名称',
  407. create_time datetime default CURRENT_TIMESTAMP(0) not null comment '创建时间',
  408. operator_id bigint default 0 not null comment '操作者ID',
  409. operator_name varchar(128) default '' not null comment '操作者名称',
  410. operate_time datetime default CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) not null comment '操作时间',
  411. deleted tinyint(4) default 0 not null comment '逻辑删除标识,0:未删除,1:已删除'
  412. ) engine = InnoDB
  413. character set = utf8
  414. collate = utf8_general_ci
  415. comment = '报警通知模板表';
  416. -- ----------------------------
  417. -- Table structure for dc3_alarm_message_profile
  418. -- ----------------------------
  419. drop table if exists dc3_alarm_message_profile;
  420. create table dc3_alarm_message_profile
  421. (
  422. id bigint unsigned auto_increment primary key not null comment '主键ID',
  423. alarm_title varchar(512) default '' not null comment '报警标题',
  424. alarm_level tinyint(4) default 0 not null comment '报警等级',
  425. alarm_content varchar(512) default '' not null comment '报警内容',
  426. alarm_content_ext json not null comment '报警内容拓展信息',
  427. enable_flag tinyint(4) default 1 not null comment '使能标识',
  428. tenant_id bigint default 0 not null comment '租户ID',
  429. remark varchar(512) default '' not null comment '描述',
  430. creator_id bigint default 0 not null comment '创建者ID',
  431. creator_name varchar(128) default '' not null comment '创建者名称',
  432. create_time datetime default CURRENT_TIMESTAMP(0) not null comment '创建时间',
  433. operator_id bigint default 0 not null comment '操作者ID',
  434. operator_name varchar(128) default '' not null comment '操作者名称',
  435. operate_time datetime default CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) not null comment '操作时间',
  436. deleted tinyint(4) default 0 not null comment '逻辑删除标识,0:未删除,1:已删除'
  437. ) engine = InnoDB
  438. character set = utf8
  439. collate = utf8_general_ci
  440. comment = '报警信息模板表';
  441. -- ----------------------------
  442. -- Table structure for dc3_alarm_rule
  443. -- ----------------------------
  444. drop table if exists dc3_alarm_rule;
  445. create table dc3_alarm_rule
  446. (
  447. id bigint unsigned auto_increment primary key not null comment '主键ID',
  448. point_id bigint default 0 not null comment '位号ID',
  449. alarm_type_flag tinyint(4) default 0 not null comment '报警类型标识',
  450. alarm_rule_ext json not null comment '报警规则拓展信息',
  451. enable_flag tinyint(4) default 1 not null comment '使能标识',
  452. tenant_id bigint default 0 not null comment '租户ID',
  453. remark varchar(512) default '' not null comment '描述',
  454. creator_id bigint default 0 not null comment '创建者ID',
  455. creator_name varchar(128) default '' not null comment '创建者名称',
  456. create_time datetime default CURRENT_TIMESTAMP(0) not null comment '创建时间',
  457. operator_id bigint default 0 not null comment '操作者ID',
  458. operator_name varchar(128) default '' not null comment '操作者名称',
  459. operate_time datetime default CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) not null comment '操作时间',
  460. deleted tinyint(4) default 0 not null comment '逻辑删除标识,0:未删除,1:已删除',
  461. INDEX idx_point_id (point_id) USING BTREE
  462. ) engine = InnoDB
  463. character set = utf8
  464. collate = utf8_general_ci
  465. comment = '报警规则表';
  466. -- ----------------------------
  467. -- Table structure for dc3_role
  468. -- ----------------------------
  469. drop table if exists dc3_role;
  470. create table dc3_role
  471. (
  472. id bigint unsigned auto_increment primary key not null comment '主键ID',
  473. parent_role_id bigint default 0 not null comment '角色父级ID',
  474. role_name varchar(128) default '' not null comment '角色名称',
  475. role_code varchar(128) default '' not null comment '角色编号',
  476. enable_flag tinyint(4) default 1 not null comment '使能标识',
  477. tenant_id bigint default 0 not null comment '租户ID',
  478. remark varchar(512) default '' not null comment '描述',
  479. creator_id bigint default 0 not null comment '创建者ID',
  480. creator_name varchar(128) default '' not null comment '创建者名称',
  481. create_time datetime default CURRENT_TIMESTAMP(0) not null comment '创建时间',
  482. operator_id bigint default 0 not null comment '操作者ID',
  483. operator_name varchar(128) default '' not null comment '操作者名称',
  484. operate_time datetime default CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) not null comment '操作时间',
  485. deleted tinyint(4) default 0 not null comment '逻辑删除标识,0:未删除,1:已删除',
  486. INDEX idx_parent_role_id (parent_role_id) USING BTREE,
  487. INDEX idx_role_name (role_name) USING BTREE,
  488. INDEX idx_role_code (role_code) USING BTREE
  489. ) engine = InnoDB
  490. character set = utf8
  491. collate = utf8_general_ci
  492. comment = '角色表';
  493. -- ----------------------------
  494. -- Table structure for dc3_resource
  495. -- ----------------------------
  496. drop table if exists dc3_resource;
  497. create table dc3_resource
  498. (
  499. id bigint unsigned auto_increment primary key not null comment '主键ID',
  500. parent_resource_id bigint default 0 not null comment '权限资源父级ID',
  501. resource_name varchar(128) default '' not null comment '权限资源名称',
  502. resource_code varchar(128) default '' not null comment '权限资源编号',
  503. resource_type_flag tinyint(4) default 0 not null comment '权限资源类型标识',
  504. resource_scope_flag tinyint(4) default 0 not null comment '权限资源范围标识',
  505. entity_id bigint default 0 not null comment '权限资源实体ID',
  506. enable_flag tinyint(4) default 1 not null comment '使能标识',
  507. tenant_id bigint default 0 not null comment '租户ID',
  508. remark varchar(512) default '' not null comment '描述',
  509. creator_id bigint default 0 not null comment '创建者ID',
  510. creator_name varchar(128) default '' not null comment '创建者名称',
  511. create_time datetime default CURRENT_TIMESTAMP(0) not null comment '创建时间',
  512. operator_id bigint default 0 not null comment '操作者ID',
  513. operator_name varchar(128) default '' not null comment '操作者名称',
  514. operate_time datetime default CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) not null comment '操作时间',
  515. deleted tinyint(4) default 0 not null comment '逻辑删除标识,0:未删除,1:已删除',
  516. INDEX idx_parent_resource_id (parent_resource_id) USING BTREE,
  517. INDEX idx_resource_name (resource_name) USING BTREE,
  518. INDEX idx_resource_code (resource_code) USING BTREE,
  519. INDEX idx_entity_id (entity_id) USING BTREE
  520. ) engine = InnoDB
  521. character set = utf8
  522. collate = utf8_general_ci
  523. comment = '权限资源表';
  524. -- ----------------------------
  525. -- Table structure for dc3_role_user_bind
  526. -- ----------------------------
  527. drop table if exists dc3_role_user_bind;
  528. create table dc3_role_user_bind
  529. (
  530. id bigint unsigned auto_increment primary key not null comment '主键ID',
  531. role_id bigint default 0 not null comment '角色ID',
  532. user_id bigint default 0 not null comment '用户ID',
  533. remark varchar(512) default '' not null comment '描述',
  534. creator_id bigint default 0 not null comment '创建者ID',
  535. creator_name varchar(128) default '' not null comment '创建者名称',
  536. create_time datetime default CURRENT_TIMESTAMP(0) not null comment '创建时间',
  537. operator_id bigint default 0 not null comment '操作者ID',
  538. operator_name varchar(128) default '' not null comment '操作者名称',
  539. operate_time datetime default CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) not null comment '操作时间',
  540. deleted tinyint(4) default 0 not null comment '逻辑删除标识,0:未删除,1:已删除',
  541. INDEX idx_role_id (role_id) USING BTREE,
  542. INDEX idx_user_id (user_id) USING BTREE
  543. ) engine = InnoDB
  544. character set = utf8
  545. collate = utf8_general_ci
  546. comment = '角色-用户关联表';
  547. -- ----------------------------
  548. -- Table structure for dc3_role_resource_bind
  549. -- ----------------------------
  550. drop table if exists dc3_role_resource_bind;
  551. create table dc3_role_resource_bind
  552. (
  553. id bigint unsigned auto_increment primary key not null comment '主键ID',
  554. role_id bigint default 0 not null comment '权限资源ID',
  555. resource_id bigint default 0 not null comment '权限资源ID',
  556. remark varchar(512) default '' not null comment '描述',
  557. creator_id bigint default 0 not null comment '创建者ID',
  558. creator_name varchar(128) default '' not null comment '创建者名称',
  559. create_time datetime default CURRENT_TIMESTAMP(0) not null comment '创建时间',
  560. operator_id bigint default 0 not null comment '操作者ID',
  561. operator_name varchar(128) default '' not null comment '操作者名称',
  562. operate_time datetime default CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) not null comment '操作时间',
  563. deleted tinyint(4) default 0 not null comment '逻辑删除标识,0:未删除,1:已删除',
  564. INDEX idx_role_id (role_id) USING BTREE,
  565. INDEX idx_resource_id (resource_id) USING BTREE
  566. ) engine = InnoDB
  567. character set = utf8
  568. collate = utf8_general_ci
  569. comment = '角色-权限资源关联表';
  570. -- ----------------------------
  571. -- Table structure for dc3_api
  572. -- ----------------------------
  573. drop table if exists dc3_api;
  574. create table dc3_api
  575. (
  576. id bigint unsigned auto_increment primary key not null comment '主键ID',
  577. api_type_flag tinyint(4) default 0 not null comment 'Api接口类型标识',
  578. api_name varchar(128) default '' not null comment 'Api接口名称',
  579. api_code varchar(256) default '' not null comment 'Api接口编号,一般为URL的MD5编码',
  580. api_ext json not null comment 'Api接口拓展信息',
  581. enable_flag tinyint(4) default 1 not null comment '使能标识',
  582. tenant_id bigint default 0 not null comment '租户ID',
  583. remark varchar(512) default '' not null comment '描述',
  584. creator_id bigint default 0 not null comment '创建者ID',
  585. creator_name varchar(128) default '' not null comment '创建者名称',
  586. create_time datetime default CURRENT_TIMESTAMP(0) not null comment '创建时间',
  587. operator_id bigint default 0 not null comment '操作者ID',
  588. operator_name varchar(128) default '' not null comment '操作者名称',
  589. operate_time datetime default CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) not null comment '操作时间',
  590. deleted tinyint(4) default 0 not null comment '逻辑删除标识,0:未删除,1:已删除',
  591. INDEX idx_api_name (api_name) USING BTREE,
  592. INDEX idx_api_code (api_code) USING BTREE
  593. ) engine = InnoDB
  594. character set = utf8
  595. collate = utf8_general_ci
  596. comment = '接口表';
  597. -- ----------------------------
  598. -- Table structure for dc3_menu
  599. -- ----------------------------
  600. drop table if exists dc3_menu;
  601. create table dc3_menu
  602. (
  603. id bigint unsigned auto_increment primary key not null comment '主键ID',
  604. parent_menu_id bigint default 0 not null comment '菜单父级ID',
  605. menu_type_flag tinyint(4) default 0 not null comment '菜单类型标识',
  606. menu_name varchar(128) default '' not null comment '菜单名称',
  607. menu_code varchar(256) default '' not null comment '菜单编号,一般为URL的MD5编码',
  608. menu_level tinyint(4) default 0 not null comment '菜单层级',
  609. menu_index tinyint(4) default 0 not null comment '菜单顺序',
  610. menu_ext json not null comment '菜单拓展信息',
  611. enable_flag tinyint(4) default 1 not null comment '使能标识',
  612. tenant_id bigint default 0 not null comment '租户ID',
  613. remark varchar(512) default '' not null comment '描述',
  614. creator_id bigint default 0 not null comment '创建者ID',
  615. creator_name varchar(128) default '' not null comment '创建者名称',
  616. create_time datetime default CURRENT_TIMESTAMP(0) not null comment '创建时间',
  617. operator_id bigint default 0 not null comment '操作者ID',
  618. operator_name varchar(128) default '' not null comment '操作者名称',
  619. operate_time datetime default CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) not null comment '操作时间',
  620. deleted tinyint(4) default 0 not null comment '逻辑删除标识,0:未删除,1:已删除',
  621. INDEX idx_parent_menu_id (parent_menu_id) USING BTREE,
  622. INDEX idx_menu_name (menu_name) USING BTREE,
  623. INDEX idx_menu_code (menu_code) USING BTREE
  624. ) engine = InnoDB
  625. character set = utf8
  626. collate = utf8_general_ci
  627. comment = '菜单表';
  628. -- ----------------------------
  629. -- Table structure for dc3_label
  630. -- ----------------------------
  631. drop table if exists dc3_label;
  632. create table dc3_label
  633. (
  634. id bigint unsigned auto_increment primary key not null comment '主键ID',
  635. label_name varchar(128) default '' not null comment '标签名称',
  636. color varchar(128) default '' not null comment '标签颜色',
  637. entity_type_flag tinyint(4) default 0 not null comment '实体类型标识',
  638. enable_flag tinyint(4) default 1 not null comment '使能标识',
  639. tenant_id bigint default 0 not null comment '租户ID',
  640. remark varchar(512) default '' not null comment '描述',
  641. creator_id bigint default 0 not null comment '创建者ID',
  642. creator_name varchar(128) default '' not null comment '创建者名称',
  643. create_time datetime default CURRENT_TIMESTAMP(0) not null comment '创建时间',
  644. operator_id bigint default 0 not null comment '操作者ID',
  645. operator_name varchar(128) default '' not null comment '操作者名称',
  646. operate_time datetime default CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) not null comment '操作时间',
  647. deleted tinyint(4) default 0 not null comment '逻辑删除标识,0:未删除,1:已删除',
  648. INDEX idx_label_name (label_name) USING BTREE
  649. ) engine = InnoDB
  650. character set = utf8
  651. collate = utf8_general_ci
  652. comment = '标签表';
  653. -- ----------------------------
  654. -- Table structure for dc3_label_bind
  655. -- ----------------------------
  656. drop table if exists dc3_label_bind;
  657. create table dc3_label_bind
  658. (
  659. id bigint unsigned auto_increment primary key not null comment '主键ID',
  660. label_id bigint default 0 not null comment '标签ID',
  661. entity_id bigint default 0 not null comment '实体ID',
  662. remark varchar(512) default '' not null comment '描述',
  663. creator_id bigint default 0 not null comment '创建者ID',
  664. creator_name varchar(128) default '' not null comment '创建者名称',
  665. create_time datetime default CURRENT_TIMESTAMP(0) not null comment '创建时间',
  666. operator_id bigint default 0 not null comment '操作者ID',
  667. operator_name varchar(128) default '' not null comment '操作者名称',
  668. operate_time datetime default CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) not null comment '操作时间',
  669. deleted tinyint(4) default 0 not null comment '逻辑删除标识,0:未删除,1:已删除',
  670. INDEX idx_label_id (label_id) USING BTREE,
  671. INDEX idx_entity_id (entity_id) USING BTREE
  672. ) engine = InnoDB
  673. character set = utf8
  674. collate = utf8_general_ci
  675. comment = '标签关联表';
  676. -- ----------------------------
  677. -- Table structure for dc3_group
  678. -- ----------------------------
  679. drop table if exists dc3_group;
  680. create table dc3_group
  681. (
  682. id bigint unsigned auto_increment primary key not null comment '主键ID',
  683. parent_group_id bigint default 0 not null comment '父分组ID',
  684. group_name varchar(128) default '' not null comment '分组名称',
  685. position int(10) default 0 not null comment '分组排序位置',
  686. enable_flag tinyint(4) default 1 not null comment '使能标识',
  687. tenant_id bigint default 0 not null comment '租户ID',
  688. remark varchar(512) default '' not null comment '描述',
  689. creator_id bigint default 0 not null comment '创建者ID',
  690. creator_name varchar(128) default '' not null comment '创建者名称',
  691. create_time datetime default CURRENT_TIMESTAMP(0) not null comment '创建时间',
  692. operator_id bigint default 0 not null comment '操作者ID',
  693. operator_name varchar(128) default '' not null comment '操作者名称',
  694. operate_time datetime default CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) not null comment '操作时间',
  695. deleted tinyint(4) default 0 not null comment '逻辑删除标识,0:未删除,1:已删除',
  696. INDEX idx_group_id (parent_group_id) USING BTREE,
  697. INDEX idx_group_name (group_name) USING BTREE
  698. ) engine = InnoDB
  699. character set = utf8
  700. collate = utf8_general_ci
  701. comment = '分组表';
  702. -- ----------------------------
  703. -- Table structure for dc3_black_ip
  704. -- ----------------------------
  705. drop table if exists dc3_black_ip;
  706. create table dc3_black_ip
  707. (
  708. id bigint unsigned auto_increment primary key not null comment '主键ID',
  709. ip varchar(128) default '' not null comment '黑IP',
  710. enable_flag tinyint(4) default 1 not null comment '使能标识',
  711. tenant_id bigint default 0 not null comment '租户ID',
  712. remark varchar(512) default '' not null comment '描述',
  713. creator_id bigint default 0 not null comment '创建者ID',
  714. creator_name varchar(128) default '' not null comment '创建者名称',
  715. create_time datetime default CURRENT_TIMESTAMP(0) not null comment '创建时间',
  716. operator_id bigint default 0 not null comment '操作者ID',
  717. operator_name varchar(128) default '' not null comment '操作者名称',
  718. operate_time datetime default CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) not null comment '操作时间',
  719. deleted tinyint(4) default 0 not null comment '逻辑删除标识,0:未删除,1:已删除',
  720. INDEX idx_ip (ip) USING BTREE
  721. ) engine = InnoDB
  722. character set = utf8
  723. collate = utf8_general_ci
  724. comment = 'Ip黑名单表';
  725. -- ----------------------------
  726. -- Records of dc3_tenant
  727. -- ----------------------------
  728. INSERT INTO dc3_tenant
  729. VALUES (1, '', 'default', 1, '租户', 0, 'dc3', '2016-10-01 00:00:00', 0, 'dc3', '2016-10-01 00:00:00', 0);
  730. -- ----------------------------
  731. -- Records of dc3_user_login
  732. -- ----------------------------
  733. INSERT INTO dc3_user_login
  734. VALUES (1, 'pnoker', 1, 1, 1, '用户', 0, 'dc3', '2016-10-01 00:00:00', 0, 'dc3', '2016-10-01 00:00:00', 0);
  735. -- ----------------------------
  736. -- Records of dc3_user
  737. -- user: dc3
  738. -- password: dc3
  739. -- ----------------------------
  740. INSERT INTO dc3_user_password
  741. VALUES (1, '10e339be1130a90dc1b9ff0332abced6', '用户密码', 0, 'dc3', '2016-10-01 00:00:00', 0, 'dc3',
  742. '2016-10-01 00:00:00', 0);
  743. -- ----------------------------
  744. -- Records of dc3_user
  745. -- ----------------------------
  746. INSERT INTO dc3_user
  747. VALUES (1, '张红元', 'pnoker', '18304071393', 'pnokers@icloud.com', '{}', '{}', '用户信息', 0, 'dc3',
  748. '2016-10-01 00:00:00', 0, 'dc3', '2016-10-01 00:00:00', 0);
  749. -- ----------------------------
  750. -- Records of dc3_tenant_bind
  751. -- ----------------------------
  752. INSERT INTO dc3_tenant_bind
  753. VALUES (1, 1, 1, '租户,用户关联', 0, 'dc3', '2016-10-01 00:00:00', 0, 'dc3', '2016-10-01 00:00:00', 0);
  754. SET FOREIGN_KEY_CHECKS = 1;