-- 修改权限组表
ALTER TABLE EC_B_PRIVILEGE_GROUP DROP INDEX UK_fsdvgdf02vmgi4nuq3k7hxbgy;
ALTER TABLE EC_B_PRIVILEGE_GROUP DROP INDEX UK_gtfc2sf4qnyb50v8wavhutcdy;
ALTER TABLE EC_B_PRIVILEGE_GROUP ADD type VARCHAR(50) NOT NULL;
ALTER TABLE EC_B_PRIVILEGE_GROUP ADD root_org_id BIGINT NULL;
ALTER TABLE EC_B_PRIVILEGE_GROUP ADD CONSTRAINT IDX_B_PRI_G_002001 UNIQUE (`code`);  
ALTER TABLE EC_B_PRIVILEGE_GROUP ADD CONSTRAINT IDX_B_PRI_G_002002 UNIQUE (root_org_id,type); 

-- 权限组表更新数据
UPDATE ec_b_privilege_group set type='ADMIN_MENU' where id in (0,1,2,3,4,5,7) and 1=2;
UPDATE ec_b_privilege_group set type='FUNCTION' where id in (8);
UPDATE ec_b_privilege_group set type='DATA_ACCESS' where id in (9);

-- 权限组表新增数据
INSERT INTO `ec_b_privilege_group`(`id`, `creation_time`, `update_time`, `code`, `name`, `type`, `root_org_id`, `ext1`, `ext2`, `ext3`, `ext4`, `ext5`) VALUES (10, '2020-03-26 15:02:16', '2020-03-26 15:02:16', 'STUDENT_CLIENT_MENU', '考生端菜单', 'STUDENT_CLIENT_MENU', NULL, 'menu', NULL, NULL, NULL, NULL);

-- 权限表新增数据
INSERT INTO `ec_b_privilege`(`id`, `creation_time`, `update_time`, `code`, `description`, `ext1`, `ext2`, `ext3`, `ext4`, `ext5`, `group_id`, `name`, `parent_id`, `weight`) VALUES (6542, '2020-03-26 15:24:04', '2020-03-26 15:43:33', 'stu_online_exam', '在线考试', 'ONLINE', NULL, NULL, NULL, NULL, 10, '在线考试', NULL, 6);
INSERT INTO `ec_b_privilege`(`id`, `creation_time`, `update_time`, `code`, `description`, `ext1`, `ext2`, `ext3`, `ext4`, `ext5`, `group_id`, `name`, `parent_id`, `weight`) VALUES (6543, '2020-03-26 15:25:05', '2020-03-26 15:29:24', 'stu_online_homework', '在线作业', NULL, NULL, NULL, NULL, NULL, 10, '在线作业', NULL, 5);
INSERT INTO `ec_b_privilege`(`id`, `creation_time`, `update_time`, `code`, `description`, `ext1`, `ext2`, `ext3`, `ext4`, `ext5`, `group_id`, `name`, `parent_id`, `weight`) VALUES (6544, '2020-03-26 15:26:10', '2020-03-26 15:29:29', 'stu_online_practice', '在线练习', NULL, NULL, NULL, NULL, NULL, 10, '在线练习', NULL, 4);
INSERT INTO `ec_b_privilege`(`id`, `creation_time`, `update_time`, `code`, `description`, `ext1`, `ext2`, `ext3`, `ext4`, `ext5`, `group_id`, `name`, `parent_id`, `weight`) VALUES (6545, '2020-03-26 15:26:39', '2020-03-26 15:29:53', 'stu_offline_exam', '离线考试', NULL, NULL, NULL, NULL, NULL, 10, '离线考试', NULL, 3);
INSERT INTO `ec_b_privilege`(`id`, `creation_time`, `update_time`, `code`, `description`, `ext1`, `ext2`, `ext3`, `ext4`, `ext5`, `group_id`, `name`, `parent_id`, `weight`) VALUES (6546, '2020-03-26 15:27:05', '2020-03-26 15:30:00', 'stu_notice', '公告通知', NULL, NULL, NULL, NULL, NULL, 10, '公告通知', NULL, 2);
INSERT INTO `ec_b_privilege`(`id`, `creation_time`, `update_time`, `code`, `description`, `ext1`, `ext2`, `ext3`, `ext4`, `ext5`, `group_id`, `name`, `parent_id`, `weight`) VALUES (6547, '2020-03-26 15:28:55', '2020-03-26 15:30:05', 'stu_modify_pwd', '修改密码', NULL, NULL, NULL, NULL, NULL, 10, '修改密码', NULL, 1);



