From 13e53d2f872a2ad3f119434bd1bc4946a141e224 Mon Sep 17 00:00:00 2001 From: 潘志宝 <979469083@qq.com> Date: 星期四, 12 九月 2024 14:48:33 +0800 Subject: [PATCH] MDK --- iailab-module-model/iailab-module-model-biz/db/mysql.sql | 569 ++++++++++++++++++++------------------------------------ 1 files changed, 209 insertions(+), 360 deletions(-) diff --git a/iailab-module-model/iailab-module-model-biz/db/mysql.sql b/iailab-module-model/iailab-module-model-biz/db/mysql.sql index 4bab7e5..e0c8110 100644 --- a/iailab-module-model/iailab-module-model-biz/db/mysql.sql +++ b/iailab-module-model/iailab-module-model-biz/db/mysql.sql @@ -1,5 +1,4 @@ -create table - t_dm_module +create table t_dm_module ( id varchar(36) not null, modulename varchar(50), @@ -12,13 +11,11 @@ update_time datetime default current_timestamp, traintime datetime, primary key (id), - key idx_moduletype (moduletype) -) engine = innodb - default character set utf8mb4; + UNIQUE INDEX idx_moduletype (moduletype) +) engine = innodb default character set utf8mb4 COMMENT = '管网表'; -create table - t_dm_module_item +create table t_dm_module_item ( id varchar(36) not null, moduleid varchar(36), @@ -28,8 +25,7 @@ categoryid varchar(64), primary key (id), key idx_moduleid (moduleid) -) engine = innodb - default character set utf8mb4; +) engine = innodb default character set utf8mb4 COMMENT = '管网预测项关系表'; create table t_mm_item_output ( @@ -40,71 +36,62 @@ tagname varchar(50), outputorder decimal(5, 0), primary key (id), - key idx_itemid (itemid) -) engine = innodb - default character set utf8mb4; + INDEX idx_itemid (itemid) +) engine = innodb default character set utf8mb4 COMMENT = '预测项输出表'; -create table - t_mm_item_result +create table t_mm_item_result ( id varchar(36) not null, outputid varchar(36), datatime datetime, datavalue decimal(19, 3), primary key (id), - key idx_outputid (outputid) + INDEX idx_outputid (outputid), + INDEX idx_datatime (datatime) ) engine = innodb - default character set utf8mb4; + default character set utf8mb4 COMMENT = '预测结果表'; -create table - t_mm_item_type +create table t_mm_item_type ( id varchar(36) not null, itemtypename varchar(50), itemclasstype varchar(100), assemblyname varchar(64), primary key (id) -) engine = innodb - default character set utf8mb4; +) engine = innodb default character set utf8mb4 COMMENT = '预测项类型表'; -create table - t_mm_model_arith_settings +create table t_mm_model_arith_settings ( - id varchar(64) not null, - modelid varchar(64), - `key` varchar(64), + id varchar(36) not null, + modelid varchar(36), + `key` varchar(36), value varchar(256), - name varchar(64), - valuetype varchar(64), + name varchar(36), + valuetype varchar(36), primary key (id), - key idx_modelid (modelid) -) engine = innodb - default character set utf8mb4; + INDEX idx_modelid (modelid) +) engine = innodb default character set utf8mb4 COMMENT = '预测模型设置参数表'; -create table - t_mm_model_param +create table t_mm_model_param ( - id varchar(56) not null, - modelid varchar(56), - modelparamname varchar(64), - modelparamid varchar(56), + id varchar(36) not null, + modelid varchar(36), + modelparamname varchar(36), + modelparamid varchar(36), modelparamorder integer, modelparamportorder integer, datalength integer, - modelparamtype varchar(32), + modelparamtype varchar(36), primary key (id), - key idx_modelid (modelid) -) engine = innodb - default character set utf8mb4; + INDEX idx_modelid (modelid) +) engine = innodb default character set utf8mb4 COMMENT = '预测模型输入参数表'; -create table - t_mm_model_resultstr +create table t_mm_model_resultstr ( id varchar(64) not null, resultstr varchar(64), - constraint p_key_1 primary key (id) -) engine = innodb - default character set utf8mb4; + primary key (id) +) engine = innodb default character set utf8mb4 COMMENT = '预测模型结果字符串表'; create table t_mm_predict_item @@ -125,21 +112,19 @@ update_time datetime default current_timestamp, saveindex varchar(16), primary key (id), - key idx_itemno (itemno) -) engine = innodb - default character set utf8mb4; + UNIQUE INDEX uk_itemno (itemno) +) engine = innodb default character set utf8mb4 COMMENT = '预测模型结果字符串表'; create table t_mm_predict_merge_item ( id varchar(36) not null, itemid varchar(36), - expression varchar(200), + expression varchar(255), num integer, primary key (id), - key idx_itemid (itemid) -) engine = innodb - default character set utf8mb4; + UNIQUE INDEX uk_itemid (itemid) +) engine = innodb default character set utf8mb4 COMMENT = '合并预测项表'; create table t_mm_predict_model @@ -168,279 +153,65 @@ traninip varchar(16), comparisonclassname varchar(256), primary key (id), - key idx_modelno (modelno), - key idx_itemid (itemid) + INDEX idx_modelno (modelno), + UNIQUE INDEX idx_itemid (itemid) ) engine = innodb - default character set utf8mb4; + default character set utf8mb4 COMMENT = '预测项模型表'; -create table - t_mm_result_table +create table t_mm_result_table ( id varchar(36) not null, tablename varchar(30), primary key (id) -) engine = innodb - default character set utf8mb4; - -create table - t_st_schedule -( - id varchar(64) not null, - name varchar(64), - scheduletime datetime, - primary key (id) -) engine = innodb - default character set utf8mb4; -create table - t_st_schedule_energy_type -( - id varchar(64) not null, - energytypename varchar(64), - primary key (id) -) engine = innodb - default character set utf8mb4; - -create table - t_st_schedule_model -( - id varchar(64) not null, - modelname varchar(64), - scheduleid varchar(64), - objectid varchar(64), - classname varchar(128), - methodname varchar(64), - modelpath varchar(256), - portlength integer, - modelstatus integer, - resultstrid varchar(64), - modelparamstructure varchar(128), - primary key (id) -) engine = innodb - default character set utf8mb4; - -create table - t_st_schedule_model_accuracy_rate -( - id varchar(36) not null, - accuracy_rate_num varchar(36) not null, - schedule_model_id varchar(36) not null, - result_key varchar(36) not null, - point_id varchar(36) not null, - rate_type varchar(36) not null, - hour_accuracy_rate decimal(6, 4), - day_accuracy_rate decimal(6, 4), - is_enable integer, - update_time datetime, - begin_time datetime, - primary key (id) -) engine = innodb - default character set utf8mb4; +) engine = innodb default character set utf8mb4 COMMENT = '预测结果存放表'; -create table - t_st_schedule_result +create table t_mm_item_result_json ( - id varchar(64), - scheduleid varchar(64), - modelid varchar(64), - result varchar(64), - scheduletime datetime, - primary key (id) -) engine = innodb - default character set utf8mb4; - -create table - t_st_schedule_result_str -( - id varchar(64), - resultstr varchar(32), - primary key (id) -) engine = innodb - default character set utf8mb4; - -create table - t_st_schedule_model_user_param -( - id varchar(64) not null, - modelid varchar(64), - userid varchar(64), - energytypeid varchar(64), - paramid varchar(64), - modelsatus integer, - userorder integer, - energyorder integer, - isadjust integer, - upadjlimit decimal(30, 6), - downadjlimit decimal(30, 6), - adjorder integer, - primary key (id) -) engine = innodb - default character set utf8mb4; - -create table - t_st_schedule_object -( - id varchar(64) not null, - name varchar(64), - `order` integer, - primary key (id) -) engine = innodb - default character set utf8mb4; - -create table - t_st_schedule_param -( - id varchar(64) not null, - modelid varchar(64), - modelparamname varchar(64), - modelparamid varchar(64), - modelparamorder integer, - modelparamportorder integer, - datalength integer, - modelparamtype varchar(64), - primary key (id) -) engine = innodb - default character set utf8mb4; - -create table - t_st_schedule_param_setting -( - id varchar(64) not null, - modelid varchar(64), - `key` varchar(64), - value varchar(64), - valuetype varchar(64), - name varchar(64), + id varchar(36) not null, + outputid varchar(36), + predicttime datetime, + jsonvalue varchar(6400), + cumulant varchar(36), primary key (id), - key idx_modelid (modelid) -) engine = innodb - default character set utf8mb4; + INDEX idx_outputid (outputid), + INDEX idx_predicttime (predicttime) +) engine = innodb default character set utf8mb4 COMMENT = '预测JSON数据表'; create table - t_st_schedule_scheme + t_mm_item_result_last_point ( - id varchar(64) not null, - modelid varchar(64), - starttime datetime, - endtime datetime, - scheduletime datetime, - objectvalue decimal(30, 6), - schemeorder integer, - isadjust integer, + id varchar(36) not null, + outputid varchar(36), + datatime datetime, + datavalue decimal(19, 3), primary key (id), - key idx_modelid (modelid) -) engine = innodb - default character set utf8mb4; + INDEX idx_outputid (outputid), + INDEX idx_datatime (datatime) +) engine = innodb default character set utf8mb4 COMMENT = '预测T+L数据表'; -create table - t_st_schedule_scheme_detailes +create table t_mm_item_accuracy_rate ( - id varchar(64) not null, - adjustuserid varchar(64), - schemid varchar(64), - value text, - isadjust decimal(30, 0), - modelid varchar(64), - scheduletime datetime, - resultkey varchar(64), + id varchar(36) not null, + item_id varchar(36) not null COMMENT '预测项ID', + sample_length integer COMMENT '样本长度', + value_type integer COMMENT '值类型', + in_deviation decimal(8, 3) COMMENT '精准误差', + in_accuracy_rate decimal(6, 4) COMMENT '精准度', + out_deviation decimal(8, 3) COMMENT '不可信误差', + out_accuracy_rate decimal(6, 4) COMMENT '不可信率', + is_enable tinyint, + update_time datetime, + begin_time datetime, primary key (id), - key idx_modelid (modelid) + INDEX idx_item_id (item_id) ) engine = innodb - default character set utf8mb4; - -create table - t_st_schedule_scheme_detailes_max -( - id varchar(64) not null, - adjustuserid varchar(64), - schemid varchar(64), - value text, - isadjust decimal(30, 0), - modelid varchar(64), - scheduletime datetime, - resultkey varchar(64), - primary key (id) -) engine = innodb - default character set utf8mb4; - - -create table - t_st_schedule_scheme_eval_type -( - id varchar(64) not null, - evalname varchar(64), - primary key (id) -) engine = innodb - default character set utf8mb4; - -create table - t_st_schedule_scheme_eval_value -( - id varchar(64) not null, - schemid varchar(64), - evalid varchar(64), - schprevalue decimal(30, 6), - schedvalue decimal(30, 6), - primary key (id) -) engine = innodb - default character set utf8mb4; - -create table - t_st_schedule_user -( - id varchar(64) not null, - username varchar(64), - adjuststatus integer, - primary key (id) -) engine = innodb - default character set utf8mb4; - - -create table - t_tm_model_param -( - id varchar(56) not null, - modelid varchar(56), - modelparamname varchar(64), - modelparamid varchar(56), - modelparamorder integer, - modelparamportorder integer, - datalength integer, - modelparamtype varchar(32), - comparisonlength integer, - replacethreshold decimal(5, 3), - comparisonthreshold decimal(5, 3), - primary key (id), - key idx_modelid (modelid) -) engine = innodb - default character set utf8mb4; - -create table - t_st_schedule_predict_item -( - id varchar(64) not null, - name varchar(64), - title varchar(64), - predictitemid varchar(64), - schedulemodelid varchar(64), - maxvaluekey varchar(64), - minvaluekey varchar(64), - min_predict_length integer, - meaunit varchar(10), - adjustkey varchar(36), - adjustindex integer, - adjustparam varchar(128), - create_time datetime default current_timestamp, - update_time datetime default current_timestamp, - suggestkey varchar(36), - primary key (id) -) engine = innodb - default character set utf8mb4; + default character set utf8mb4 COMMENT = '预测精准度表'; create table t_mm_predict_alarm_config ( id varchar(36) not null, - title varchar(36) COMMENT '消息标题', + title varchar(20) COMMENT '消息标题', alarm_obj varchar(36) COMMENT '监控对象', item_id varchar(36) COMMENT '预测项ID', comp_length int COMMENT '比较长度', @@ -473,81 +244,159 @@ alarm_time datetime COMMENT '预警时间', create_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', primary key (id), - key idx_item_id (item_id), - key idx_alarm_obj (alarm_obj), - key idx_alarm_time (alarm_time) + INDEX idx_item_id (item_id), + INDEX idx_alarm_obj (alarm_obj), + INDEX idx_alarm_time (alarm_time) ) engine = innodb default character set utf8mb4 COMMENT = '预警消息表'; -create table - t_mm_item_result_json + +-- 调度模块 + +create table t_st_schedule_scheme ( - id varchar(36) not null, - outputid varchar(36), - predicttime datetime, - jsonvalue varchar(6400), - cumulant varchar(36), + `id` varchar(36) not null COMMENT 'ID', + `code` varchar(20) not null COMMENT '编号', + `name` varchar(20) not null COMMENT '名称', + `trigger_method` varchar(20) COMMENT '触发方式', + `trigger_condition` varchar(20) COMMENT '触发条件', + `schedule_obj` varchar(20) COMMENT '调整对象', + `schedule_type` varchar(20) COMMENT '调整类型', + `schedule_strategy` varchar(20) COMMENT '调整策略', + `model_id` varchar(36) COMMENT '调度模型', + `schedule_time` datetime COMMENT '调度时间', + `status` tinyint NOT NULL DEFAULT 0 COMMENT '方案状态(0正常 1停用)', + `remark` varchar(100) COMMENT '备注', + `creator` varchar(64) NOT NULL DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) NULL DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', primary key (id), - key idx_outputid (outputid), - key idx_predicttime (predicttime) + UNIQUE INDEX `uk_code` (`code` ASC) USING BTREE ) engine = innodb - default character set utf8mb4; + default character set utf8mb4 COMMENT = '调度方案表'; + +create table t_st_schedule_model +( + `id` varchar(36) not null COMMENT 'ID', + `model_code` varchar(64) not null COMMENT '模型编号', + `model_name` varchar(64) not null COMMENT '模型名称', + `model_type` varchar(64) COMMENT '模型类型', + `class_name` varchar(128) COMMENT '类名', + `method_name` varchar(64) COMMENT '方法名', + `port_length` integer COMMENT '输入数量', + `param_structure` varchar(256) COMMENT '参数构造', + `model_path` varchar(256) COMMENT '路径', + `result_str_id` varchar(64) COMMENT '结果ID', + `invocation` varchar(64) COMMENT '调用方式', + `status` tinyint NOT NULL DEFAULT 0 COMMENT '状态(0正常 1停用)', + `creator` varchar(64) NOT NULL DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) NULL DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + primary key (id), + UNIQUE INDEX `uk_model_code` (`model_code` ASC) USING BTREE +) engine = innodb default character set utf8mb4 COMMENT = '调度模型表'; create table - t_mm_item_result_last_point + t_st_schedule_model_param ( - id varchar(36) not null, - outputid varchar(36), - datatime datetime, - datavalue decimal(19, 3), - primary key (id), - key idx_outputid (outputid) + id varchar(36) not null, + modelid varchar(64) not null, + modelparamname varchar(64), + modelparamid varchar(64), + modelparamorder integer, + modelparamportorder integer, + datalength integer, + modelparamtype varchar(64), + primary key (id) ) engine = innodb - default character set utf8mb4; + default character set utf8mb4 COMMENT = '调度模型输入参数表'; + create table - t_mm_item_accuracy_rate + t_st_schedule_model_setting ( - id varchar(36) not null, - item_id varchar(36) not null, - sample_length integer, - value_type integer, - in_deviation decimal(8, 3), - in_accuracy_rate decimal(6, 4), - out_deviation decimal(8, 3), - out_accuracy_rate decimal(6, 4), - is_enable integer, - update_time datetime, - begin_time datetime, + `id` varchar(36) not null, + `modelid` varchar(64) not null, + `key` varchar(64), + `value` varchar(64), + `valuetype` varchar(64), + `name` varchar(64), + `sort` integer, primary key (id), - key idx_item_id (item_id) + key idx_modelid (modelid) ) engine = innodb - default character set utf8mb4; + default character set utf8mb4 COMMENT = '调度模型设置参数表'; create table t_st_schedule_suggest ( - id varchar(36) not null, - title varchar(50) COMMENT '标题', - content varchar(256) COMMENT '内容', - sort integer COMMENT '排序', - alarm_id varchar(36) COMMENT '预警ID', - item_id varchar(36) COMMENT '预测项ID', - model_id varchar(36) COMMENT '模型ID', - adjust_obj varchar(20) COMMENT '调整对象', - adjust_medium varchar(20) COMMENT '调整介质', - adjust_strategy varchar(20) COMMENT '调整策略', - adjust_mode varchar(20) COMMENT '调整方式', - adjust_value decimal(18, 4) COMMENT '调整值', - adjust_unit varchar(20) COMMENT '调整单位', - adjust_times decimal(18, 4) COMMENT '持续时长', - adjust_start datetime COMMENT '调整开始时间', - adjust_end datetime COMMENT '调整结束时间', - suggest_time datetime COMMENT '建议时间', - status tinyint NOT NULL COMMENT '状态(0未处理 1已采纳 2已忽略)', - create_time datetime default current_timestamp COMMENT '创建时间', + id varchar(36) not null, + title varchar(50) COMMENT '标题', + content varchar(256) COMMENT '内容', + sort integer COMMENT '排序', + scheme_id varchar(36) COMMENT '方案ID', + alarm_id varchar(36) COMMENT '预警ID', + item_id varchar(36) COMMENT '预测项ID', + model_id varchar(36) COMMENT '模型ID', + schedule_obj varchar(20) COMMENT '调整对象', + schedule_type varchar(20) COMMENT '调整类型', + schedule_strategy varchar(20) COMMENT '调整策略', + adjust_mode varchar(20) COMMENT '调整方式', + adjust_value decimal(18, 4) COMMENT '调整值', + adjust_unit varchar(20) COMMENT '调整单位', + adjust_times decimal(18, 4) COMMENT '持续时长', + adjust_start datetime COMMENT '调整开始时间', + adjust_end datetime COMMENT '调整结束时间', + schedule_time datetime COMMENT '调度时间', + status tinyint NOT NULL COMMENT '状态(0未处理 1已采纳 2已忽略)', + handler varchar(36) COMMENT '处理人', + handle_time datetime COMMENT '处理时间', + create_time datetime default current_timestamp COMMENT '创建时间', primary key (id), - key idx_model_id (model_id), - key idx_type (type) + INDEX idx_scheme_id (scheme_id), + INDEX idx_alarm_id (alarm_id), + INDEX idx_item_id (item_id), + INDEX idx_model_id (model_id), + INDEX idx_schedule_obj (schedule_obj), + INDEX idx_schedule_type (schedule_type) ) engine = innodb - default character set utf8mb4 COMMENT = '调度建议表'; \ No newline at end of file + default character set utf8mb4 COMMENT = '调度建议表'; + + +create table + t_st_schedule_record +( + `id` varchar(36) not null, + `scheme_id` varchar(36) COMMENT '方案ID', + `model_id` varchar(36) COMMENT '模型ID', + `model_name` varchar(64) COMMENT '模型名称', + `schedule_time` datetime COMMENT '调度时间', + `create_time` datetime default current_timestamp COMMENT '创建时间', + primary key (id), + INDEX idx_scheme_id (scheme_id), + INDEX idx_model_id (model_id), + INDEX idx_schedule_time (schedule_time) +) engine = innodb + default character set utf8mb4 COMMENT = '调度记录表'; + + +create table + t_st_schedule_record_detail +( + `id` varchar(36) not null, + `record_id` varchar(36), + `scheme_id` varchar(64), + `model_id` varchar(36) COMMENT '模型ID', + `result_key` varchar(64), + `result_value` text, + `schedule_time` datetime COMMENT '调度时间', + primary key (id), + key idx_record_id (record_id), + key idx_scheme_id (scheme_id), + key idx_model_id (model_id) +) engine = innodb + default character set utf8mb4 COMMENT = '调度记录详情表'; -- Gitblit v1.9.3