create table
  t_dm_module
(
  id              varchar(36) not null,
  modulename      varchar(50),
  moduletype      varchar(30),
  cycle           decimal(5, 0),
  modulenavconfig varchar(3072),
  predicttime     datetime,
  collecttime     datetime,
  create_time     datetime default current_timestamp,
  update_time     datetime default current_timestamp,
  traintime       datetime,
  primary key (id),
  key idx_moduletype (moduletype)
) engine = innodb
  default character set utf8mb4;


create table
  t_dm_module_item
(
  id         varchar(36) not null,
  moduleid   varchar(36),
  itemid     varchar(36),
  itemorder  bigint,
  status     bigint,
  categoryid varchar(64),
  primary key (id),
  key idx_moduleid (moduleid)
) engine = innodb
  default character set utf8mb4;

create table t_mm_item_output
(
  id            varchar(36) not null,
  itemid        varchar(36),
  pointid       varchar(36),
  resulttableid varchar(36),
  tagname       varchar(50),
  outputorder   decimal(5, 0),
  primary key (id),
  key idx_itemid (itemid)
) engine = innodb
  default character set utf8mb4;

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)
) engine = innodb
  default character set utf8mb4;

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;

create table
  t_mm_model_arith_settings
(
  id        varchar(64) not null,
  modelid   varchar(64),
  `key`     varchar(64),
  value     varchar(256),
  name      varchar(64),
  valuetype varchar(64),
  primary key (id),
  key idx_modelid (modelid)
) engine = innodb
  default character set utf8mb4;

create table
  t_mm_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),
  primary key (id),
  key idx_modelid (modelid)
) engine = innodb
  default character set utf8mb4;

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;

create table
  t_mm_predict_item
(
  id              varchar(36) not null,
  itemno          varchar(16),
  itemname        varchar(50),
  caltypeid       varchar(36),
  itemtypeid      varchar(36),
  predictlength   decimal(5, 0),
  granularity     decimal(5, 0),
  status          decimal(5, 0),
  isfuse          decimal(5, 0),
  predictphase    decimal(5, 0),
  workchecked     decimal(5, 0),
  unittransfactor decimal(31, 6),
  create_time     datetime default current_timestamp,
  update_time     datetime default current_timestamp,
  saveindex       varchar(16),
  primary key (id),
  key idx_itemno (itemno)
) engine = innodb
  default character set utf8mb4;

create table
  t_mm_predict_merge_item
(
  id         varchar(36) not null,
  itemid     varchar(36),
  expression varchar(200),
  num        integer,
  primary key (id),
  key idx_itemid (itemid)
) engine = innodb
  default character set utf8mb4;

create table
  t_mm_predict_model
(
  id                  varchar(36) not null,
  modelno             varchar(32),
  modelname           varchar(50),
  itemid              varchar(36),
  arithid             varchar(36),
  trainsamplength     decimal(5, 0),
  predictsamplength   decimal(5, 0),
  isonlinetrain       decimal(5, 0),
  modelpath           varchar(256),
  isnormal            decimal(5, 0),
  normalmax           decimal(19, 3),
  normalmin           decimal(19, 3),
  status              decimal(5, 0),
  classname           varchar(256),
  methodname          varchar(64),
  modelparamstructure varchar(128),
  resultstrid         varchar(64),
  settingmap          varchar(256),
  trainmodelpath      varchar(256),
  pathstatus          decimal(5, 0),
  pdim                smallint,
  traninip            varchar(16),
  comparisonclassname varchar(256),
  primary key (id),
  key idx_modelno (modelno),
  key idx_itemid (itemid)
) engine = innodb
  default character set utf8mb4;

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;


create table
  t_st_schedule_result
(
  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),
  primary key (id),
  key idx_modelid (modelid)
) engine = innodb
  default character set utf8mb4;

create table
  t_st_schedule_scheme
(
  id           varchar(64) not null,
  modelid      varchar(64),
  starttime    datetime,
  endtime      datetime,
  scheduletime datetime,
  objectvalue  decimal(30, 6),
  schemeorder  integer,
  isadjust     integer,
  primary key (id),
  key idx_modelid (modelid)
) engine = innodb
  default character set utf8mb4;

create table
  t_st_schedule_scheme_detailes
(
  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),
  key idx_modelid (modelid)
) 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;

create table
  t_mm_predict_alarm_message
(
  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),
  primary key (id),
  key idx_item_id (item_id),
  key idx_type (type)
) engine = innodb
  default character set utf8mb4;

create table
  t_mm_item_result_json
(
  id          varchar(36) not null,
  outputid    varchar(36),
  predicttime datetime,
  jsonvalue   varchar(6400),
  cumulant    varchar(36),
  primary key (id),
  key idx_outputid (outputid),
  key idx_predicttime (predicttime)
) engine = innodb
  default character set utf8mb4;

create table
  t_mm_item_result_last_point
(
  id        varchar(36) not null,
  outputid  varchar(36),
  datatime  datetime,
  datavalue decimal(19, 3),
  primary key (id),
  key idx_outputid (outputid)
) engine = innodb
  default character set utf8mb4;

create table
  t_mm_item_accuracy_rate
(
  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,
  primary key (id),
  key idx_item_id (item_id)
) engine = innodb
  default character set utf8mb4;

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,
  primary key (id),
  key idx_model_id (model_id),
  key idx_type (type)
) engine = innodb
  default character set utf8mb4;