-- 添加违纪类型表
CREATE TABLE `ec_oe_illegally_type`  (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `creation_time` datetime(0) NOT NULL,
  `update_time` datetime(0) NOT NULL,
  `code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `data_category` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `enable` bit(1) NOT NULL,
  `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `root_org_id` bigint(20) NOT NULL,
  `sort_no` int(11) NOT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `IDX_E_O_I_T_001`(`root_org_id`, `code`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 13 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;

-- 初始化违纪类型表
INSERT INTO `ec_oe_illegally_type`(`id`, `creation_time`, `update_time`, `code`, `data_category`, `enable`, `name`, `root_org_id`, `sort_no`) VALUES (1, '2020-03-17 11:48:49', '2020-03-17 11:48:49', 'POWER_FAILURE', 'SYSTEM', b'1', '断电', -1, 7);
INSERT INTO `ec_oe_illegally_type`(`id`, `creation_time`, `update_time`, `code`, `data_category`, `enable`, `name`, `root_org_id`, `sort_no`) VALUES (2, '2020-03-17 11:48:49', '2020-03-17 11:48:49', 'MACHINE_STOPPAGE', 'SYSTEM', b'1', '机器故障', -1, 9);
INSERT INTO `ec_oe_illegally_type`(`id`, `creation_time`, `update_time`, `code`, `data_category`, `enable`, `name`, `root_org_id`, `sort_no`) VALUES (5, '2020-03-17 11:48:49', '2020-03-17 11:48:49', 'OTHER', 'SYSTEM', b'1', '其他', -1, 10);
INSERT INTO `ec_oe_illegally_type`(`id`, `creation_time`, `update_time`, `code`, `data_category`, `enable`, `name`, `root_org_id`, `sort_no`) VALUES (6, '2020-03-17 11:48:49', '2020-03-17 11:48:49', 'CHEAT', 'SYSTEM', b'1', '作弊', -1, 1);
INSERT INTO `ec_oe_illegally_type`(`id`, `creation_time`, `update_time`, `code`, `data_category`, `enable`, `name`, `root_org_id`, `sort_no`) VALUES (7, '2020-03-17 11:48:49', '2020-03-17 11:48:49', 'NOT_ONESELF', 'SYSTEM', b'1', '他人替考', -1, 2);
INSERT INTO `ec_oe_illegally_type`(`id`, `creation_time`, `update_time`, `code`, `data_category`, `enable`, `name`, `root_org_id`, `sort_no`) VALUES (8, '2020-03-17 11:48:49', '2020-03-17 11:48:49', 'ACTION_FAILURE', 'SYSTEM', b'1', '指定动作失败', -1, 4);
INSERT INTO `ec_oe_illegally_type`(`id`, `creation_time`, `update_time`, `code`, `data_category`, `enable`, `name`, `root_org_id`, `sort_no`) VALUES (9, '2020-03-17 11:48:49', '2020-03-17 11:48:49', 'WITHOUT_ACTION', 'SYSTEM', b'1', '未进行人脸指定动作检测', -1, 8);
INSERT INTO `ec_oe_illegally_type`(`id`, `creation_time`, `update_time`, `code`, `data_category`, `enable`, `name`, `root_org_id`, `sort_no`) VALUES (10, '2020-03-17 11:48:49', '2020-03-17 11:48:49', 'BATCH_PASS', 'SYSTEM', b'1', '批量审核通过', -1, 6);
INSERT INTO `ec_oe_illegally_type`(`id`, `creation_time`, `update_time`, `code`, `data_category`, `enable`, `name`, `root_org_id`, `sort_no`) VALUES (11, '2020-03-17 11:48:49', '2020-03-17 11:48:49', 'BATCH_NOTPASS', 'SYSTEM', b'1', '批量审核不通过', -1, 5);
INSERT INTO `ec_oe_illegally_type`(`id`, `creation_time`, `update_time`, `code`, `data_category`, `enable`, `name`, `root_org_id`, `sort_no`) VALUES (12, '2020-03-17 11:48:49', '2020-03-17 11:48:49', 'NOT_ONESELF_OF_PHOTO', 'SYSTEM', b'1', '相片替考', -1, 3);

-- 考生表新加字段
ALTER TABLE ec_oe_exam_student ADD reexamine_type VARCHAR(50) NULL;
ALTER TABLE ec_oe_exam_student ADD reexamine_detail VARCHAR(200) NULL;

-- 考试记录表新加字段
ALTER TABLE ec_oe_exam_record_data ADD reexamine_type VARCHAR(50) NULL;
ALTER TABLE ec_oe_exam_record_data ADD reexamine_detail VARCHAR(200) NULL;

-- 审核表新加违纪类型字段
ALTER TABLE ec_oe_exam_audit ADD illegally_type_id BIGINT NULL;


