USE teachcloud_db;

-- -------------补考-----------
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`;

DROP TABLE IF EXISTS `t_b_task_pdf`;
CREATE TABLE `t_b_task_pdf` (
                                `id` bigint NOT NULL COMMENT '主键（与exam_detail表id一致）',
                                `school_id` bigint NOT NULL COMMENT '学校id',
                                `semester_id` bigint DEFAULT NULL COMMENT '学期ID',
                                `exam_id` bigint DEFAULT NULL COMMENT '考试ID',
                                `print_plan_id` bigint NOT NULL COMMENT '印刷计划id',
                                `course_name_code` mediumtext COMMENT '课程名称',
                                `paper_number` mediumtext COMMENT '试卷编号',
                                `create_type` varchar(45) DEFAULT NULL COMMENT '生成pdf类型：ALL("全部"),PAPER("试卷"),CARD_A3("题卡"),SIGN("签到表"),PACKAGE("卷袋贴"),CHECK_IN("登记表")',
                                `status` varchar(30) NOT NULL COMMENT '任务状态，INIT：未开始，RUNNING：进行中，FINISH：已完成',
                                `summary` mediumtext COMMENT '实时摘要信息',
                                `result` varchar(30) DEFAULT NULL COMMENT '数据结果，SUCCESS：成功，ERROR：失败',
                                `create_id` bigint DEFAULT NULL COMMENT '创建人',
                                `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                                `update_id` bigint DEFAULT NULL COMMENT '更新人',
                                `update_time` bigint DEFAULT NULL COMMENT '更新时间',
                                `remark` mediumtext COMMENT '备注',
                                PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='pdf生成日志表';

insert into t_b_task_pdf(id, school_id, semester_id, exam_id, print_plan_id, course_name_code, paper_number, status, summary, result) select a.entity_id, a.school_id, a.semester_id, a.exam_id, a.print_plan_id, a.course_name_code, a.paper_number,a.status, a.summary, a.result  from (select id, entity_id, school_id, semester_id, exam_id, print_plan_id, case when course_name is null then null else concat(course_name, '（', course_code, '）') end as course_name_code, paper_number,status, summary, result from t_b_task where type = 'CREATE_PDF' and entity_id is not null) a join (SELECT entity_id, min(id) min_id FROM t_b_task where type = 'CREATE_PDF' group by entity_id having entity_id is not null ) b on a.entity_id = b.entity_id and a.id = b.min_id;
update t_b_task_pdf set create_type = 'ALL';

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

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/usual_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/usual_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/usual_score/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/usual_score/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/usual_score/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/usual_score/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/final_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(2016, '期末成绩列表', '/api/admin/course/degree/final_score/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/final_score/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/final_score/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/final_score/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/final_score/paper_struct/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/final_score/paper_struct/query', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);

