drop table if exists biz_algorithm_config;
create table biz_algorithm_config (
  id           bigint(20)      not null auto_increment         comment '编号',
  algorithm_name         varchar(20)      default 0             comment '算法名称',
  algorithm_type         varchar(50)     default ''            comment '算法类型',
  algorithm_path         varchar(255)          default ''      comment '算法路径',
  algorithm_params         text                                comment '算法参数',
  remark            varchar(255)          default ''           comment '备注',
  create_by         varchar(64)     default ''                 comment '创建者',
  create_time 	    datetime                                   comment '创建时间',
  update_by         varchar(64)     default ''                 comment '更新者',
  update_time       datetime                                   comment '更新时间',
  primary key (id)
) engine=innodb comment = '算法配置表';

drop table if exists biz_preprocessed;
create table biz_preprocessed (
  id           bigint(20)      not null auto_increment    comment '编号',
  task_name         varchar(50)      default ''                comment '任务名称',
  algorithm_id      bigint(20)                                 comment '算法',
  input_path        varchar(255)     default ''                comment '输入路径',
  output_path       varchar(255)     default ''                comment '输出路径',
  algorithm_params  text                                       comment '算法参数',
  status            char(1)          default '0'               comment '状态（0未运行，1运行中，2已完成，3失败）',
  start_time        datetime                                   comment '开始时间',
  end_time          datetime                                   comment '结束时间',
  remark            varchar(255)          default ''           comment '备注',
  create_by         varchar(64)     default ''                 comment '创建者',
  create_time 	    datetime                                   comment '创建时间',
  update_by         varchar(64)     default ''                 comment '更新者',
  update_time       datetime                                   comment '更新时间',
  primary key (id)
) engine=innodb comment = '数据预处理表';

drop table if exists biz_extracted_features;
create table biz_extracted_features (
  id           bigint(20)      not null auto_increment    comment '编号',
  task_name         varchar(50)      default ''                comment '任务名称',
  algorithm_id      bigint(20)                                 comment '算法',
  input_path        varchar(255)     default ''                comment '输入路径',
  output_path       varchar(255)     default ''                comment '输出路径',
  algorithm_params  text                                       comment '算法参数',
  status            char(1)          default '0'               comment '状态（0未运行，1运行中，2已完成，3失败）',
  start_time        datetime                                   comment '开始时间',
  end_time          datetime                                   comment '结束时间',
  remark            varchar(255)          default ''           comment '备注',
  create_by         varchar(64)     default ''                 comment '创建者',
  create_time 	    datetime                                   comment '创建时间',
  update_by         varchar(64)     default ''                 comment '更新者',
  update_time       datetime                                   comment '更新时间',
  primary key (id)
) engine=innodb comment = '特征提取表';

drop table if exists biz_training;
create table biz_training (
  id           bigint(20)      not null auto_increment    comment '编号',
  task_name         varchar(50)      default ''                comment '任务名称',
  algorithm_id      bigint(20)                                 comment '算法',
  input_path        varchar(255)     default ''                comment '输入路径',
  output_path       varchar(255)     default ''                comment '输出路径',
  algorithm_params  text                                       comment '算法参数',
  status            char(1)          default '0'               comment '状态（0未运行，1运行中，2已完成，3失败）',
  start_time        datetime                                   comment '开始时间',
  end_time          datetime                                   comment '结束时间',
  remark            varchar(255)          default ''           comment '备注',
  create_by         varchar(64)     default ''                 comment '创建者',
  create_time 	    datetime                                   comment '创建时间',
  update_by         varchar(64)     default ''                 comment '更新者',
  update_time       datetime                                   comment '更新时间',
  primary key (id)
) engine=innodb comment = '模型训练表';

drop table if exists biz_distillation;
create table biz_distillation (
  id           bigint(20)      not null auto_increment    comment '编号',
  task_name         varchar(50)      default ''                comment '任务名称',
  algorithm_id      bigint(20)                                 comment '算法',
  input_path        varchar(255)     default ''                comment '输入路径',
  output_path       varchar(255)     default ''                comment '输出路径',
  algorithm_params  text                                       comment '算法参数',
  status            char(1)          default '0'               comment '状态（0未运行，1运行中，2已完成，3失败）',
  start_time        datetime                                   comment '开始时间',
  end_time          datetime                                   comment '结束时间',
  remark            varchar(255)          default ''           comment '备注',
  create_by         varchar(64)     default ''                 comment '创建者',
  create_time 	    datetime                                   comment '创建时间',
  update_by         varchar(64)     default ''                 comment '更新者',
  update_time       datetime                                   comment '更新时间',
  primary key (id)
) engine=innodb comment = '知识蒸馏表';

