提交 | 用户 | 时间
|
e720d5
|
1 |
CREATE database if NOT EXISTS `iailab_test_data` default character set utf8mb4 collate utf8mb4_general_ci; |
潘 |
2 |
USE `iailab_test_data`; |
|
3 |
|
|
4 |
|
|
5 |
-- 定时任务 |
|
6 |
CREATE TABLE schedule_job |
|
7 |
( |
|
8 |
id bigint NOT NULL COMMENT 'id', |
|
9 |
bean_name varchar(200) DEFAULT NULL COMMENT 'spring bean名称', |
|
10 |
params varchar(2000) DEFAULT NULL COMMENT '参数', |
|
11 |
cron_expression varchar(100) DEFAULT NULL COMMENT 'cron表达式', |
|
12 |
status tinyint unsigned COMMENT '任务状态 0:暂停 1:正常', |
|
13 |
remark varchar(255) DEFAULT NULL COMMENT '备注', |
|
14 |
creator bigint COMMENT '创建者', |
|
15 |
create_date datetime COMMENT '创建时间', |
|
16 |
updater bigint COMMENT '更新者', |
|
17 |
update_date datetime COMMENT '更新时间', |
|
18 |
PRIMARY KEY (id), |
|
19 |
key idx_create_date (create_date) |
|
20 |
) ENGINE = InnoDB |
|
21 |
DEFAULT CHARSET = utf8mb4 COMMENT ='定时任务'; |
|
22 |
|
|
23 |
-- 定时任务日志 |
|
24 |
CREATE TABLE schedule_job_log |
|
25 |
( |
|
26 |
id bigint NOT NULL COMMENT 'id', |
|
27 |
job_id bigint NOT NULL COMMENT '任务id', |
|
28 |
bean_name varchar(200) DEFAULT NULL COMMENT 'spring bean名称', |
|
29 |
params varchar(2000) DEFAULT NULL COMMENT '参数', |
|
30 |
status tinyint unsigned NOT NULL COMMENT '任务状态 0:失败 1:成功', |
|
31 |
error varchar(2000) DEFAULT NULL COMMENT '失败信息', |
|
32 |
times int NOT NULL COMMENT '耗时(单位:毫秒)', |
|
33 |
create_date datetime COMMENT '创建时间', |
|
34 |
PRIMARY KEY (id), |
|
35 |
key idx_job_id (job_id), |
|
36 |
key idx_create_date (create_date) |
|
37 |
) ENGINE = InnoDB |
|
38 |
DEFAULT CHARSET = utf8mb4 COMMENT ='定时任务日志'; |
|
39 |
|
|
40 |
-- quartz自带表结构 |
|
41 |
CREATE TABLE QRTZ_JOB_DETAILS |
|
42 |
( |
|
43 |
SCHED_NAME VARCHAR(120) NOT NULL, |
|
44 |
JOB_NAME VARCHAR(200) NOT NULL, |
|
45 |
JOB_GROUP VARCHAR(200) NOT NULL, |
|
46 |
DESCRIPTION VARCHAR(250) NULL, |
|
47 |
JOB_CLASS_NAME VARCHAR(250) NOT NULL, |
|
48 |
IS_DURABLE VARCHAR(1) NOT NULL, |
|
49 |
IS_NONCONCURRENT VARCHAR(1) NOT NULL, |
|
50 |
IS_UPDATE_DATA VARCHAR(1) NOT NULL, |
|
51 |
REQUESTS_RECOVERY VARCHAR(1) NOT NULL, |
|
52 |
JOB_DATA BLOB NULL, |
|
53 |
PRIMARY KEY (SCHED_NAME, JOB_NAME, JOB_GROUP) |
|
54 |
) |
|
55 |
ENGINE = InnoDB |
|
56 |
DEFAULT CHARSET = utf8; |
|
57 |
|
|
58 |
CREATE TABLE QRTZ_TRIGGERS |
|
59 |
( |
|
60 |
SCHED_NAME VARCHAR(120) NOT NULL, |
|
61 |
TRIGGER_NAME VARCHAR(200) NOT NULL, |
|
62 |
TRIGGER_GROUP VARCHAR(200) NOT NULL, |
|
63 |
JOB_NAME VARCHAR(200) NOT NULL, |
|
64 |
JOB_GROUP VARCHAR(200) NOT NULL, |
|
65 |
DESCRIPTION VARCHAR(250) NULL, |
|
66 |
NEXT_FIRE_TIME BIGINT(13) NULL, |
|
67 |
PREV_FIRE_TIME BIGINT(13) NULL, |
|
68 |
PRIORITY INTEGER NULL, |
|
69 |
TRIGGER_STATE VARCHAR(16) NOT NULL, |
|
70 |
TRIGGER_TYPE VARCHAR(8) NOT NULL, |
|
71 |
START_TIME BIGINT(13) NOT NULL, |
|
72 |
END_TIME BIGINT(13) NULL, |
|
73 |
CALENDAR_NAME VARCHAR(200) NULL, |
|
74 |
MISFIRE_INSTR SMALLINT(2) NULL, |
|
75 |
JOB_DATA BLOB NULL, |
|
76 |
PRIMARY KEY (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP), |
|
77 |
FOREIGN KEY (SCHED_NAME, JOB_NAME, JOB_GROUP) |
|
78 |
REFERENCES QRTZ_JOB_DETAILS (SCHED_NAME, JOB_NAME, JOB_GROUP) |
|
79 |
) |
|
80 |
ENGINE = InnoDB |
|
81 |
DEFAULT CHARSET = utf8; |
|
82 |
|
|
83 |
CREATE TABLE QRTZ_SIMPLE_TRIGGERS |
|
84 |
( |
|
85 |
SCHED_NAME VARCHAR(120) NOT NULL, |
|
86 |
TRIGGER_NAME VARCHAR(200) NOT NULL, |
|
87 |
TRIGGER_GROUP VARCHAR(200) NOT NULL, |
|
88 |
REPEAT_COUNT BIGINT(7) NOT NULL, |
|
89 |
REPEAT_INTERVAL BIGINT(12) NOT NULL, |
|
90 |
TIMES_TRIGGERED BIGINT(10) NOT NULL, |
|
91 |
PRIMARY KEY (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP), |
|
92 |
FOREIGN KEY (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP) |
|
93 |
REFERENCES QRTZ_TRIGGERS (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP) |
|
94 |
) |
|
95 |
ENGINE = InnoDB |
|
96 |
DEFAULT CHARSET = utf8; |
|
97 |
|
|
98 |
CREATE TABLE QRTZ_CRON_TRIGGERS |
|
99 |
( |
|
100 |
SCHED_NAME VARCHAR(120) NOT NULL, |
|
101 |
TRIGGER_NAME VARCHAR(200) NOT NULL, |
|
102 |
TRIGGER_GROUP VARCHAR(200) NOT NULL, |
|
103 |
CRON_EXPRESSION VARCHAR(120) NOT NULL, |
|
104 |
TIME_ZONE_ID VARCHAR(80), |
|
105 |
PRIMARY KEY (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP), |
|
106 |
FOREIGN KEY (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP) |
|
107 |
REFERENCES QRTZ_TRIGGERS (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP) |
|
108 |
) |
|
109 |
ENGINE = InnoDB |
|
110 |
DEFAULT CHARSET = utf8; |
|
111 |
|
|
112 |
CREATE TABLE QRTZ_SIMPROP_TRIGGERS |
|
113 |
( |
|
114 |
SCHED_NAME VARCHAR(120) NOT NULL, |
|
115 |
TRIGGER_NAME VARCHAR(200) NOT NULL, |
|
116 |
TRIGGER_GROUP VARCHAR(200) NOT NULL, |
|
117 |
STR_PROP_1 VARCHAR(512) NULL, |
|
118 |
STR_PROP_2 VARCHAR(512) NULL, |
|
119 |
STR_PROP_3 VARCHAR(512) NULL, |
|
120 |
INT_PROP_1 INT NULL, |
|
121 |
INT_PROP_2 INT NULL, |
|
122 |
LONG_PROP_1 BIGINT NULL, |
|
123 |
LONG_PROP_2 BIGINT NULL, |
|
124 |
DEC_PROP_1 NUMERIC(13, 4) NULL, |
|
125 |
DEC_PROP_2 NUMERIC(13, 4) NULL, |
|
126 |
BOOL_PROP_1 VARCHAR(1) NULL, |
|
127 |
BOOL_PROP_2 VARCHAR(1) NULL, |
|
128 |
PRIMARY KEY (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP), |
|
129 |
FOREIGN KEY (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP) |
|
130 |
REFERENCES QRTZ_TRIGGERS (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP) |
|
131 |
) |
|
132 |
ENGINE = InnoDB |
|
133 |
DEFAULT CHARSET = utf8; |
|
134 |
|
|
135 |
CREATE TABLE QRTZ_BLOB_TRIGGERS |
|
136 |
( |
|
137 |
SCHED_NAME VARCHAR(120) NOT NULL, |
|
138 |
TRIGGER_NAME VARCHAR(200) NOT NULL, |
|
139 |
TRIGGER_GROUP VARCHAR(200) NOT NULL, |
|
140 |
BLOB_DATA BLOB NULL, |
|
141 |
PRIMARY KEY (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP), |
|
142 |
INDEX (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP), |
|
143 |
FOREIGN KEY (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP) |
|
144 |
REFERENCES QRTZ_TRIGGERS (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP) |
|
145 |
) |
|
146 |
ENGINE = InnoDB |
|
147 |
DEFAULT CHARSET = utf8; |
|
148 |
|
|
149 |
CREATE TABLE QRTZ_CALENDARS |
|
150 |
( |
|
151 |
SCHED_NAME VARCHAR(120) NOT NULL, |
|
152 |
CALENDAR_NAME VARCHAR(200) NOT NULL, |
|
153 |
CALENDAR BLOB NOT NULL, |
|
154 |
PRIMARY KEY (SCHED_NAME, CALENDAR_NAME) |
|
155 |
) |
|
156 |
ENGINE = InnoDB |
|
157 |
DEFAULT CHARSET = utf8; |
|
158 |
|
|
159 |
CREATE TABLE QRTZ_PAUSED_TRIGGER_GRPS |
|
160 |
( |
|
161 |
SCHED_NAME VARCHAR(120) NOT NULL, |
|
162 |
TRIGGER_GROUP VARCHAR(200) NOT NULL, |
|
163 |
PRIMARY KEY (SCHED_NAME, TRIGGER_GROUP) |
|
164 |
) |
|
165 |
ENGINE = InnoDB |
|
166 |
DEFAULT CHARSET = utf8; |
|
167 |
|
|
168 |
CREATE TABLE QRTZ_FIRED_TRIGGERS |
|
169 |
( |
|
170 |
SCHED_NAME VARCHAR(120) NOT NULL, |
|
171 |
ENTRY_ID VARCHAR(95) NOT NULL, |
|
172 |
TRIGGER_NAME VARCHAR(200) NOT NULL, |
|
173 |
TRIGGER_GROUP VARCHAR(200) NOT NULL, |
|
174 |
INSTANCE_NAME VARCHAR(200) NOT NULL, |
|
175 |
FIRED_TIME BIGINT(13) NOT NULL, |
|
176 |
SCHED_TIME BIGINT(13) NOT NULL, |
|
177 |
PRIORITY INTEGER NOT NULL, |
|
178 |
STATE VARCHAR(16) NOT NULL, |
|
179 |
JOB_NAME VARCHAR(200) NULL, |
|
180 |
JOB_GROUP VARCHAR(200) NULL, |
|
181 |
IS_NONCONCURRENT VARCHAR(1) NULL, |
|
182 |
REQUESTS_RECOVERY VARCHAR(1) NULL, |
|
183 |
PRIMARY KEY (SCHED_NAME, ENTRY_ID) |
|
184 |
) |
|
185 |
ENGINE = InnoDB |
|
186 |
DEFAULT CHARSET = utf8; |
|
187 |
|
|
188 |
CREATE TABLE QRTZ_SCHEDULER_STATE |
|
189 |
( |
|
190 |
SCHED_NAME VARCHAR(120) NOT NULL, |
|
191 |
INSTANCE_NAME VARCHAR(200) NOT NULL, |
|
192 |
LAST_CHECKIN_TIME BIGINT(13) NOT NULL, |
|
193 |
CHECKIN_INTERVAL BIGINT(13) NOT NULL, |
|
194 |
PRIMARY KEY (SCHED_NAME, INSTANCE_NAME) |
|
195 |
) |
|
196 |
ENGINE = InnoDB |
|
197 |
DEFAULT CHARSET = utf8; |
|
198 |
|
|
199 |
CREATE TABLE QRTZ_LOCKS |
|
200 |
( |
|
201 |
SCHED_NAME VARCHAR(120) NOT NULL, |
|
202 |
LOCK_NAME VARCHAR(40) NOT NULL, |
|
203 |
PRIMARY KEY (SCHED_NAME, LOCK_NAME) |
|
204 |
) |
|
205 |
ENGINE = InnoDB |
|
206 |
DEFAULT CHARSET = utf8; |
|
207 |
|
|
208 |
CREATE INDEX IDX_QRTZ_J_REQ_RECOVERY ON QRTZ_JOB_DETAILS (SCHED_NAME, REQUESTS_RECOVERY); |
|
209 |
CREATE INDEX IDX_QRTZ_J_GRP ON QRTZ_JOB_DETAILS (SCHED_NAME, JOB_GROUP); |
|
210 |
|
|
211 |
CREATE INDEX IDX_QRTZ_T_J ON QRTZ_TRIGGERS (SCHED_NAME, JOB_NAME, JOB_GROUP); |
|
212 |
CREATE INDEX IDX_QRTZ_T_JG ON QRTZ_TRIGGERS (SCHED_NAME, JOB_GROUP); |
|
213 |
CREATE INDEX IDX_QRTZ_T_C ON QRTZ_TRIGGERS (SCHED_NAME, CALENDAR_NAME); |
|
214 |
CREATE INDEX IDX_QRTZ_T_G ON QRTZ_TRIGGERS (SCHED_NAME, TRIGGER_GROUP); |
|
215 |
CREATE INDEX IDX_QRTZ_T_STATE ON QRTZ_TRIGGERS (SCHED_NAME, TRIGGER_STATE); |
|
216 |
CREATE INDEX IDX_QRTZ_T_N_STATE ON QRTZ_TRIGGERS (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP, TRIGGER_STATE); |
|
217 |
CREATE INDEX IDX_QRTZ_T_N_G_STATE ON QRTZ_TRIGGERS (SCHED_NAME, TRIGGER_GROUP, TRIGGER_STATE); |
|
218 |
CREATE INDEX IDX_QRTZ_T_NEXT_FIRE_TIME ON QRTZ_TRIGGERS (SCHED_NAME, NEXT_FIRE_TIME); |
|
219 |
CREATE INDEX IDX_QRTZ_T_NFT_ST ON QRTZ_TRIGGERS (SCHED_NAME, TRIGGER_STATE, NEXT_FIRE_TIME); |
|
220 |
CREATE INDEX IDX_QRTZ_T_NFT_MISFIRE ON QRTZ_TRIGGERS (SCHED_NAME, MISFIRE_INSTR, NEXT_FIRE_TIME); |
|
221 |
CREATE INDEX IDX_QRTZ_T_NFT_ST_MISFIRE ON QRTZ_TRIGGERS (SCHED_NAME, MISFIRE_INSTR, NEXT_FIRE_TIME, TRIGGER_STATE); |
|
222 |
CREATE INDEX IDX_QRTZ_T_NFT_ST_MISFIRE_GRP ON QRTZ_TRIGGERS (SCHED_NAME, MISFIRE_INSTR, NEXT_FIRE_TIME, TRIGGER_GROUP, |
|
223 |
TRIGGER_STATE); |
|
224 |
|
|
225 |
CREATE INDEX IDX_QRTZ_FT_TRIG_INST_NAME ON QRTZ_FIRED_TRIGGERS (SCHED_NAME, INSTANCE_NAME); |
|
226 |
CREATE INDEX IDX_QRTZ_FT_INST_JOB_REQ_RCVRY ON QRTZ_FIRED_TRIGGERS (SCHED_NAME, INSTANCE_NAME, REQUESTS_RECOVERY); |
|
227 |
CREATE INDEX IDX_QRTZ_FT_J_G ON QRTZ_FIRED_TRIGGERS (SCHED_NAME, JOB_NAME, JOB_GROUP); |
|
228 |
CREATE INDEX IDX_QRTZ_FT_JG ON QRTZ_FIRED_TRIGGERS (SCHED_NAME, JOB_GROUP); |
|
229 |
CREATE INDEX IDX_QRTZ_FT_T_G ON QRTZ_FIRED_TRIGGERS (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP); |
|
230 |
CREATE INDEX IDX_QRTZ_FT_TG ON QRTZ_FIRED_TRIGGERS (SCHED_NAME, TRIGGER_GROUP); |
|
231 |
|
|
232 |
-- data |
|
233 |
CREATE TABLE `t_channel_opcda_device` ( |
|
234 |
`id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'id', |
|
235 |
`server_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '服务名', |
|
236 |
`host` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT 'ip', |
|
237 |
`user` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '用户名', |
|
238 |
`password` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '密码', |
|
239 |
`prog_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '设备名', |
|
240 |
`cls_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '设备注册表ID', |
|
241 |
`create_time` datetime DEFAULT NULL COMMENT '创建时间', |
|
242 |
`update_time` datetime DEFAULT NULL COMMENT '更新时间', |
|
243 |
PRIMARY KEY (`id`) USING BTREE, |
|
244 |
UNIQUE KEY `uk_server_name` (`server_name`) USING BTREE |
|
245 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='OPCDA表'; |
|
246 |
|
|
247 |
CREATE TABLE `t_channel_opcda_tag` ( |
|
248 |
`id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'id', |
|
249 |
`server_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '服务id', |
|
250 |
`tag_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '测点名称', |
|
251 |
`data_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '数据类型', |
|
252 |
`enabled` tinyint(1) DEFAULT NULL COMMENT '是否启用', |
|
253 |
`item_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT 'itemId', |
|
254 |
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', |
|
255 |
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
|
256 |
PRIMARY KEY (`id`) USING BTREE |
|
257 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='opcda测点表'; |
|
258 |
|
|
259 |
CREATE TABLE `t_channel_opcua_device` ( |
|
260 |
`id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, |
|
261 |
`server_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, |
|
262 |
`endpoint_url` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, |
|
263 |
`security_policy` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, |
|
264 |
`security_mode` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, |
|
265 |
`connection_type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, |
|
266 |
`user_name` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, |
|
267 |
`password` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, |
|
268 |
`certificate_path` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, |
|
269 |
`connect_inactivity_timeout` int DEFAULT NULL, |
|
270 |
`reconnect_interval` int DEFAULT NULL, |
|
271 |
`creator` bigint DEFAULT NULL, |
|
272 |
`create_time` datetime DEFAULT NULL, |
|
273 |
`updater` bigint DEFAULT NULL, |
|
274 |
`update_time` datetime DEFAULT NULL, |
|
275 |
PRIMARY KEY (`id`) USING BTREE, |
|
276 |
UNIQUE KEY `uk_server_name` (`server_name`) USING BTREE |
|
277 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='OPCUA表'; |
|
278 |
|
|
279 |
CREATE TABLE `t_channel_opcua_tag` ( |
|
280 |
`id` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, |
|
281 |
`tag_name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '测点名称', |
|
282 |
`data_type` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '数据类型', |
|
283 |
`enabled` tinyint(1) DEFAULT NULL COMMENT '是否启用', |
|
284 |
`device` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '关联设备', |
|
285 |
`address` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT 'opcda地址', |
|
286 |
`sampling_rate` smallint unsigned DEFAULT NULL COMMENT '采集频率', |
|
287 |
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', |
|
288 |
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
|
289 |
PRIMARY KEY (`id`) USING BTREE, |
|
290 |
KEY `idx_device` (`device`) USING BTREE |
|
291 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='opcda测点表'; |
|
292 |
|
|
293 |
CREATE TABLE `t_channel_modbus_device` ( |
|
294 |
`id` varchar(36) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, |
|
295 |
`name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '设备名称', |
|
296 |
`address` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'IP地址', |
|
297 |
`port` smallint unsigned NOT NULL COMMENT '端口', |
|
298 |
`connect_inactivity_timeout` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '不活动超时(ms)', |
|
299 |
`reconnect_interval` smallint unsigned DEFAULT NULL COMMENT '重连超时(ms)', |
|
300 |
`attempts_before_timeout` smallint unsigned DEFAULT NULL COMMENT '重试次数', |
|
301 |
`wait_to_retry_milliseconds` smallint unsigned DEFAULT NULL COMMENT '重试间隔(ms)', |
|
302 |
`read_timeout` smallint unsigned DEFAULT NULL COMMENT '读超时(ms)', |
|
303 |
`write_timeout` smallint unsigned DEFAULT NULL COMMENT '写超时(ms)', |
|
304 |
`use_optimized_block_read` tinyint(1) DEFAULT NULL COMMENT '是否使用优化', |
|
305 |
`project_reference` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '' COMMENT '系统内部用,默认空字符串', |
|
306 |
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', |
|
307 |
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
|
308 |
PRIMARY KEY (`id`) USING BTREE, |
|
309 |
UNIQUE KEY `uk_name` (`name`) USING BTREE |
|
310 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='ModBus表'; |
|
311 |
|
|
312 |
CREATE TABLE `t_channel_modbus_tag` ( |
|
313 |
`id` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, |
|
314 |
`tag_name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '测点名称', |
|
315 |
`data_type` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '数据类型', |
|
316 |
`enabled` tinyint(1) DEFAULT NULL COMMENT '是否启用', |
|
317 |
`format` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '大小端', |
|
318 |
`device` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '关联设备', |
|
319 |
`address` varchar(6) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT 'Modbus地址', |
|
320 |
`sampling_rate` smallint unsigned DEFAULT NULL COMMENT '采集频率', |
|
321 |
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', |
|
322 |
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
|
323 |
`tag_desc` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '描述', |
|
324 |
PRIMARY KEY (`id`) USING BTREE, |
|
325 |
KEY `idx_device` (`device`) USING BTREE |
|
326 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='ModBus测点表'; |
|
327 |
|
|
328 |
|
|
329 |
CREATE TABLE `t_channel_kio_device` ( |
|
330 |
`id` varchar(36) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, |
|
331 |
`instance_name` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '实例名称', |
|
332 |
`address` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'IP地址', |
|
333 |
`port` smallint unsigned NOT NULL COMMENT '端口', |
|
334 |
`username` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户名', |
|
335 |
`password` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '密码', |
|
336 |
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', |
|
337 |
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
|
338 |
PRIMARY KEY (`id`) USING BTREE, |
|
339 |
UNIQUE KEY `uk_instance_name` (`instance_name`) USING BTREE |
|
340 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='KIO实例表'; |
|
341 |
|
|
342 |
|
|
343 |
CREATE TABLE `t_channel_kio_tag` ( |
|
344 |
`id` varchar(36) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, |
|
345 |
`tag_name` varchar(36) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '测点名称', |
|
346 |
`data_type` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '数据类型', |
|
347 |
`tag_id` int NOT NULL COMMENT '顺序号', |
|
348 |
`tag_desc` varchar(36) CHARACTER SET utf8 COLLATE utf8_general_ci default NULL COMMENT '测点描述', |
|
349 |
`enabled` tinyint(1) DEFAULT NULL COMMENT '是否启用', |
|
350 |
`device` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '关联设备', |
|
351 |
`sampling_rate` smallint unsigned DEFAULT NULL COMMENT '采集频率', |
|
352 |
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', |
|
353 |
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
|
354 |
PRIMARY KEY (`id`) USING BTREE, |
|
355 |
KEY `idx_device` (`device`) USING BTREE, |
|
356 |
KEY `idx_tag_name` (`tag_name`) USING BTREE |
|
357 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='KIO测点表'; |
|
358 |
|
|
359 |
CREATE TABLE t_da_point( |
|
360 |
`id` VARCHAR(255) NOT NULL COMMENT 'ID' , |
|
361 |
`point_no` VARCHAR(36) COMMENT '测点编码' , |
|
362 |
`point_name` VARCHAR(36) COMMENT '测点名称' , |
|
363 |
`point_type` VARCHAR(10) COMMENT '测点类型' , |
|
364 |
`data_type` VARCHAR(10) COMMENT '数据类型' , |
|
365 |
`value_type` VARCHAR(10) COMMENT '值类型' , |
|
366 |
`store_type` VARCHAR(10) COMMENT '存储类型' , |
|
367 |
`unit` VARCHAR(36) COMMENT '测量单位' , |
|
368 |
`unittransfactor` DECIMAL(24,6) COMMENT '单位转换' , |
|
369 |
`default_value` DECIMAL(24,6) COMMENT '默认值' , |
|
370 |
`max_value` DECIMAL(24,6) COMMENT '最大值' , |
|
371 |
`min_value` DECIMAL(24,6) COMMENT '最小值' , |
|
372 |
`offset_value` DECIMAL(24,6) COMMENT '偏移量' , |
|
373 |
`minfreqid` VARCHAR(10) COMMENT '采集频率' , |
|
374 |
`remark` VARCHAR(255) COMMENT '备注' , |
|
375 |
`is_enable` tinyint(1) COMMENT '是否启用' , |
|
376 |
`creator` VARCHAR(255) COMMENT '创建人' , |
|
377 |
`create_time` DATETIME COMMENT '创建时间' , |
|
378 |
`updater` VARCHAR(255) COMMENT '修改人' , |
|
379 |
`update_time` DATETIME COMMENT '修改时间' , |
|
380 |
PRIMARY KEY (id) USING BTREE, |
|
381 |
UNIQUE KEY `uk_point_no` (`point_no`) USING BTREE |
|
382 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT = '测点表;'; |
|
383 |
|
|
384 |
CREATE TABLE t_da_measure_point( |
|
385 |
`id` VARCHAR(36) NOT NULL COMMENT 'ID' , |
|
386 |
`point_id` VARCHAR(36) COMMENT '测点ID' , |
|
387 |
`source_type` VARCHAR(10) COMMENT '数据源类型', |
|
388 |
`source_id` VARCHAR(36) COMMENT '数据源ID', |
|
389 |
`tag_no` VARCHAR(64) COMMENT '测点Tag', |
|
390 |
`dimension` INT COMMENT '尺度' , |
|
391 |
PRIMARY KEY (id) USING BTREE, |
|
392 |
UNIQUE KEY `uk_point_id` (`point_id`) USING BTREE, |
|
393 |
KEY `uk_tag_no` (`tag_no`) USING BTREE |
|
394 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT = '测量点表'; |
|
395 |
|
|
396 |
CREATE TABLE t_da_math_point( |
|
397 |
`id` VARCHAR(36) NOT NULL COMMENT 'ID' , |
|
398 |
`point_id` VARCHAR(36) COMMENT '测点ID' , |
|
399 |
`expression` VARCHAR(500) COMMENT '计算公式' , |
|
400 |
PRIMARY KEY (id) USING BTREE, |
|
401 |
UNIQUE KEY `uk_point_id` (`point_id`) USING BTREE |
|
402 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT = '计算点表'; |
|
403 |
|
|
404 |
CREATE TABLE `t_da_point_value` ( |
|
405 |
`id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'id', |
|
406 |
`point_no` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '测点编码', |
|
407 |
`data_time` datetime DEFAULT NULL COMMENT '数据时间', |
|
408 |
`data_value` decimal(24,6) DEFAULT NULL COMMENT '数据值', |
|
409 |
PRIMARY KEY (`id`) USING BTREE, |
|
410 |
KEY `idx_point_no` (`point_no`) USING BTREE, |
|
411 |
KEY `idx_data_time` (`data_time`) USING BTREE |
|
412 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='点值表'; |
|
413 |
|
|
414 |
CREATE TABLE t_da_sequence_num( |
|
415 |
`id` VARCHAR(36) NOT NULL COMMENT 'ID' , |
|
416 |
`code` VARCHAR(36) COMMENT '编号', |
|
417 |
`name` VARCHAR(36) COMMENT '名称', |
|
418 |
`sequence_num` int COMMENT '序号' , |
|
419 |
`prefix` VARCHAR(10) COMMENT '前缀' , |
|
420 |
PRIMARY KEY (id) USING BTREE, |
|
421 |
UNIQUE KEY `uk_code` (`code`) USING BTREE |
|
422 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT = '序号表'; |
|
423 |
INSERT INTO `t_da_sequence_num` (`id`, `code`, `name`, `sequence_num`, `prefix`) VALUES ('1', 'POINT_M', '测量点编码', 100000, 'M'); |
|
424 |
INSERT INTO `t_da_sequence_num` (`id`, `code`, `name`, `sequence_num`, `prefix`) VALUES ('2', 'POINT_C', '计算点编码', 100000, 'C'); |
|
425 |
|
|
426 |
CREATE TABLE `t_http_api` ( |
|
427 |
`id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'ID', |
|
428 |
`code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '编码', |
|
429 |
`name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '名称', |
|
430 |
`url` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'URL', |
|
431 |
`method` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '方法', |
|
432 |
`param` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '参数', |
|
433 |
`descp` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '描述', |
|
434 |
`status` int NULL DEFAULT NULL COMMENT '状态', |
|
435 |
`creator` VARCHAR(255) COMMENT '创建人' , |
|
436 |
`create_time` DATETIME COMMENT '创建时间' , |
|
437 |
`updater` VARCHAR(255) COMMENT '修改人' , |
|
438 |
`update_time` DATETIME COMMENT '修改时间' , |
|
439 |
PRIMARY KEY (`ID`) USING BTREE, |
|
440 |
UNIQUE KEY `uk_code` (`code`) USING BTREE |
|
441 |
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'Api接口' ROW_FORMAT = DYNAMIC; |
|
442 |
|
|
443 |
|
|
444 |
CREATE TABLE `t_http_token` ( |
|
445 |
`id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, |
|
446 |
`api_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, |
|
447 |
`login_url` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, |
|
448 |
`client_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, |
|
449 |
`client_secret` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, |
|
450 |
`username` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, |
|
451 |
`password` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, |
|
452 |
`token` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT 'token', |
|
453 |
`expire_time` datetime DEFAULT NULL COMMENT '过期时间', |
|
454 |
`update_time` datetime DEFAULT NULL COMMENT '更新时间', |
|
455 |
PRIMARY KEY (`id`) USING BTREE, |
|
456 |
UNIQUE KEY `uk_api_id` (`api_id`) USING BTREE |
|
457 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='接口Token'; |
|
458 |
|
|
459 |
CREATE TABLE `t_http_tag` ( |
|
460 |
`id` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '查询号', |
|
461 |
`http_api_code` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'HTTP 接口代码', |
|
462 |
`tag_code` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '测点编码', |
|
463 |
`tag_name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '测点名称', |
|
464 |
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', |
|
465 |
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
|
466 |
PRIMARY KEY (`id`) USING BTREE |
|
467 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='接口Tag表'; |
|
468 |
|
|
469 |
CREATE TABLE t_ind_item_atom( |
|
470 |
`id` VARCHAR(36) NOT NULL COMMENT 'ID' , |
|
471 |
`item_id` VARCHAR(36) COMMENT '指标ID' , |
|
472 |
`data_source` VARCHAR(20) COMMENT '数据源', |
|
473 |
`query_sql` VARCHAR(500) COMMENT '查询语句', |
|
474 |
PRIMARY KEY (id) USING BTREE, |
|
475 |
UNIQUE KEY `uk_point_id` (`item_id`) USING BTREE |
|
476 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT = '原子指标'; |
|
477 |
|
|
478 |
CREATE TABLE t_ind_item( |
|
479 |
`id` VARCHAR(36) NOT NULL COMMENT 'ID' , |
|
480 |
`item_no` VARCHAR(36) COMMENT '指标编码' , |
|
481 |
`item_name` VARCHAR(36) COMMENT '指标名称' , |
|
482 |
`item_type` VARCHAR(10) COMMENT '指标类型' , |
|
483 |
`coefficient` decimal(10, 4) COMMENT '系数', |
|
484 |
`precision` int COMMENT '指标精度', |
|
485 |
`business_type` VARCHAR(10) COMMENT '业务类型', |
|
486 |
`time_range` VARCHAR(20) COMMENT '时间范围' , |
|
487 |
`time_granularity` VARCHAR(10) COMMENT '时间粒度' , |
|
488 |
`remark` VARCHAR(255) COMMENT '备注' , |
|
489 |
`is_enable` tinyint(1) COMMENT '是否启用' , |
|
490 |
`creator` VARCHAR(36) COMMENT '创建人' , |
|
491 |
`create_time` DATETIME COMMENT '创建时间' , |
|
492 |
`updater` VARCHAR(36) COMMENT '修改人' , |
|
493 |
`update_time` DATETIME COMMENT '修改时间' , |
|
494 |
PRIMARY KEY (id) USING BTREE, |
|
495 |
UNIQUE KEY `uk_item_no` (`item_no`) USING BTREE |
|
496 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT = '指标项表'; |
|
497 |
|
|
498 |
CREATE TABLE t_ind_item_atom( |
|
499 |
`id` VARCHAR(36) NOT NULL COMMENT 'ID' , |
|
500 |
`item_id` VARCHAR(36) COMMENT '指标ID' , |
|
501 |
`data_source` VARCHAR(20) COMMENT '数据源', |
|
502 |
`query_sql` VARCHAR(500) COMMENT '查询语句', |
|
503 |
PRIMARY KEY (id) USING BTREE, |
|
504 |
UNIQUE KEY `uk_point_id` (`item_id`) USING BTREE |
|
505 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT = '原子指标'; |
|
506 |
|
|
507 |
CREATE TABLE t_ind_item_cal( |
|
508 |
`id` VARCHAR(36) NOT NULL COMMENT 'ID' , |
|
509 |
`item_id` VARCHAR(36) COMMENT '指标ID' , |
|
510 |
`expression` varchar(100) DEFAULT NULL COMMENT '计算表达式', |
|
511 |
PRIMARY KEY (id) USING BTREE, |
|
512 |
UNIQUE KEY `uk_item_id` (`item_id`) USING BTREE |
|
513 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT = '计算指标'; |
|
514 |
|
|
515 |
CREATE TABLE t_ind_item_derive( |
|
516 |
`id` VARCHAR(36) NOT NULL COMMENT 'ID' , |
|
517 |
`item_id` VARCHAR(36) COMMENT '指标ID' , |
|
518 |
`limit_time` varchar(100) DEFAULT NULL COMMENT '时间限定', |
|
519 |
`limit_business` varchar(100) DEFAULT NULL COMMENT '业务限定', |
|
520 |
PRIMARY KEY (id) USING BTREE, |
|
521 |
UNIQUE KEY `uk_item_id` (`item_id`) USING BTREE |
|
522 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT = '派生指标'; |
|
523 |
|
|
524 |
CREATE TABLE `t_ind_item_value` ( |
|
525 |
`id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'id', |
|
526 |
`item_no` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '指标编码', |
|
527 |
`data_time` varchar(36) DEFAULT NULL COMMENT '数据时间', |
|
528 |
`data_value` decimal(24,6) DEFAULT NULL COMMENT '数据值', |
|
529 |
PRIMARY KEY (`id`) USING BTREE, |
|
530 |
KEY `idx_item_no` (`item_no`) USING BTREE, |
|
531 |
KEY `idx_data_time` (`data_time`) USING BTREE |
|
532 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='指标值表'; |