drop table if exists biz_sample_t;
create table biz_sample_t (
  id           bigint(20)      not null auto_increment    comment '编号',
  sample_type       varchar(127)      default ''                 comment '样片类型',
  sample_model      varchar(127)     default ''                 comment '样片型号',
  sample_image      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_emi_measurement_t;
create table biz_emi_measurement_t (
  id                 bigint(20)      not null auto_increment    comment '编号',
  sample_model       varchar(127)                     comment '样片型号',
  temperature_k      INT                             comment '温度(K)',
  wavelength_um      DECIMAL(10,2)                   comment '波段(μm)',
  emi_correction1    DECIMAL(10,4)                  comment 'EMI-修正1',
  emi_correction2    DECIMAL(10,4)                    comment 'EMI-修正2',
  emi_correction3    DECIMAL(10,4)                   comment 'EMI-修正3',
  emi_correction4    DECIMAL(10,4)                    comment 'EMI-修正4',
  emi_correction5    DECIMAL(10,4)                    comment 'EMI-修正5',
  mean_value         DECIMAL(10,4)                    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_integrated_data_t;
create table biz_integrated_data_t (
  id                 bigint(20)      not null auto_increment    comment '编号',
  sample_model       varchar(127)                     comment '样片型号',
  temperature_k      INT                             comment '温度(K)',
  wavelength_um      varchar(63)                  comment '波段(μm)',
  integral_value1    DECIMAL(10,4)                  comment '积分值1',
  integral_value2    DECIMAL(10,4)                    comment '积分值2',
  integral_value3    DECIMAL(10,4)                   comment '积分值3',
  integral_value4    DECIMAL(10,4)                    comment '积分值4',
  integral_value5    DECIMAL(10,4)                    comment '积分值5',
  standard_dev       DECIMAL(10,4)                    comment 'STDEV',
  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_brdf_data_t;
create table biz_brdf_data_t (
  id                 bigint(20)      not null auto_increment    comment '编号',
  sample_model       varchar(127)                     comment '样片型号',
  temperature_k      INT                             comment '温度(K)',
  wavelength_um      varchar(63)                  comment '波段(μm)',
  theta_incident     DECIMAL(10,4)                  comment '入射天顶角θi',
  phi_incident       DECIMAL(10,4)                    comment '入射方位角φi',
  theta_reflected    DECIMAL(10,4)                  comment '反射天顶角θr',
  phi_reflected      DECIMAL(10,4)                    comment '反射方位角φr',
  measurement_1      DECIMAL(10,3)                   comment '重复测量1',
  measurement_2      DECIMAL(10,3)                   comment '重复测量2',
  measurement_3      DECIMAL(10,3)                   comment '重复测量3',
  measurement_4      DECIMAL(10,3)                   comment '重复测量4',
  measurement_5      DECIMAL(10,3)                   comment '重复测量5',
  mean_value         DECIMAL(10,3)                   comment '均值',
  repeatability_pct  DECIMAL(10,3)                   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 = 'BRDF表';

-- 菜单 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('BRDF数据', '2000', '1', 'BRDF', 'manage/BRDF/index', 1, 0, 'C', '0', '0', 'manage:BRDF:list', '#', 'admin', sysdate(), '', null, 'BRDF数据菜单');

-- 按钮父菜单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('BRDF数据查询', @parentId, '1',  '#', '', 1, 0, 'F', '0', '0', 'manage:BRDF: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('BRDF数据新增', @parentId, '2',  '#', '', 1, 0, 'F', '0', '0', 'manage:BRDF: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('BRDF数据修改', @parentId, '3',  '#', '', 1, 0, 'F', '0', '0', 'manage:BRDF: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('BRDF数据删除', @parentId, '4',  '#', '', 1, 0, 'F', '0', '0', 'manage:BRDF: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('BRDF数据导出', @parentId, '5',  '#', '', 1, 0, 'F', '0', '0', 'manage:BRDF: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('测量数据', '2000', '1', 'emiMeasure', 'manage/emiMeasure/index', 1, 0, 'C', '0', '0', 'manage:emiMeasure: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', 'manage:emiMeasure: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', 'manage:emiMeasure: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', 'manage:emiMeasure: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', 'manage:emiMeasure: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', 'manage:emiMeasure: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('积分数据', '2000', '1', 'integrated', 'manage/integrated/index', 1, 0, 'C', '0', '0', 'manage:integrated: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', 'manage:integrated: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', 'manage:integrated: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', 'manage:integrated: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', 'manage:integrated: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', 'manage:integrated: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('样片管理', '2000', '1', 'sample', 'manage/sample/index', 1, 0, 'C', '0', '0', 'manage:sample: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', 'manage:sample: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', 'manage:sample: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', 'manage:sample: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', 'manage:sample: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', 'manage:sample:export',       '#', 'admin', sysdate(), '', null, '');