drop table if exists biz_classify_test;
create table biz_classify_test (
  id           bigint(20)      not null auto_increment    comment '编号',
  task_name         varchar(50)      default ''                comment '任务名称',
  algorithm_id      bigint(20)                                 comment '算法',
  input_path        varchar(255)     default ''                comment '输入路径',
  output_path       varchar(255)     default ''                comment '输出路径',
  algorithm_params  text                                       comment '算法参数',
  status            char(1)          default '0'               comment '状态（0未运行，1运行中，2已完成，3失败）',
  start_time        datetime                                   comment '开始时间',
  end_time          datetime                                   comment '结束时间',
  remark            varchar(255)          default ''           comment '备注',
  create_by         varchar(64)     default ''                 comment '创建者',
  create_time 	    datetime                                   comment '创建时间',
  update_by         varchar(64)     default ''                 comment '更新者',
  update_time       datetime                                   comment '更新时间',
  primary key (id)
) engine=innodb comment = '分类测试表';

--drop table if exists gen_child_tables;
--CREATE TABLE `gen_child_tables` (
--  `table_ref_id` varchar(64) NOT NULL COMMENT '主键ID',
--  `table_id` varchar(64) DEFAULT NULL COMMENT '业务对象id',
--  `table_name` varchar(255) DEFAULT NULL COMMENT '表名',
--  `child_table_id` varchar(64) DEFAULT NULL COMMENT '子业务对象id',
--  `child_table_name` varchar(255) DEFAULT NULL COMMENT '子表名',
--  `rel_field` varchar(255) DEFAULT NULL COMMENT '关联字段',
--  `rel_field_name` varchar(255) DEFAULT NULL COMMENT '关联字段名称',
--  `name` varchar(255) DEFAULT NULL COMMENT '父子业务对象关系',
--  `desc_text` varchar(512) DEFAULT NULL COMMENT '父子业务对象关系描述',
--  `remark`            varchar(255)          default ''           comment '备注',
--  `create_by`         varchar(64)     default ''                 comment '创建者',
--  `create_time` 	    datetime                                   comment '创建时间',
--  `update_by`         varchar(64)     default ''                 comment '更新者',
--  `update_time`       datetime                                   comment '更新时间',
--  PRIMARY KEY (`table_ref_id`)
--) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='父子表关系表';
--
--CREATE TABLE `gen_page` (
--  `page_id` varchar(64) NOT NULL COMMENT '页面ID',
--  `table_id` bigint(20) DEFAULT NULL COMMENT '关联表ID',
--  `name` varchar(255) DEFAULT NULL COMMENT '页面名称',
--  `desc_text` varchar(512) DEFAULT NULL COMMENT '页面描述',
--  `config` text DEFAULT NULL COMMENT '页面配置信息',
--  `version` bigint(20) DEFAULT NULL COMMENT '版本号',
--  `remark`            varchar(255)          default ''           comment '备注',
--  `create_by`         varchar(64)     default ''                 comment '创建者',
--  `create_time` 	    datetime                                   comment '创建时间',
--  `update_by`         varchar(64)     default ''                 comment '更新者',
--  `update_time`       datetime                                   comment '更新时间',
--  PRIMARY KEY (`page_id`)
--) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='页面配置表';


-- 菜单 SQL
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('算法配置', '0', '1', 'config', 'biz/config/index', 1, 0, 'C', '0', '0', 'biz:config:list', '#', 'admin', sysdate(), '', null, '算法配置菜单');

-- 按钮父菜单ID
SELECT @parentId := LAST_INSERT_ID();