-- 2024/2/18
DROP TABLE IF EXISTS `t_c_paper_struct`;
CREATE TABLE `t_c_paper_struct` (
                                      `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_final_score`;
CREATE TABLE `t_c_final_score` (
                                      `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 '考生姓名',
                                      `student_code` 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`,`student_code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='期末考试成绩表';

DROP TABLE IF EXISTS `t_c_usual_score`;
CREATE TABLE `t_c_usual_score` (
                                    `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 '考生姓名',
                                    `student_code` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT '学号',
                                    `score` 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`,`student_code`)
) 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 '授课对象',
                                  `selection_count` int DEFAULT NULL COMMENT '选课人数',
                                  `participant_count` int DEFAULT NULL COMMENT '参评人数',
                                  `course_degree` double DEFAULT NULL COMMENT '课程目标达成度期望值',
                                  `teacher` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '任课老师',
                                  `director` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '评价责任人',
                                  `participant` 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 '考生姓名',
                                    `student_code` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '学号',
                                    `administrative_class` 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='报告考生表';

ALTER TABLE t_r_basic_info ADD credit varchar(50) NULL COMMENT '学分';
ALTER TABLE t_r_basic_info CHANGE credit credit varchar(50) NULL COMMENT '学分' AFTER course_type;
ALTER TABLE t_r_basic_info ADD period varchar(50) NULL COMMENT '学时';
ALTER TABLE t_r_basic_info CHANGE period period varchar(50) NULL COMMENT '学时' AFTER credit;

-- 2014/2/26
DROP TABLE IF EXISTS `exam_task_assign_paper_type`;
CREATE TABLE `exam_task_assign_paper_type` (
           `exam_id` bigint NOT NULL COMMENT '考试ID',
           `paper_number` varchar(100) NOT NULL COMMENT '试卷编号',
           `exam_start_time` bigint NOT NULL COMMENT '考试时间（开始）',
           `exam_end_time` bigint NOT NULL COMMENT '考试时间（结束）',
           `paper_type` varchar(45) DEFAULT NULL COMMENT '卷型',
           `assign_mode` varchar(10) DEFAULT NULL COMMENT '分配方式：MANUAL-手动关联，AUTO-自动分配',
           PRIMARY KEY (`exam_id`,`paper_number`,`exam_start_time`,`exam_end_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

CREATE TABLE `course_target` (
                                 `id` BIGINT(20) NOT NULL COMMENT 'id',
                                 `school_id` BIGINT(20) NOT NULL COMMENT '学校id',
                                 `exam_id` BIGINT(20) NOT NULL COMMENT '考试id',
                                 `course_code` VARCHAR(20) NOT NULL COMMENT '课程编号',
                                 `target_name` VARCHAR(50) NULL COMMENT '课程目标',
                                 `target_content` MEDIUMTEXT NULL COMMENT '毕业要求指标',
                                 `degree_requirement` VARCHAR(255) NULL COMMENT '毕业要求',
                                 `total_weight` DECIMAL(6 , 2 ) NULL COMMENT '课程目标整体权重',
                                 `create_id` BIGINT(20) NULL COMMENT '创建人',
                                 `create_time` BIGINT(20) NULL COMMENT '创建时间',
                                 `update_id` BIGINT(20) NULL COMMENT '更新人',
                                 `update_time` BIGINT(20) NULL COMMENT '更新时间',
                                 PRIMARY KEY (`id`)
)  ENGINE=INNODB DEFAULT CHARACTER SET=UTF8MB4 COMMENT='课程目标表';

ALTER TABLE `course_target`
    ADD UNIQUE INDEX `course_target_unique` (`school_id` ASC,`exam_id` ASC, `course_code` ASC, `target_name` ASC);

CREATE TABLE `course_evaluation` (
                                     `id` BIGINT(20) NOT NULL COMMENT 'id',
                                     `school_id` BIGINT(20) NOT NULL COMMENT '学校id',
                                     `exam_id` BIGINT(20) NOT NULL COMMENT '考试id',
                                     `course_code` VARCHAR(20) NOT NULL COMMENT '课程编号',
                                     `evaluation` VARCHAR(255) NOT NULL COMMENT '评价方式',
                                     `evaluation_desc` VARCHAR(255) NULL COMMENT '评价方式描述',
                                     `create_id` BIGINT(20) NULL COMMENT '创建人id',
                                     `create_time` BIGINT(20) NULL COMMENT '创建时间',
                                     `update_id` BIGINT(20) NULL COMMENT '更新人id',
                                     `update_time` BIGINT(20) NULL COMMENT '更新时间',
                                     PRIMARY KEY (`id`)
)  ENGINE=INNODB DEFAULT CHARACTER SET=UTF8MB4 COMMENT='课程评价方式表';

ALTER TABLE `course_evaluation`
    ADD UNIQUE INDEX `course_evaluation_unique` (`school_id` ASC, `exam_id` ASC, `course_code` ASC, `evaluation` ASC);

CREATE TABLE `course_weight` (
                                 `id` BIGINT(20) NOT NULL COMMENT 'id',
                                 `school_id` BIGINT(20) NOT NULL COMMENT '学校id',
                                 `exam_id` BIGINT(20) NOT NULL COMMENT '考试id',
                                 `course_code` VARCHAR(20) NOT NULL COMMENT '课程编号',
                                 `target_id` BIGINT(20) NOT NULL COMMENT '课程目标表id',
                                 `evaluation_id` BIGINT(20) NOT NULL COMMENT '课程评价表id',
                                 `enable` TINYINT(1) NOT NULL DEFAULT '1' COMMENT '使用状态 1:使用 0:未使用',
                                 `weight` DECIMAL(6,2) NULL COMMENT '权重',
                                 `target_score` DECIMAL(6,2) NULL COMMENT '目标分值',
                                 `create_id` BIGINT(20) NULL COMMENT '创建人',
                                 `create_time` BIGINT(20) NULL COMMENT '创建时间',
                                 `update_id` BIGINT(20) NULL COMMENT '更新人',
                                 `update_time` BIGINT(20) NULL COMMENT '更新时间',
                                 PRIMARY KEY (`id`))
    ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8mb4
COMMENT = '课程权重设置表';

ALTER TABLE `course_weight`
    ADD UNIQUE INDEX `course_weight_unique` (`school_id` ASC, `exam_id` ASC, `course_code` ASC, `target_id` ASC, `evaluation_id` ASC);

CREATE TABLE `basic_teach_clazz` (
                                     `id` BIGINT(20)NOT NULL COMMENT 'id',
                                     `school_id` BIGINT(20)NOT NULL COMMENT '学校id',
                                     `exam_id` BIGINT(20)NOT NULL COMMENT '考试id',
                                     `course_code` VARCHAR(20) NOT NULL COMMENT '课程编号',
                                     `clazz_name` VARCHAR(50) NOT NULL COMMENT '教学班名称',
                                     `create_id` BIGINT(20)NULL COMMENT '创建人',
                                     `create_time` BIGINT(20)NULL COMMENT '创建时间',
                                     `update_id` BIGINT(20)NULL COMMENT '更新人',
                                     `update_time` BIGINT(20)NULL COMMENT '更新时间',
                                     PRIMARY KEY (`id`))
    ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8mb4
COMMENT = '基础教学班表';

ALTER TABLE `basic_teach_clazz`
    ADD UNIQUE INDEX `basic_teach_clazz_unique` (`school_id` ASC, `exam_id` ASC, `clazz_name` ASC);

CREATE TABLE `basic_exam_student` (
                                      `id` BIGINT(20) NOT NULL COMMENT 'id',
                                      `school_id` BIGINT(20) NOT NULL COMMENT '学校id',
                                      `semester_id` BIGINT(20) NOT NULL COMMENT '学期id',
                                      `exam_id` BIGINT(20) NOT NULL COMMENT '考试id',
                                      `course_code` VARCHAR(20) NOT NULL COMMENT '课程编号',
                                      `clazz_id` BIGINT(20) NOT NULL COMMENT '教学班id（basic_teach_clazz）',
                                      `paper_number` VARCHAR(30) DEFAULT NULL COMMENT '试卷编号',
                                      `student_name` VARCHAR(50) NOT NULL COMMENT '姓名',
                                      `student_code` VARCHAR(50) NOT NULL COMMENT '学号',
                                      `college` VARCHAR(50) NULL COMMENT '学院',
                                      `major` VARCHAR(50) NULL COMMENT '专业',
                                      `teacher_id` BIGINT(20) NULL COMMENT '任课教师id',
                                      `exam_start_time` BIGINT(20) DEFAULT NULL COMMENT '考试开始时间',
                                      `exam_end_time` BIGINT(20) DEFAULT NULL COMMENT '考试结束时间',
                                      `exam_place` VARCHAR(50) DEFAULT NULL COMMENT '考点',
                                      `exam_room` VARCHAR(50) DEFAULT NULL COMMENT '考场',
                                      `create_id` BIGINT(20) NULL COMMENT '创建人',
                                      `create_time` BIGINT(20) NULL COMMENT '创建时间',
                                      `update_id` BIGINT(20) NULL COMMENT '更新人',
                                      `update_time` BIGINT(20) NULL COMMENT '更新时间',
                                      PRIMARY KEY (`id`)
)  ENGINE=INNODB DEFAULT CHARACTER SET=UTF8MB4 COMMENT='考生字典表';

ALTER TABLE `basic_exam_student`
    ADD UNIQUE INDEX `basic_exam_student_unique` (`school_id` ASC, `exam_id` ASC, `course_code` ASC, `student_code` ASC);

-- 2024/2/27
UPDATE sys_privilege
SET name='管理成绩', url='Score', `type`='LINK', parent_id=2001, `sequence`=1, property='AUTH', related='2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020,2029,2030', enable=1, default_auth=0, front_display=1
WHERE id=2006;

INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(2030, '期末成绩-同步', '/api/admin/course/degree/final_score/sync', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);

ALTER TABLE t_c_final_score ADD source varchar(50) NULL COMMENT '来源，EXCEL_IMPORT：excel导入，SYNC：数据同步';
ALTER TABLE t_c_final_score CHANGE source source varchar(50) NULL COMMENT '来源，EXCEL_IMPORT：excel导入，SYNC：数据同步' AFTER enable;

INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `enable`, `default_auth`, `front_display`) VALUES ('115', 'PDF生成管理', 'PdfBuildManage', 'MENU', '112', '2', '1', '0', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES ('126', '查询条件', 'Condition', 'CONDITION', '115', '1', 'AUTH', '127', '1', '0', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('127', '查询', '/api/admin/data/task/page_pdf_create', 'URL', '115', '1', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES ('116', '查询', 'Select', 'BUTTON', '115', '1', 'AUTH', '127', '1', '0', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES ('128', '列表', 'List', 'LIST', '115', '2', 'AUTH', '127', '1', '0', '1');
UPDATE `sys_privilege` SET `parent_id` = '115' WHERE (`id` = '413');
UPDATE `sys_privilege` SET `parent_id` = '115' WHERE (`id` = '190');

update mark_question t
set t.objective_policy = 'LEAK_HALF'
where t.objective_policy = 'LEAK';
ALTER TABLE `mark_question`
    ADD COLUMN `objective_policy_score` double DEFAULT NULL COMMENT '客观题判分策略计分';
ALTER TABLE `scan_paper`
    ADD COLUMN `invalid` bit(1) DEFAULT b'0' COMMENT '强制绑定';
ALTER TABLE `mark_student`
    ADD COLUMN `invalid` bit(1) DEFAULT b'0' COMMENT '强制绑定';

ALTER TABLE `exam_card` ADD COLUMN `blank_card_path` VARCHAR(500) NULL COMMENT '空白题卡pdf路径' AFTER `update_time`;

INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('241', '印刷-单文件打印', '/api/admin/client/print/single', 'URL', '199', '17', 'AUTH', '1', '1', '1');
UPDATE `sys_privilege` SET `related` = '200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,241,973,974,975' WHERE (`id` = '199');

-- 2024/02/29
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('286', '题库试卷列表', '/api/admin/exam/task/page_tiku_paper', 'URL', '40', '12', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('287', '题库试卷包', '/api/admin/exam/task/get_tiku_paper_data', 'URL', '40', '13', 'AUTH', '1', '1', '1');
UPDATE `sys_privilege` SET `related` = '71,167,286,287,424,477,417,420,421,441,442,640,641' WHERE (`id` = '283');
UPDATE `sys_privilege` SET `related` = '49,167,174,286,287,371,464,465,427,642,417,420,421,441,442,640,641,642' WHERE (`id` = '463');

-- 2024/03/01
CREATE TABLE `course_dimension` (
                                    `id` BIGINT(20) NOT NULL COMMENT 'id',
                                    `school_id` BIGINT(20) NOT NULL COMMENT '学校id',
                                    `semester_id` BIGINT(20) NOT NULL COMMENT '学期id',
                                    `exam_id` BIGINT(20) NOT NULL COMMENT '考试id',
                                    `course_code` VARCHAR(20) NOT NULL COMMENT '课程编号',
                                    `code` VARCHAR(32) NOT NULL COMMENT '知识点编号',
                                    `name` VARCHAR(255) NOT NULL COMMENT '知识点名称',
                                    `number` INT NOT NULL COMMENT '排序',
                                    `parent_id` BIGINT(20) NOT NULL COMMENT '父id（顶级知识点父id为0）',
                                    `create_id` BIGINT(20) NULL COMMENT '创建人',
                                    `create_time` BIGINT(20) NULL COMMENT '创建时间',
                                    `update_id` BIGINT(20) NULL COMMENT '更新人',
                                    `update_time` BIGINT(20) NULL COMMENT '更新时间',
                                    PRIMARY KEY (`id`)
)  ENGINE=INNODB DEFAULT CHARACTER SET=UTF8MB4 COMMENT='课程知识点表';



ALTER TABLE `teach_course`
    ADD COLUMN `exam_id` BIGINT NOT NULL COMMENT '考试id' AFTER `school_id`,
    ADD COLUMN `course_code` VARCHAR(20) NOT NULL COMMENT '课程编号' AFTER `exam_id`,
    ADD COLUMN `weight_setting` TINYINT(1) NULL COMMENT '权重设置' AFTER `enable`,
    CHANGE COLUMN `user_id` `user_id` BIGINT NOT NULL COMMENT '任课教师id' AFTER `course_code`;
ALTER TABLE `teach_course` CHANGE COLUMN `course_code` `course_code` VARCHAR(20) NULL COMMENT '课程编号' ;

UPDATE teach_course t0
SET
    course_code = (SELECT
                       code
                   FROM
                       basic_course
                   WHERE
                           id = t0.basic_course_id)
WHERE
        id > 0;
ALTER TABLE `teach_course`
    DROP INDEX `teach_course_unique` ,
    ADD UNIQUE INDEX `teach_course_unique` USING BTREE (`school_id`, `exam_id`, `course_code`, `user_id`);

ALTER TABLE `course_dimension`
    ADD COLUMN `teach_course_id` BIGINT NOT NULL COMMENT '教学课程id' AFTER `id`,
    ADD COLUMN `user_id` BIGINT NOT NULL COMMENT '教师id' AFTER `course_code`,
    ADD COLUMN `source` VARCHAR(20) NOT NULL COMMENT '来源' AFTER `user_id`;
ALTER TABLE `course_dimension`
    ADD UNIQUE INDEX `course_dimension_unique` (`teach_course_id` ASC, `source` ASC, `code` ASC);

ALTER TABLE `course_evaluation`
    ADD COLUMN `teach_course_id` BIGINT NOT NULL COMMENT '教学课程id' AFTER `id`,
ADD COLUMN `user_id` BIGINT NOT NULL COMMENT '教师id' AFTER `course_code`,
ADD COLUMN `type` VARCHAR(20) NOT NULL COMMENT '类型（默认DEFAULT、自定义CUSTOM）' AFTER `user_id`,
DROP INDEX `course_evaluation_unique` ,
ADD UNIQUE INDEX `course_evaluation_unique` (`teach_course_id` ASC, `evaluation` ASC);

ALTER TABLE `course_target`
    ADD COLUMN `teach_course_id` BIGINT NOT NULL COMMENT '教学课程id' AFTER `id`,
ADD COLUMN `user_id` BIGINT NOT NULL COMMENT '教师id' AFTER `course_code`,
DROP INDEX `course_target_unique` ,
ADD UNIQUE INDEX `course_target_unique` (`teach_course_id` ASC, `target_name` ASC);

ALTER TABLE `course_weight`
    ADD COLUMN `teach_course_id` BIGINT NOT NULL COMMENT '教学课程id' AFTER `id`,
ADD COLUMN `user_id` BIGINT NOT NULL COMMENT '教师id' AFTER `course_code`,
DROP INDEX `course_weight_unique` ,
ADD UNIQUE INDEX `course_weight_unique` (`teach_course_id` ASC, `target_id` ASC, `evaluation_id` ASC);

-- 2024/03/02
DROP TABLE IF EXISTS `exam_task_paper_data`;
CREATE TABLE `exam_task_paper_data` (
           `exam_id` BIGINT(20) NOT NULL COMMENT '考试ID',
           `paper_number` VARCHAR(100) NOT NULL COMMENT '试卷编号',
           `paper_id` BIGINT(20) NOT NULL COMMENT '题库试卷ID',
           `data_packet_path` VARCHAR(200) NULL COMMENT '题库试卷数据包地址（zip）',
           `paper_json` MEDIUMTEXT NULL COMMENT '试卷结构内容（从paper.json解析）',
           `answer_json` MEDIUMTEXT NULL COMMENT '试卷答案内容（从answer.json解析）',
           `paper_pdf_attachment_id` BIGINT(20) NULL COMMENT '试卷pdf文件地址（paper.pdf上传附件ID）',
           `answer_pdf_attachment_id` BIGINT(20) NULL COMMENT '标答pdf文件地址（answer.pdf上传附件ID）',
           `uuid` VARCHAR(200) NULL COMMENT '唯一标识',
           PRIMARY KEY (`exam_id`, `paper_number`, `paper_id`))
    COMMENT = '命题任务选择题库试卷相关文件表';

-- 2024/03/04
ALTER TABLE `exam_card`
    ADD COLUMN `paper_id` BIGINT(20) NULL COMMENT '题库试卷ID' AFTER `blank_card_path`;

-- 2024/03/05
-- 考生字典管理权限设置
INSERT INTO `sys_privilege`(`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1100, '考生管理', 'BasicExamStudentManage', 'MENU', 356, 8, NULL, NULL, 1, 0, 1);
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('1101', '分页查询', '/api/admin/basic/exam_student/page', 'URL', '1100', '1', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('1102', '新增/编辑', '/api/admin/basic/exam_student/save', 'URL', '1100', '2', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('1103', '导入', '/api/admin/basic/exam_student/import', 'URL', '1100', '3', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('1104', '导出', '/api/admin/basic/exam_student/export', 'URL', '1100', '4', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('1105', '批量删除', '/api/admin/basic/exam_student/delete', 'URL', '1100', '5', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES ('1106', '查询', 'Select', 'BUTTON', '1100', '1', 'AUTH', '1101', '1', '0', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES ('1107', '查询条件', 'Condition', 'CONDITION', '1100', '3', 'AUTH', '1101', '1', '0', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES ('1108', '列表', 'List', 'LIST', '1100', '2', 'AUTH', '1101', '1', '0', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES ('1109', '新增', 'Add', 'BUTTON', '1100', '4', 'AUTH', '1102', '1', '0', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES ('1110', '编辑', 'Edit', 'LINK', '1100', '5', 'AUTH', '1102', '1', '0', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES ('1111', '导入学生', 'Import', 'BUTTON', '1100', '6', 'AUTH', '1103', '1', '0', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES ('1112', '导出学生', 'Export', 'BUTTON', '1100', '7', 'AUTH', '1104', '1', '0', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES ('1113', '删除', 'Delete', 'LINK', '1100', '8', 'AUTH', '1105', '1', '0', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES ('1114', '批量删除', 'DeleteBatch', 'BUTTON', '1100', '9', 'AUTH', '1105', '1', '0', '1');

ALTER TABLE `teach_course`
    CHANGE COLUMN `basic_course_id` `basic_course_id` BIGINT NULL COMMENT '基础课程id' ;

INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('1115', '教学课程-查询课程权重设置状态', '/api/admin/teach/course/find_course_weight_setting_status', 'URL', '841', '14', 'AUTH', '1', '1', '1');
-- 课程目标管理权限设置
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('1116', '课程目标管理-列表查询', '/api/admin/teach/course_target/list', 'URL', '841', '15', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('1117', '课程目标管理-同步题库知识点', '/api/admin/teach/course_target/dimension_sync_tiku', 'URL', '841', '16', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('1118', '课程目标管理-导入课程知识点', '/api/admin/teach/course_target/dimension_import', 'URL', '841', '17', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('1119', '课程目标管理-课程知识点树查询', '/api/admin/teach/course_target/dimension_tree', 'URL', '841', '18', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('1120', '课程目标管理-新增/编辑', '/api/admin/teach/course_target/save', 'URL', '841', '19', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('1121', '课程目标管理-删除', '/api/admin/teach/course_target/delete', 'URL', '841', '20', 'AUTH', '1', '1', '1');

-- 课程评价方式管理权限设置
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('1122', '评价方式管理-列表查询', '/api/admin/teach/course_evaluation/list', 'URL', '841', '21', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('1123', '评价方式管理-新增', '/api/admin/teach/course_evaluation/save', 'URL', '841', '22', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('1124', '评价方式管理-删除', '/api/admin/teach/course_evaluation/delete', 'URL', '841', '23', 'AUTH', '1', '1', '1');

-- 课程权重设置权限设置
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('1125', '权重设置-查询', '/api/admin/teach/course_weight/find', 'URL', '841', '24', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('1126', '权重设置-保存', '/api/admin/teach/course_weight/save', 'URL', '841', '25', 'AUTH', '1', '1', '1');

UPDATE `sys_privilege` SET `related` = '77,842,843,844,845,846,847,848,849,850,851,852,853,866,1115,1116,1117,1118,1119,1120,1121,1122,1123,1124,1125,1126' WHERE (`id` = '841');

CREATE TABLE IF NOT EXISTS `mark_document` (
    `id` bigint NOT NULL,
    `exam_id` bigint NOT NULL COMMENT '考试ID',
    `course_code` varchar(32) NOT NULL COMMENT '课程代码',
    `course_name` varchar(100) NOT NULL COMMENT '科目名称',
    `paper_number` varchar(64) DEFAULT NULL COMMENT '试卷编号',
    `type` varchar(64) NOT NULL COMMENT '类型',
    `name` varchar(64) DEFAULT NULL COMMENT '名称',
    `file_count` int DEFAULT NULL COMMENT '文件数量',
    `file_path` mediumtext COMMENT '文件地址',
    PRIMARY KEY (`id`) USING BTREE
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='归档文档表';

-- 2024/03/07
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `enable`, `default_auth`, `front_display`) VALUES ('577', '文档管理', 'CourseDocumentManage', 'MENU', '561', '2', '1', '0', '1');
UPDATE `sys_privilege` SET `sequence` = '1' WHERE (`id` = '487');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES ('578', '列表', 'List', 'LIST', '577', '1', 'AUTH', '583', '1', '0', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES ('579', '查询条件', 'Condition', 'CONDITION', '577', '2', 'AUTH', '583', '1', '0', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES ('580', '查询', 'Select', 'BUTTON', '577', '3', 'AUTH', '583', '1', '0', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES ('581', '新建文件', 'Add', 'BUTTON', '577', '4', 'AUTH', '584', '1', '0', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('583', '文档管理列表', '/api/admin/mark/archive/document/list', 'URL', '577', '1', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES ('582', '查看详情', 'Detail', 'LINK', '577', '5', 'AUTH', '585,586,587,588', '1', '0', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('584', '文档新建', '/api/admin/mark/archive/document/save', 'URL', '577', '2', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('585', '文档详情', '/api/admin/mark/archive/document/detail', 'URL', '577', '3', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('586', '文档上传', '/api/admin/mark/archive/document/import', 'URL', '577', '4', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('587', '文档删除', '/api/admin/mark/archive/document/delete', 'URL', '577', '5', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('588', '文档下载', '/api/admin/mark/archive/document/download', 'URL', '577', '6', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('786', '课程目标达成度模板配置查询', '/api/admin/set/course/degree/select', 'URL', '508', '15', 'AUTH', '1', '0', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('787', '课程目标达成度模板配置保存', '/api/admin/set/course/degree/save', 'URL', '508', '16', 'AUTH', '1', '0', '1');
UPDATE `sys_privilege` SET `related` = '466,467,494,544,585,586,587,588' WHERE (`id` = '582');

-- 2024/03/08
ALTER TABLE `teach_clazz`
DROP INDEX `teach_clazz_unique` ;
ALTER TABLE `teach_clazz`
DROP COLUMN `basic_course_id`,
DROP COLUMN `teach_clazz_name`,
DROP COLUMN `teach_clazz_code`,
ADD COLUMN `teach_course_id` BIGINT NOT NULL AFTER `school_id`,
ADD COLUMN `basic_teach_clazz_id` BIGINT NOT NULL AFTER `teach_course_id`,
ADD COLUMN `clazz_name` VARCHAR(50) NOT NULL COMMENT '教学课程名称' AFTER `user_id`;


INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('1127', '共用接口-查询教学班字典', '/api/admin/basic/condition/list_basic_teach_clazz', 'URL', '149', '16', 'SYS', '1', '1', '1');
ALTER TABLE `teach_student`
    CHANGE COLUMN `basic_course_id` `teach_course_id` BIGINT NOT NULL COMMENT '教学课程id（冗余）' ;

ALTER TABLE `teach_clazz`
    ADD COLUMN `belong_teach_course_id` BIGINT NULL COMMENT '分配班级时属于的教学课程id' AFTER `clazz_name`;

ALTER TABLE `teach_course`
    ADD COLUMN `default_rate` DECIMAL(6,2) NULL COMMENT '默认占比' AFTER `weight_setting`,
ADD COLUMN `custom_rate` DECIMAL(6,2) NULL COMMENT '自定义占比' AFTER `default_rate`;

INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('1128', '教师团队管理-分配班级列表查询', '/api/admin/teach/course/find_clazz_list', 'URL', '841', '26', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('1129', '教师团队管理-分配班级', '/api/admin/teach/course/assign_clazz', 'URL', '841', '27', 'AUTH', '1', '1', '1');

UPDATE `sys_privilege` SET `related` = '77,842,843,844,845,846,847,848,849,850,851,852,853,866,1115,1116,1117,1118,1119,1120,1121,1122,1123,1124,1125,1126,1128,1129' WHERE (`id` = '841');

ALTER TABLE `mark_student`
    CHANGE COLUMN `package_code` `package_code` VARCHAR(64) NULL COMMENT '试卷袋编号' ;

INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('1130', '阅卷数据批量导入（同步）', '/api/admin/mark/setting/mark_student_import', 'URL', '917', '23', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES ('1131', '阅卷数据导入', 'MarkStudentImport', 'BUTTON', '917', '8', 'AUTH', '1130', '1', '0', '1');

-- 2014/03/13
ALTER TABLE `exam_student` ADD COLUMN `teacher_id` BIGINT(20) NULL COMMENT '任课老师ID' AFTER `campus_name`;
ALTER TABLE `teach_clazz`
    CHANGE COLUMN `user_id` `user_id` BIGINT NULL COMMENT '用户id' ;

ALTER TABLE `teach_course`
    ADD COLUMN `weight_setting_sign` BIGINT NULL COMMENT '课程权重设置标识' AFTER `weight_setting`;

ALTER TABLE `teach_course`
    ADD COLUMN `dimension_sign` BIGINT NULL COMMENT '知识点标识' AFTER `weight_setting_sign`;

ALTER TABLE t_c_paper_struct ADD dimension_sign BIGINT NULL COMMENT '知识点变化id';
ALTER TABLE t_c_paper_struct CHANGE dimension_sign dimension_sign BIGINT NULL COMMENT '知识点变化id' AFTER enable;

-- 2014/03/15
UPDATE sys_privilege
SET name='管理成绩', url='Score', `type`='LINK', parent_id=2001, `sequence`=1, property='AUTH', related='2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020,2029,2030,2031', enable=1, default_auth=0, front_display=1
WHERE id=2006;
UPDATE sys_privilege
SET name='查看报告', url='View', `type`='LINK', parent_id=2002, `sequence`=1, property='AUTH', related='2026,2027,2028,2031', enable=1, default_auth=0, front_display=1
WHERE id=2025;
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(2031, '报告数据发生变化', '/api/admin/course/degree/report/change', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);

UPDATE `sys_privilege` SET `enable` = '0', `front_display` = '0' WHERE (`id` = '515');
UPDATE `sys_privilege` SET `enable` = '0', `front_display` = '0' WHERE (`id` = '450');
UPDATE `sys_privilege` SET `enable` = '0', `front_display` = '0' WHERE (`id` = '358');
update `sys_privilege` set enable = 0, front_display = 0 where parent_id in (358, 450, 515);

-- 2014/03/20
ALTER TABLE t_c_paper_struct CHANGE paper_struct paper_struct_dimension mediumtext NULL COMMENT '试卷知识点结构';
ALTER TABLE t_c_paper_struct MODIFY COLUMN paper_struct_dimension mediumtext NULL COMMENT '试卷知识点结构';
ALTER TABLE t_c_paper_struct ADD paper_struct MEDIUMTEXT NULL COMMENT '试卷结构';
ALTER TABLE t_c_paper_struct CHANGE paper_struct paper_struct MEDIUMTEXT NULL COMMENT '试卷结构' AFTER paper_number;
ALTER TABLE t_c_paper_struct ADD total_score DOUBLE NULL COMMENT '全卷满分';
ALTER TABLE t_c_paper_struct CHANGE total_score total_score DOUBLE NULL COMMENT '全卷满分' AFTER paper_struct_dimension;
ALTER TABLE t_c_paper_struct ADD pass_score DOUBLE NULL COMMENT '及格分';
ALTER TABLE t_c_paper_struct CHANGE pass_score pass_score DOUBLE NULL COMMENT '及格分' AFTER total_score;

ALTER TABLE t_c_paper_struct MODIFY COLUMN course_name varchar(100) NULL COMMENT '课程名称';
ALTER TABLE t_c_paper_struct ADD CONSTRAINT t_c_paper_struct_unique UNIQUE KEY (exam_id,course_code,paper_number);

UPDATE sys_privilege
SET name='管理成绩', url='Score', `type`='LINK', parent_id=2001, `sequence`=1, property='AUTH', related='2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020,2029,2030,2031,2032', enable=1, default_auth=0, front_display=1
WHERE id=2006;
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(2032, '试卷结构-导入模版', '/api/admin/course/degree/final_score/paper_struct/import', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);

ALTER TABLE t_c_final_score DROP KEY t_c_score_end_exam_unique;
ALTER TABLE t_c_final_score ADD CONSTRAINT t_c_final_score_unique UNIQUE KEY (exam_id,course_code,paper_number,name,student_code);
ALTER TABLE t_c_final_score MODIFY COLUMN course_name varchar(100) NULL COMMENT '课程名称';

ALTER TABLE t_c_usual_score DROP KEY t_c_score_normal_unique;
ALTER TABLE t_c_usual_score ADD CONSTRAINT t_c_usual_score_unique UNIQUE KEY (exam_id,course_code,paper_number,name,student_code);
ALTER TABLE t_c_usual_score MODIFY COLUMN course_name varchar(100) NULL COMMENT '课程名称';

-- 2014/03/21
ALTER TABLE t_r_basic_info MODIFY COLUMN course_name varchar(100) NULL COMMENT '课程名称';
ALTER TABLE t_c_paper_struct MODIFY COLUMN course_name varchar(100) NOT NULL COMMENT '课程名称';
ALTER TABLE t_r_basic_info MODIFY COLUMN course_name varchar(100) NOT NULL COMMENT '课程名称';
ALTER TABLE t_c_final_score MODIFY COLUMN course_name varchar(100) NOT NULL COMMENT '课程名称';
ALTER TABLE t_c_usual_score MODIFY COLUMN course_name varchar(100) NOT NULL COMMENT '课程名称';

CREATE TABLE `client_upgrade` (
          `platform` VARCHAR(20) NOT NULL COMMENT '系统',
          `install_path` VARCHAR(200) NULL COMMENT '安装包保存地址',
          `version` VARCHAR(20) NULL COMMENT '版本名称',
          `build` VARCHAR(45) NULL COMMENT '版本号，用于客户端比对版本高低',
          `support_min` VARCHAR(45) NULL COMMENT '增量升级最低版本号，低于（含）此版本需要下载安装包重新安装',
          `upgrade_path` VARCHAR(200) NULL COMMENT '升级包保存地址',
          `mainfest_path` VARCHAR(200) NULL COMMENT 'mainfest.json文件保存路径',
          `install_upload_time` BIGINT(20) NULL COMMENT '安装包更新时间',
          `upgrade_upload_time` BIGINT(20) NULL COMMENT '升级包更新时间',
          PRIMARY KEY (`platform`));

ALTER TABLE `mark_question`
    ADD COLUMN `create_id` BIGINT(20) NULL AFTER `objective_policy_score`,
ADD COLUMN `create_time` BIGINT(20) NULL AFTER `create_id`,
ADD COLUMN `update_id` BIGINT(20) NULL AFTER `create_time`,
ADD COLUMN `update_time` BIGINT(20) NULL AFTER `update_id`;

-- 2024/03/22
update sys_privilege set related = 768 where id = 770;

UPDATE `sys_privilege` SET `enable` = '0', `front_display` = '0' WHERE (`id` = '762');
UPDATE `sys_privilege` SET `enable` = '0', `front_display` = '0' WHERE (`id` = '761');
UPDATE `sys_privilege` SET `enable` = '0', `front_display` = '0' WHERE (`id` = '875');
UPDATE `sys_privilege` SET `name` = '考生库选择' WHERE (`id` = '876');
UPDATE `sys_privilege` SET `name` = '考生库选择（是否可选学生）' WHERE (`id` = '877');

ALTER TABLE `basic_school` ADD COLUMN `has_paper_number` TINYINT(1) NULL DEFAULT '0' COMMENT '该学校是否有固定试卷编号' AFTER `default_school`;

-- 2024/03/25
UPDATE `sys_privilege` SET `enable` = '0', `front_display` = '0' WHERE (`id` = '1131');

-- 2024/03/26
ALTER TABLE `mark_subjective_score` CHANGE COLUMN `sub_number` `sub_number` INT(11) NOT NULL COMMENT '小题号' ;

-- 2024/03/27
UPDATE sys_privilege
SET name='管理成绩', url='Score', `type`='LINK', parent_id=2001, `sequence`=1, property='AUTH', related='2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020,2029,2030,2031,2032,2033', enable=1, default_auth=0, front_display=1
WHERE id=2006;

INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(2033, '同步试卷蓝图结构', '/api/admin/course/degree/final_score/paper_struct_dimension/sync', 'URL', 2006, 1, 'AUTH', NULL, 1, 1, 1);

-- 2024/03/28
DELETE FROM t_b_task where type in ('STUDENT_IMPORT', 'CLAZZ_IMPORT', 'CREATE_PDF');
UPDATE `sys_privilege` SET `enable` = '0', `default_auth` = '0', `front_display` = '0' WHERE (`id` = '163');
UPDATE `sys_privilege` SET `enable` = '0', `front_display` = '0' WHERE (`id` = '289');

-- 2024/04/02
ALTER TABLE `mark_student` ADD COLUMN `teacher_id` BIGINT(20) NULL COMMENT '任课老师ID' AFTER `class_name`;
ALTER TABLE `teach_course` DROP COLUMN `basic_course_id`;
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('1132', '客观题模板导出', '/api/admin/mark/question/objective/export', 'URL', '897', '15', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('1133', '客观题标答导入', '/api/admin/mark/question/objective/import', 'URL', '897', '16', 'AUTH', '1', '1', '1');
UPDATE `sys_privilege` SET `related` = '672,902,903,904,905,906,907,908,909,910,911,912,913,962,963,1132,1133' WHERE (`id` = '901');

ALTER TABLE `mark_user_class`
DROP COLUMN `group_number`,
DROP INDEX `idx_1` , ADD INDEX `idx_1` USING BTREE (`exam_id`, `paper_number`, `class_name`);

-- 2024/04/03
ALTER TABLE t_c_usual_score DROP KEY t_c_usual_score_unique;
ALTER TABLE t_c_usual_score ADD CONSTRAINT t_c_usual_score_unique UNIQUE KEY (exam_id,course_code,paper_number,name,student_code,create_id);
ALTER TABLE t_c_final_score DROP KEY t_c_final_score_unique;
ALTER TABLE t_c_final_score ADD CONSTRAINT t_c_final_score_unique UNIQUE KEY (exam_id,course_code,paper_number,name,student_code,create_id);
ALTER TABLE t_c_paper_struct DROP KEY t_c_paper_struct_unique;
ALTER TABLE t_c_paper_struct ADD CONSTRAINT t_c_paper_struct_unique UNIQUE KEY (exam_id,course_code,paper_number,create_id);
ALTER TABLE t_r_basic_info ADD CONSTRAINT t_r_basic_info_unique UNIQUE KEY (exam_id,course_code,paper_number,create_id);

-- 2024/04/08
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('1134', '编辑试卷结构', 'EditPaperStruct', 'LINK', '897', '17', 'AUTH', '1', '0', '1');

-- 2024/04/09
UPDATE sys_privilege
SET name='管理成绩', url='Score', `type`='LINK', parent_id=2001, `sequence`=1, property='AUTH', related='2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020,2029,2030,2031,2032,2033,2034', enable=1, default_auth=0, front_display=1
WHERE id=2006;

INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(2034, '同步期末成绩选择试卷', '/api/admin/course/degree/final_score/choose_paper', '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 (1135, '客观题导入', '/api/admin/mark/setting/objective_struct/import', 'URL', '897', '17', 'AUTH',NULL, '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1136, '主观题导入', '/api/admin/mark/setting/subjective_struct/import', 'URL', '897', '18', 'AUTH',NULL, '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1137, '客观题导入', 'ObjectiveStructImport', 'BUTTON', '897', '6', 'AUTH', '1135', '1', '0', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1138, '主观题导入', 'SubjectiveStructImport', 'BUTTON', '897', '7', 'AUTH', '1136', '1', '0', '1');

update sys_privilege set related = '490,543,955' where id = 488;
ALTER TABLE `basic_school` ADD COLUMN `background_image` VARCHAR(500) NULL COMMENT '学校首页背景图' AFTER `has_paper_number`;

-- 2024/04/10
ALTER TABLE t_c_usual_score MODIFY COLUMN paper_number varchar(100) NULL COMMENT '试卷编码';
ALTER TABLE t_c_final_score MODIFY COLUMN paper_number varchar(100) NULL COMMENT '试卷编码';
ALTER TABLE t_c_paper_struct MODIFY COLUMN paper_number varchar(100) NULL COMMENT '试卷编码';
ALTER TABLE t_r_basic_info MODIFY COLUMN paper_number varchar(100) NULL COMMENT '试卷编码';
ALTER TABLE t_c_usual_score ADD teach_course_id BIGINT NOT NULL COMMENT '教学课程id';
ALTER TABLE t_c_usual_score CHANGE teach_course_id teach_course_id bigint NOT NULL COMMENT '教学课程id' AFTER paper_number;
ALTER TABLE t_c_usual_score DROP KEY t_c_usual_score_unique;
ALTER TABLE t_c_usual_score ADD CONSTRAINT t_c_usual_score_unique UNIQUE KEY (exam_id,course_code,teach_course_id,name,student_code);
ALTER TABLE t_c_final_score ADD teach_course_id BIGINT NOT NULL COMMENT '教学课程id';
ALTER TABLE t_c_final_score CHANGE teach_course_id teach_course_id BIGINT NULL COMMENT '教学课程id' AFTER paper_number;
ALTER TABLE t_c_final_score DROP KEY t_c_final_score_unique;
ALTER TABLE t_c_final_score ADD CONSTRAINT t_c_final_score_unique UNIQUE KEY (exam_id,course_code,teach_course_id,name,student_code);
ALTER TABLE t_c_paper_struct ADD teach_course_id BIGINT NOT NULL COMMENT '教学课程id';
ALTER TABLE t_c_paper_struct CHANGE teach_course_id teach_course_id BIGINT NOT NULL COMMENT '教学课程id' AFTER paper_number;
ALTER TABLE t_c_paper_struct DROP KEY t_c_paper_struct_unique;
ALTER TABLE t_c_paper_struct ADD CONSTRAINT t_c_paper_struct_unique UNIQUE KEY (exam_id,course_code,teach_course_id);
ALTER TABLE t_r_basic_info ADD teach_course_id BIGINT NOT NULL COMMENT '教学课程id';
ALTER TABLE t_r_basic_info CHANGE teach_course_id teach_course_id BIGINT NOT NULL COMMENT '教学课程id' AFTER paper_number;
ALTER TABLE t_r_basic_info DROP KEY t_r_basic_info_unique;
ALTER TABLE t_r_basic_info ADD CONSTRAINT t_r_basic_info_unique UNIQUE KEY (exam_id,course_code,teach_course_id);
ALTER TABLE t_c_usual_score MODIFY COLUMN course_name varchar(100) NULL COMMENT '课程名称';
ALTER TABLE t_c_final_score MODIFY COLUMN course_name varchar(100) NULL COMMENT '课程名称';
ALTER TABLE t_c_paper_struct MODIFY COLUMN course_name varchar(100) NULL COMMENT '课程名称';
ALTER TABLE t_r_basic_info MODIFY COLUMN course_name varchar(100) NULL COMMENT '课程名称';
ALTER TABLE t_r_basic_info MODIFY COLUMN teaching_object varchar(1000) NULL COMMENT '授课对象';

INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('1139', '轨迹图查询题卡内容', '/api/admin/mark/track/getCard', 'URL', '946', '12', 'AUTH', '1', '1', '1');
UPDATE `sys_privilege` SET `related` = '888,894,953,954,955,956,957,958,959,960,969,1139' WHERE (`id` = '950');

ALTER TABLE `basic_card_rule` ADD COLUMN `fill_fields` TEXT NULL COMMENT '变量信息填充字段' AFTER `extend_fields`;

delete from basic_operation_log where customized_operation_type = 'SEARCH';
update basic_operation_log set customized_operation_type = 'SYNC',operation_type='EDIT' where customized_operation_type = 'PUSH';