-- -------------补考-----------
update basic_exam t set t.category = 'MAKEUP' where t.category = 'ONLINE';
update basic_exam t set t.category = 'FORMAL' where t.category = 'OFFLINE';

ALTER TABLE `exam_print_plan` ADD COLUMN `category` VARCHAR(10) NULL COMMENT '考试类型' AFTER `org_id`;

update exam_print_plan t set t.category = 'FORMAL' where t.category is null;

INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('193', '补考任务查询', '/api/admin/exam/print/list_makeup_task', 'URL', '43', '5', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('194', '补考任务保存', '/api/admin/exam/print/save_makeup_task', 'URL', '43', '6', 'AUTH', '1', '1', '1');

UPDATE `sys_privilege` SET `related` = '50,49,193,194,621' WHERE (`id` = '310');


-- --------------3.3.1新需求--------------
ALTER TABLE `mark_paper`
    ADD COLUMN `open_double_marking` BIGINT(1) NULL DEFAULT 0 COMMENT '是否开启双评：true-开启，false-关闭' AFTER `paper_type`;

ALTER TABLE `basic_card_rule`
    ADD COLUMN `first_level_subheading` VARCHAR(200) NULL COMMENT '一级副标题' AFTER `fill_number`,
ADD COLUMN `second_level_subheading` VARCHAR(200) NULL COMMENT '二级副标题' AFTER `first_level_subheading`;

ALTER TABLE `exam_task`
DROP INDEX `idx_school_id_paper_number` ,
ADD INDEX `idx_school_id_paper_number` USING BTREE (`exam_id`, `paper_number`) VISIBLE;

INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(2000, '目标达成度', 'TargetDegreeManage', 'MENU', NULL, 13, NULL, NULL, 1, 0, 1);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(2001, '成绩管理', 'TargetScoreManage', 'MENU', 2000, 1, NULL, '2003,2004,2005', 1, 0, 1);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(2002, '报告管理', 'TargetReportManage', 'MENU', 2000, 2, NULL, '2021,2022,2023', 1, 0, 1);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(2003, '列表', 'List', 'LIST', 2001, 1, 'AUTH', '2007', 1, 0, 1);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(2004, '查询条件', 'Condition', 'CONDITION', 2001, 2, 'AUTH', '2007', 1, 0, 1);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(2005, '查询', 'Select', 'BUTTON', 2001, 3, 'AUTH', '2007', 1, 0, 1);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(2006, '管理成绩', 'Score', 'LINK', 2001, 1, 'AUTH', '2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020,2029', 1, 0, 1);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(2007, '列表', '/api/admin/course/degree/score/list', 'URL', 2001, 1, 'AUTH', NULL, 1, 1, 1);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(2008, '平时成绩-下载模版', '/api/admin/course/degree/score/template_download', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(2009, '平时成绩-导入模版', '/api/admin/course/degree/score/import', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(2010, '平时成绩列表', '/api/admin/course/degree/score/normal/list', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(2011, '平时成绩编辑', '/api/admin/course/degree/score/normal/edit', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(2012, '平时成绩保存', '/api/admin/course/degree/score/normal/save', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(2013, '平时成绩启用/禁用', '/api/admin/course/degree/score/normal/enable', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(2014, '期末成绩-下载模版', '/api/admin/course/degree/score/end_exam/template_download', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(2015, '期末成绩-导入模版', '/api/admin/course/degree/score/end_exam/import', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(2016, '期末成绩列表', '/api/admin/course/degree/score/end_exam/list', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(2017, '期末成绩编辑', '/api/admin/course/degree/score/end_exam/edit', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(2018, '期末成绩保存', '/api/admin/course/degree/score/end_exam/save', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(2019, '期末成绩启用/禁用', '/api/admin/course/degree/score/end_exam/enable', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(2020, '保存试卷蓝图', '/api/admin/course/degree/score/end_exam/paper_positive/save', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(2021, '列表', 'List', 'LIST', 2002, 1, 'AUTH', '2024', 1, 0, 1);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(2022, '查询条件', 'Condition', 'CONDITION', 2002, 2, 'AUTH', '2024', 1, 0, 1);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(2023, '查询', 'Select', 'BUTTON', 2002, 3, 'AUTH', '2024', 1, 0, 1);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(2024, '列表', '/api/admin/course/degree/report/list', 'URL', 2002, 1, 'AUTH', NULL, 1, 1, 1);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(2025, '查看报告', 'View', 'LINK', 2002, 1, 'AUTH', '2026,2027,2028', 1, 0, 1);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(2026, '查看报告', '/api/admin/course/degree/report/view', 'URL', 2025, 1, 'AUTH', NULL, 1, 1, 1);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(2027, '导出报告', '/api/admin/course/degree/report/export', 'URL', 2025, 1, 'AUTH', NULL, 1, 1, 1);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(2028, '保存报告', '/api/admin/course/degree/report/save', 'URL', 2025, 1, 'AUTH', NULL, 1, 1, 1);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(2029, '获取试卷蓝图信息', '/api/admin/course/degree/score/end_exam/paper_positive/query', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);

--2024/2/18
DROP TABLE IF EXISTS `t_c_paper_positive`;
CREATE TABLE `t_c_paper_positive` (
                                      `id` bigint NOT NULL COMMENT '主键',
                                      `exam_id` bigint NOT NULL COMMENT '考试id',
                                      `course_code` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT '课程编码',
                                      `course_name` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT '课程名称',
                                      `paper_number` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT '试卷编码',
                                      `paper_struct` mediumtext NOT NULL COMMENT '试卷结构',
                                      `enable` tinyint NOT NULL DEFAULT '1' COMMENT '是否启用，0：停用，1：启用',
                                      `create_id` bigint DEFAULT NULL COMMENT '创建人id',
                                      `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                                      `update_id` bigint DEFAULT NULL COMMENT '更新人id',
                                      `update_time` bigint DEFAULT NULL COMMENT '更新时间',
                                      PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='试卷蓝图表';

DROP TABLE IF EXISTS `t_c_score_end_exam`;
CREATE TABLE `t_c_score_end_exam` (
                                      `id` bigint NOT NULL COMMENT '主键',
                                      `exam_id` bigint NOT NULL COMMENT '考试id',
                                      `course_code` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT '课程编码',
                                      `course_name` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT '课程名称',
                                      `paper_number` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT '试卷编码',
                                      `name` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT '考生姓名',
                                      `exam_number` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT '学号',
                                      `score` double NOT NULL COMMENT '分数',
                                      `score_detail` mediumtext NOT NULL COMMENT '成绩明细',
                                      `enable` tinyint NOT NULL DEFAULT '1' COMMENT '是否启用，0：停用，1：启用',
                                      `create_id` bigint DEFAULT NULL COMMENT '创建人id',
                                      `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                                      `update_id` bigint DEFAULT NULL COMMENT '更新人id',
                                      `update_time` bigint DEFAULT NULL COMMENT '更新时间',
                                      PRIMARY KEY (`id`),
                                      UNIQUE KEY `t_c_score_end_exam_unique` (`exam_id`,`course_code`,`course_name`,`paper_number`,`name`,`exam_number`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='期末考试成绩表';

DROP TABLE IF EXISTS `t_c_score_normal`;
CREATE TABLE `t_c_score_normal` (
                                    `id` bigint NOT NULL COMMENT '主键',
                                    `exam_id` bigint NOT NULL COMMENT '考试id',
                                    `course_code` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT '课程编码',
                                    `course_name` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT '课程名称',
                                    `paper_number` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT '试卷编码',
                                    `name` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT '考生姓名',
                                    `exam_number` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT '学号',
                                    `score_normal` mediumtext NOT NULL COMMENT '平常作业分数',
                                    `enable` tinyint NOT NULL DEFAULT '1' COMMENT '是否启用，0：停用，1：启用',
                                    `create_id` bigint DEFAULT NULL COMMENT '创建人id',
                                    `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                                    `update_id` bigint DEFAULT NULL COMMENT '更新人id',
                                    `update_time` bigint DEFAULT NULL COMMENT '更新时间',
                                    PRIMARY KEY (`id`),
                                    UNIQUE KEY `t_c_score_normal_unique` (`exam_id`,`course_code`,`course_name`,`paper_number`,`name`,`exam_number`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='平常作业成绩表';

DROP TABLE IF EXISTS `t_r_basic_info`;
CREATE TABLE `t_r_basic_info` (
                                  `id` bigint NOT NULL COMMENT '主键',
                                  `exam_id` bigint NOT NULL COMMENT '考试id',
                                  `course_code` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT '课程编码',
                                  `course_name` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT '课程名称',
                                  `paper_number` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT '试卷编码',
                                  `course_type` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '课程性质',
                                  `evaluation_mode` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '考核方式',
                                  `open_time` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '开课时间',
                                  `teaching_object` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '授课对象',
                                  `number_of_select` int DEFAULT NULL COMMENT '选课人数',
                                  `number_of_participants` int DEFAULT NULL COMMENT '参评人数',
                                  `course_degree` double DEFAULT NULL COMMENT '课程目标达成度期望值',
                                  `teach` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '任课老师',
                                  `appraise_duty_user` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '评价责任人',
                                  `appraise_partake_user` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '评价参与人',
                                  `enable` tinyint NOT NULL DEFAULT '1' COMMENT '是否启用，0：停用，1：启用',
                                  `create_id` bigint DEFAULT NULL COMMENT '创建人id',
                                  `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                                  `update_id` bigint DEFAULT NULL COMMENT '更新人id',
                                  `update_time` bigint DEFAULT NULL COMMENT '更新时间',
                                  `course_evaluation_spread` mediumtext DEFAULT NULL COMMENT '课程目标考核分布',
                                  `course_evaluation_result` mediumtext DEFAULT NULL COMMENT '课程考核成绩评价结果',
                                  `course_evaluation_result_detail` mediumtext DEFAULT NULL COMMENT '课程考核成绩评价明细结果',
                                  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='报告基本情况表';


DROP TABLE IF EXISTS `t_r_exam_student`;
CREATE TABLE `t_r_exam_student` (
                                    `id` bigint NOT NULL COMMENT '主键',
                                    `r_basic_info_id` bigint NOT NULL COMMENT '报告id',
                                    `name` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '考生姓名',
                                    `exam_number` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '学号',
                                    `clazz` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '行政班级',
                                    `score` double COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '学生成绩',
                                    `result_detail` mediumtext DEFAULT NULL COMMENT '考生课程考核成绩评价明细结果',
                                    PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='报告考生表';