-- 按钮 SQL
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('算法配置查询', @parentId, '1',  '#', '', 1, 0, 'F', '0', '0', 'biz:config:query',        '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('算法配置新增', @parentId, '2',  '#', '', 1, 0, 'F', '0', '0', 'biz:config:add',          '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('算法配置修改', @parentId, '3',  '#', '', 1, 0, 'F', '0', '0', 'biz:config:edit',         '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('算法配置删除', @parentId, '4',  '#', '', 1, 0, 'F', '0', '0', 'biz:config:remove',       '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('算法配置导出', @parentId, '5',  '#', '', 1, 0, 'F', '0', '0', 'biz:config:export',       '#', 'admin', sysdate(), '', null, '');

-- 菜单 SQL
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('特征提取', '3', '1', 'features', 'biz/features/index', 1, 0, 'C', '0', '0', 'biz:features:list', '#', 'admin', sysdate(), '', null, '特征提取菜单');

-- 按钮父菜单ID
SELECT @parentId := LAST_INSERT_ID();

-- 按钮 SQL
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('特征提取查询', @parentId, '1',  '#', '', 1, 0, 'F', '0', '0', 'biz:features:query',        '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('特征提取新增', @parentId, '2',  '#', '', 1, 0, 'F', '0', '0', 'biz:features:add',          '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('特征提取修改', @parentId, '3',  '#', '', 1, 0, 'F', '0', '0', 'biz:features:edit',         '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('特征提取删除', @parentId, '4',  '#', '', 1, 0, 'F', '0', '0', 'biz:features:remove',       '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('特征提取导出', @parentId, '5',  '#', '', 1, 0, 'F', '0', '0', 'biz:features:export',       '#', 'admin', sysdate(), '', null, '');


-- 菜单 SQL
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('数据预处理', '3', '1', 'preprocessed', 'biz/preprocessed/index', 1, 0, 'C', '0', '0', 'biz:preprocessed:list', '#', 'admin', sysdate(), '', null, '数据预处理菜单');

-- 按钮父菜单ID
SELECT @parentId := LAST_INSERT_ID();

-- 按钮 SQL
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('数据预处理查询', @parentId, '1',  '#', '', 1, 0, 'F', '0', '0', 'biz:preprocessed:query',        '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('数据预处理新增', @parentId, '2',  '#', '', 1, 0, 'F', '0', '0', 'biz:preprocessed:add',          '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('数据预处理修改', @parentId, '3',  '#', '', 1, 0, 'F', '0', '0', 'biz:preprocessed:edit',         '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('数据预处理删除', @parentId, '4',  '#', '', 1, 0, 'F', '0', '0', 'biz:preprocessed:remove',       '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('数据预处理导出', @parentId, '5',  '#', '', 1, 0, 'F', '0', '0', 'biz:preprocessed:export',       '#', 'admin', sysdate(), '', null, '');

-- 菜单 SQL
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('分类测试', '0', '1', 'test', 'biz/test/index', 1, 0, 'C', '0', '0', 'biz:test:list', '#', 'admin', sysdate(), '', null, '分类测试菜单');

-- 按钮父菜单ID
SELECT @parentId := LAST_INSERT_ID();

-- 按钮 SQL
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('分类测试查询', @parentId, '1',  '#', '', 1, 0, 'F', '0', '0', 'biz:test:query',        '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('分类测试新增', @parentId, '2',  '#', '', 1, 0, 'F', '0', '0', 'biz:test:add',          '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('分类测试修改', @parentId, '3',  '#', '', 1, 0, 'F', '0', '0', 'biz:test:edit',         '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('分类测试删除', @parentId, '4',  '#', '', 1, 0, 'F', '0', '0', 'biz:test:remove',       '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('分类测试导出', @parentId, '5',  '#', '', 1, 0, 'F', '0', '0', 'biz:test:export',       '#', 'admin', sysdate(), '', null, '');

-- 菜单 SQL
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('模型训练', '3', '1', 'training', 'biz/training/index', 1, 0, 'C', '0', '0', 'biz:training:list', '#', 'admin', sysdate(), '', null, '模型训练菜单');

-- 按钮父菜单ID
SELECT @parentId := LAST_INSERT_ID();

-- 按钮 SQL
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('模型训练查询', @parentId, '1',  '#', '', 1, 0, 'F', '0', '0', 'biz:training:query',        '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('模型训练新增', @parentId, '2',  '#', '', 1, 0, 'F', '0', '0', 'biz:training:add',          '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('模型训练修改', @parentId, '3',  '#', '', 1, 0, 'F', '0', '0', 'biz:training:edit',         '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('模型训练删除', @parentId, '4',  '#', '', 1, 0, 'F', '0', '0', 'biz:training:remove',       '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('模型训练导出', @parentId, '5',  '#', '', 1, 0, 'F', '0', '0', 'biz:training:export',       '#', 'admin', sysdate(), '', null, '');

-- 菜单 SQL
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('知识蒸馏', '0', '1', 'distillation', 'biz/distillation/index', 1, 0, 'C', '0', '0', 'biz:distillation:list', '#', 'admin', sysdate(), '', null, '知识蒸馏菜单');

-- 按钮父菜单ID
SELECT @parentId := LAST_INSERT_ID();

-- 按钮 SQL
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('知识蒸馏查询', @parentId, '1',  '#', '', 1, 0, 'F', '0', '0', 'biz:distillation:query',        '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('知识蒸馏新增', @parentId, '2',  '#', '', 1, 0, 'F', '0', '0', 'biz:distillation:add',          '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('知识蒸馏修改', @parentId, '3',  '#', '', 1, 0, 'F', '0', '0', 'biz:distillation:edit',         '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('知识蒸馏删除', @parentId, '4',  '#', '', 1, 0, 'F', '0', '0', 'biz:distillation:remove',       '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('知识蒸馏导出', @parentId, '5',  '#', '', 1, 0, 'F', '0', '0', 'biz:distillation:export',       '#', 'admin', sysdate(), '', null, '');