From 7fd198b8ebe97cd06b10f96b9179caebe679783c Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期四, 05 九月 2024 10:43:26 +0800
Subject: [PATCH] 重构model

---
 iailab-module-model/iailab-module-model-biz/db/mysql.sql |   79 ++++++++++++++++++++++++++++-----------
 1 files changed, 57 insertions(+), 22 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 2b3e68e..4bab7e5 100644
--- a/iailab-module-model/iailab-module-model-biz/db/mysql.sql
+++ b/iailab-module-model/iailab-module-model-biz/db/mysql.sql
@@ -437,22 +437,47 @@
 ) engine = innodb
   default character set utf8mb4;
 
-create table
-  t_mm_predict_alarm_message
+create table t_mm_predict_alarm_config
 (
-  id           varchar(64) not null,
-  item_id      varchar(64),
-  title        varchar(64),
-  content      varchar(128),
-  predict_time datetime,
-  out_time     datetime,
-  create_time  datetime default current_timestamp,
-  type         varchar(64),
+  id            varchar(36) not null,
+  title         varchar(36) COMMENT '消息标题',
+  alarm_obj     varchar(36) COMMENT '监控对象',
+  item_id       varchar(36) COMMENT '预测项ID',
+  comp_length   int COMMENT '比较长度',
+  upper_limit   decimal(10, 4) COMMENT '上限',
+  lower_limit   decimal(10, 4) COMMENT '下限',
+  unit          varchar(10) COMMENT '单位',
+  coefficient   decimal(10, 4) COMMENT '转换系数',
+  model_id      varchar(36) COMMENT '调度建议模型',
+  is_enable     tinyint     NOT NULL COMMENT '是否启用(0禁用 1启用)',
+  `creator`     varchar(64) NOT NULL DEFAULT '' COMMENT '创建者',
+  `create_time` datetime    NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+  `updater`     varchar(64)          DEFAULT '' COMMENT '更新者',
+  `update_time` datetime    NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
+  primary key (id)
+) engine = innodb
+  default character set utf8mb4 COMMENT = '预警配置表';
+
+create table t_mm_predict_alarm_message
+(
+  id            varchar(36) not null,
+  title         varchar(36) COMMENT '消息标题',
+  content       varchar(128) COMMENT '消息内容',
+  alarm_obj     varchar(36) COMMENT '监控对象',
+  point_id      varchar(36) COMMENT '监控点位ID',
+  item_id       varchar(36) COMMENT '预测项ID',
+  current_value decimal(18, 4) COMMENT '当前值',
+  out_time      datetime COMMENT '超出时间',
+  out_value     decimal(18, 4) COMMENT '超出值',
+  alarm_type    varchar(10) COMMENT '预警类型',
+  alarm_time    datetime COMMENT '预警时间',
+  create_time   datetime    NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
   primary key (id),
   key idx_item_id (item_id),
-  key idx_type (type)
+  key idx_alarm_obj (alarm_obj),
+  key idx_alarm_time (alarm_time)
 ) engine = innodb
-  default character set utf8mb4;
+  default character set utf8mb4 COMMENT = '预警消息表';
 
 create table
   t_mm_item_result_json
@@ -502,17 +527,27 @@
 create table
   t_st_schedule_suggest
 (
-  id          varchar(64) not null,
-  title       varchar(128),
-  content     varchar(256),
-  order_index integer,
-  type        varchar(64),
-  item_id     varchar(64),
-  is_adjusted integer,
-  model_id    varchar(64),
-  create_time datetime default current_timestamp,
+  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 '创建时间',
   primary key (id),
   key idx_model_id (model_id),
   key idx_type (type)
 ) engine = innodb
-  default character set utf8mb4;
\ No newline at end of file
+  default character set utf8mb4 COMMENT = '调度建议表';
\ No newline at end of file

--
Gitblit v1.9.3