USE teachcloud_db;

CREATE TABLE obe_course_outline (
                                    id BIGINT(20) NOT NULL COMMENT '课程大纲表id',
                                    culture_program_id BIGINT(20) NOT NULL COMMENT '培养方案id',
                                    name VARCHAR(255) NOT NULL COMMENT '课程大纲名称',
                                    semester_id BIGINT(20) NOT NULL COMMENT '修读学期id',
                                    course_id BIGINT(20) NOT NULL,
                                    evaluation_mode VARCHAR(32) NOT NULL COMMENT '考核方式',
                                    course_type VARCHAR(32) NOT NULL COMMENT '课程类别',
                                    user_id BIGINT(20) 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))
    COMMENT = '课程大纲表';

ALTER TABLE obe_course_outline
    ADD UNIQUE INDEX obe_course_outline_unique (culture_program_id ASC, name ASC);

ALTER TABLE obe_course_outline
    ADD COLUMN weight_setting TINYINT(1) NULL COMMENT '权重设置' AFTER user_id,
    ADD COLUMN weight_setting_sign BIGINT NULL COMMENT '课程权重设置标识' AFTER weight_setting,
    ADD COLUMN dimension_sign BIGINT NULL COMMENT '知识点标识' AFTER weight_setting_sign;


ALTER TABLE course_dimension
DROP COLUMN user_id,
    DROP COLUMN course_code,
    DROP COLUMN exam_id,
    DROP COLUMN semester_id,
    CHANGE COLUMN teach_course_id obe_course_outline_id BIGINT NOT NULL COMMENT '课程大纲id' ;
ALTER TABLE course_dimension
    RENAME TO  obe_course_dimension ;

ALTER TABLE obe_course_outline
    ADD COLUMN school_id BIGINT NOT NULL COMMENT '学校id' AFTER culture_program_id;

ALTER TABLE course_target
DROP COLUMN user_id,
    DROP COLUMN course_code,
    DROP COLUMN exam_id,
    CHANGE COLUMN teach_course_id obe_course_outline_id BIGINT NOT NULL COMMENT '教学课程id' , COMMENT = '课程大纲目标表' , RENAME TO  obe_course_target ;

ALTER TABLE course_evaluation
DROP COLUMN user_id,
    DROP COLUMN course_code,
    DROP COLUMN exam_id,
    CHANGE COLUMN teach_course_id obe_course_outline_id BIGINT NOT NULL COMMENT '教学课程id' , COMMENT = '课程大纲评价方式表' , RENAME TO  obe_course_evaluation ;

ALTER TABLE course_weight
DROP COLUMN user_id,
    DROP COLUMN course_code,
    DROP COLUMN exam_id,
    CHANGE COLUMN teach_course_id obe_course_outline_id BIGINT NOT NULL COMMENT '课程大纲id' , COMMENT = '课程大纲权重设置表' , RENAME TO  obe_course_weight ;

CREATE TABLE obe_course_requirement_dimension (
                                                  id BIGINT NOT NULL COMMENT 'id',
                                                  obe_course_outline_id BIGINT NOT NULL COMMENT '课程大纲id',
                                                  obe_culture_program_requirement_id BIGINT NOT NULL COMMENT '指标id',
                                                  obe_course_dimension_id BIGINT NOT NULL COMMENT '知识点id',
                                                  school_id BIGINT NOT NULL COMMENT '学校id',
                                                  create_id BIGINT NULL COMMENT '创建人',
                                                  create_time BIGINT NULL COMMENT '创建时间',
                                                  update_id BIGINT NULL COMMENT '更新人',
                                                  update_time BIGINT NULL COMMENT '更新时间',
                                                  PRIMARY KEY (id),
                                                  UNIQUE INDEX obe_course_requirement_dimension_unique (obe_course_outline_id ASC, obe_culture_program_requirement_id ASC, obe_course_dimension_id ASC))
    COMMENT = '课程大纲指标与知识点关联表';

ALTER TABLE obe_course_target
DROP COLUMN target_content,
    ADD COLUMN obe_culture_program_requirement_id BIGINT NOT NULL COMMENT '培养方案毕业要求指标点id' AFTER obe_course_outline_id,
    ADD COLUMN expect_value DOUBLE NULL COMMENT '预期值' AFTER total_weight;


ALTER TABLE obe_course_target
    CHANGE COLUMN obe_culture_program_requirement_id obe_culture_program_requirement_id BIGINT NULL COMMENT '培养方案毕业要求指标点id' ;

INSERT INTO sys_privilege (id, name, url, type, parent_id, sequence, enable, default_auth, front_display) VALUES ('3000', '课程大纲管理', 'CourseOutlineManager', 'MENU', '2035', '2', '1', '0', '1');
INSERT INTO sys_privilege (id, name, url, type, parent_id, sequence, enable, default_auth, front_display) VALUES ('3001', '课程考核设置', 'CourseAssessmentSetting', 'MENU', '2035', '3', '1', '0', '1');

INSERT INTO sys_privilege (id, name, url, type, parent_id, sequence, property, enable, default_auth, front_display) VALUES ('3002', '课程大纲-查询', '/api/admin/obe/course_outline/page', 'URL', '3000', '1', 'AUTH', '1', '1', '1');
INSERT INTO sys_privilege (id, name, url, type, parent_id, sequence, property, enable, default_auth, front_display) VALUES ('3003', '课程大纲-保存', '/api/admin/obe/course_outline/save', 'URL', '3000', '2', 'AUTH', '1', '1', '1');
INSERT INTO sys_privilege (id, name, url, type, parent_id, sequence, property, enable, default_auth, front_display) VALUES ('3004', '课程大纲-删除', '/api/admin/obe/course_outline/delete', 'URL', '3000', '3', 'AUTH', '1', '1', '1');
INSERT INTO sys_privilege (id, name, url, type, parent_id, sequence, property, enable, default_auth, front_display) VALUES ('3005', '课程大纲-查询课程权重设置状态', '/api/admin/obe/course_outline/find_course_weight_setting_status', 'URL', '3000', '4', 'AUTH', '1', '1', '1');
INSERT INTO sys_privilege (id, name, url, type, parent_id, sequence, property, related, enable, default_auth, front_display) VALUES ('3010', '列表', 'List', 'LIST', '3000', '1', 'AUTH', '3002', '1', '0', '1');
INSERT INTO sys_privilege (id, name, url, type, parent_id, sequence, property, related, enable, default_auth, front_display) VALUES ('3011', '查询条件', 'Condition', 'CONDITION', '3000', '2', 'AUTH', '3002', '1', '0', '1');
INSERT INTO sys_privilege (id, name, url, type, parent_id, sequence, property, related, enable, default_auth, front_display) VALUES ('3012', '查询', 'Select', 'BUTTON', '3000', '3', 'AUTH', '3002', '1', '0', '1');
INSERT INTO sys_privilege (id, name, url, type, parent_id, sequence, property, related, enable, default_auth, front_display) VALUES ('3013', '新增课程大纲', 'Save', 'BUTTON', '3000', '4', 'AUTH', '3003', '1', '0', '1');
INSERT INTO sys_privilege (id, name, url, type, parent_id, sequence, property, related, enable, default_auth, front_display) VALUES ('3014', '编辑', 'Edit', 'LINK', '3000', '5', 'AUTH', '3003', '1', '0', '1');
INSERT INTO sys_privilege (id, name, url, type, parent_id, sequence, property, related, enable, default_auth, front_display) VALUES ('3015', '删除', 'Delete', 'LINK', '3000', '6', 'AUTH', '3004', '1', '0', '1');
INSERT INTO sys_privilege (id, name, url, type, parent_id, sequence, property, related, enable, default_auth, front_display) VALUES ('3016', '查看详情', 'Detail', 'LINK', '3000', '7', 'AUTH', '3005', '1', '0', '1');

INSERT INTO sys_privilege (id, name, url, type, parent_id, sequence, property, enable, default_auth, front_display) VALUES ('3017', '课程大纲-课程基本信息', '/api/admin/obe/course_outline/course_basic_info', 'URL', '3016', '1', 'AUTH', '1', '1', '1');
INSERT INTO sys_privilege (id, name, url, type, parent_id, sequence, property, enable, default_auth, front_display) VALUES ('3018', '课程目标管理-列表查询', '/api/admin/obe/course_target/list', 'URL', '3016', '2', 'AUTH', '1', '1', '1');
INSERT INTO sys_privilege (id, name, url, type, parent_id, sequence, property, enable, default_auth, front_display) VALUES ('3019', '课程目标管理-新增/编辑', '/api/admin/obe/course_target/save', 'URL', '3016', '3', 'AUTH', '1', '1', '1');
INSERT INTO sys_privilege (id, name, url, type, parent_id, sequence, property, enable, default_auth, front_display) VALUES ('3020', '课程目标管理-课程知识点树查询', '/api/admin/obe/course_target/dimension_tree', 'URL', '3016', '4', 'AUTH', '1', '1', '1');
INSERT INTO sys_privilege (id, name, url, type, parent_id, sequence, property, enable, default_auth, front_display) VALUES ('3021', '课程目标管理-导入课程知识点', '/api/admin/obe/course_target/dimension_import', 'URL', '3016', '5', 'AUTH', '1', '1', '1');
INSERT INTO sys_privilege (id, name, url, type, parent_id, sequence, property, enable, default_auth, front_display) VALUES ('3022', '课程目标管理-指标知识点关系查询', '/api/admin/obe/course_target/requirement_dimension', 'URL', '3016', '6', 'AUTH', '1', '1', '1');
INSERT INTO sys_privilege (id, name, url, type, parent_id, sequence, property, enable, default_auth, front_display) VALUES ('3023', '课程目标管理-删除', '/api/admin/obe/course_target/delete', 'URL', '3016', '7', 'AUTH', '1', '1', '1');
INSERT INTO sys_privilege (id, name, url, type, parent_id, sequence, property, enable, default_auth, front_display) VALUES ('3024', '课程目标管理-预期值设置', '/api/admin/obe/course_target/setting_expect_value', 'URL', '3016', '8', 'AUTH', '1', '1', '1');
UPDATE sys_privilege SET related = '3005,3017,3018,3019,3020,3021,3022,3023,3024' WHERE (id = '3016');

INSERT INTO sys_privilege (id, name, url, type, parent_id, sequence, property, enable, default_auth, front_display) VALUES ('3030', '课程考核设置-查询', '/api/admin/obe/course_outline/assessment_setting_page', 'URL', '3001', '1', 'AUTH', '1', '1', '1');
INSERT INTO sys_privilege (id, name, url, type, parent_id, sequence, property, related, enable, default_auth, front_display) VALUES ('3040', '列表', 'List', 'LIST', '3001', '1', 'AUTH', '3030', '1', '0', '1');
INSERT INTO sys_privilege (id, name, url, type, parent_id, sequence, property, related, enable, default_auth, front_display) VALUES ('3041', '查询条件', 'Condition', 'CONDITION', '3001', '2', 'AUTH', '3030', '1', '0', '1');
INSERT INTO sys_privilege (id, name, url, type, parent_id, sequence, property, related, enable, default_auth, front_display) VALUES ('3042', '查询', 'Select', 'BUTTON', '3001', '3', 'AUTH', '3030', '1', '0', '1');
INSERT INTO sys_privilege (id, name, url, type, parent_id, sequence, property, related, enable, default_auth, front_display) VALUES ('3043', '删除', 'Delete', 'LINK', '3001', '4', 'AUTH', '3004', '1', '0', '1');
INSERT INTO sys_privilege (id, name, url, type, parent_id, sequence, property, enable, default_auth, front_display) VALUES ('3044', '编辑', 'Edit', 'LINK', '3001', '5', 'AUTH', '1', '0', '1');

INSERT INTO sys_privilege (id, name, url, type, parent_id, sequence, property, enable, default_auth, front_display) VALUES ('3050', '评价方式管理-列表查询', '/api/admin/obe/course_evaluation/list', 'URL', '3044', '1', 'AUTH', '1', '1', '1');
INSERT INTO sys_privilege (id, name, url, type, parent_id, sequence, property, enable, default_auth, front_display) VALUES ('3051', '评价方式管理-新增/编辑', '/api/admin/obe/course_evaluation/save', 'URL', '3044', '2', 'AUTH', '1', '1', '1');
INSERT INTO sys_privilege (id, name, url, type, parent_id, sequence, property, enable, default_auth, front_display) VALUES ('3052', '评价方式管理-删除', '/api/admin/obe/course_evaluation/delete', 'URL', '3044', '3', 'AUTH', '1', '1', '1');
INSERT INTO sys_privilege (id, name, url, type, parent_id, sequence, property, enable, default_auth, front_display) VALUES ('3053', '课程权重管理-列表查询', '/api/admin/obe/course_weight/find', 'URL', '3044', '4', 'AUTH', '1', '1', '1');
INSERT INTO sys_privilege (id, name, url, type, parent_id, sequence, property, enable, default_auth, front_display) VALUES ('3054', '课程权重管理-新增/编辑', '/api/admin/obe/course_weight/save', 'URL', '3044', '5', 'AUTH', '1', '1', '1');
UPDATE sys_privilege SET related = '3050,3051,3052,3053,3054' WHERE (id = '3044');

INSERT INTO sys_privilege (id, name, url, type, parent_id, sequence, property, enable, default_auth, front_display) VALUES ('3025', '根据培养方案、课程查询指标点', '/api/admin/obe/course_target/sub_requirement/list', 'URL', '3016', '9', 'AUTH', '1', '1', '1');
UPDATE sys_privilege SET related = '3005,3017,3018,3019,3020,3021,3022,3023,3024,3025' WHERE (id = '3016');

INSERT INTO sys_privilege (id, name, url, type, parent_id, sequence, property, enable, default_auth, front_display) VALUES ('3031', '课程考核设置-删除', '/api/admin/obe/course_outline/assessment_setting_delete', 'URL', '3001', '2', 'AUTH', '1', '1', '1');
UPDATE sys_privilege SET related = '3031' WHERE (id = '3043');

INSERT INTO sys_privilege (id, name, url, type, parent_id, sequence, property, enable, default_auth, front_display) VALUES ('3006', '课程大纲-查询可选择的培养方案', '/api/admin/obe/course_outline/can_choose_culture_program', 'URL', '3000', '5', 'AUTH', '1', '1', '1');
INSERT INTO sys_privilege (id, name, url, type, parent_id, sequence, property, enable, default_auth, front_display) VALUES ('3007', '课程大纲-查询可选择的课程', '/api/admin/obe/course_outline/can_choose_course', 'URL', '3000', '6', 'AUTH', '1', '1', '1');
UPDATE sys_privilege SET related = '3003,3006,3007' WHERE (id = '3014');

INSERT INTO sys_privilege (id, name, url, type, parent_id, sequence, property, enable, default_auth, front_display) VALUES ('1173', '共用接口-OBE学期', '/api/admin/basic/condition/list_outline_semester', 'URL', '149', '19', 'SYS', '1', '1', '1');

ALTER TABLE t_c_usual_score ADD culture_program_id BIGINT
    COMMENT '培养方案id' NULL after id;

ALTER TABLE t_c_usual_score
DROP COLUMN teach_course_id,
    ADD COLUMN course_id BIGINT NULL COMMENT '课程id' AFTER exam_id,
    CHANGE COLUMN culture_program_id culture_program_id BIGINT NULL COMMENT '培养方案id' ,
    CHANGE COLUMN exam_id exam_id BIGINT NULL COMMENT '考试id' ,
    DROP INDEX t_c_usual_score_unique ,
    ADD UNIQUE INDEX t_c_usual_score_unique (culture_program_id ASC, course_id ASC, name ASC, student_code ASC);

-- 2024-06-14
ALTER TABLE t_r_basic_info ADD culture_program_id BIGINT COMMENT '培养方案id' NULL after id;

ALTER TABLE t_r_basic_info
DROP COLUMN teach_course_id,
    ADD COLUMN course_id BIGINT NULL COMMENT '课程id' AFTER exam_id,
    CHANGE COLUMN culture_program_id culture_program_id BIGINT NULL COMMENT '培养方案id' ,
    CHANGE COLUMN exam_id exam_id BIGINT NULL COMMENT '考试id' ,
DROP INDEX t_r_basic_info_unique;
ALTER TABLE t_r_basic_info ADD UNIQUE INDEX t_r_basic_info_unique (culture_program_id ASC, course_id ASC);

ALTER TABLE t_c_paper_struct ADD culture_program_id BIGINT COMMENT '培养方案id' NULL after id;

ALTER TABLE t_c_paper_struct
    DROP COLUMN teach_course_id,
    ADD COLUMN course_id BIGINT NULL COMMENT '课程id' AFTER exam_id,
    CHANGE COLUMN exam_id exam_id BIGINT NULL COMMENT '考试id' ,
    DROP INDEX t_c_paper_struct_unique ,
    ADD UNIQUE INDEX t_c_paper_struct_unique (culture_program_id ASC, course_id ASC);

ALTER TABLE t_c_final_score ADD culture_program_id BIGINT
    COMMENT '培养方案id' NULL after id;
    ALTER TABLE t_c_final_score
    DROP COLUMN teach_course_id,
    ADD COLUMN course_id BIGINT NULL COMMENT '课程id' AFTER exam_id,
    CHANGE COLUMN exam_id exam_id BIGINT NULL COMMENT '考试id' ,
    DROP INDEX t_c_final_score_unique ,
    ADD UNIQUE INDEX t_c_final_score_unique (culture_program_id ASC, course_id ASC, name ASC, student_code ASC);

ALTER TABLE obe_course_outline
    DROP INDEX obe_course_outline_unique ,
    ADD UNIQUE INDEX obe_course_outline_unique (culture_program_id ASC, course_id ASC);

UPDATE sys_privilege SET related = '77,842,843,844,845,846,847,848,849,850,851,852,853,866,1115,3018,1117,1118,1119,1120,1121,1122,1123,1124,1125,1126,1128,1129' WHERE (id = '841');
UPDATE sys_privilege SET front_display = '0' WHERE (id = '841');
UPDATE sys_privilege SET related = '2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020,2029,2030,2031,2032,2033,2034,3018' WHERE (id = '2006');

UPDATE sys_privilege SET name='达成度统计', url='DegreeManage', `type`='MENU', parent_id=2000, `sequence`=2, property=NULL, related=NULL, enable=1, default_auth=0, front_display=1 WHERE id=1999;

INSERT INTO sys_privilege (id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display) VALUES(2100, '基础数据', 'BasicDataManage', 'MENU', 2000, 3, NULL, NULL, 1, 0, 1);

UPDATE sys_privilege SET name='成绩管理', url='TargetScoreManage', `type`='MENU', parent_id=2100, `sequence`=1, property=NULL, related='2003,2004,2005', enable=1, default_auth=0, front_display=1 WHERE id=2001;
UPDATE sys_privilege SET name='课程目标达成度统计', url='TargetReportManage', `type`='MENU', parent_id=1999, `sequence`=2, property=NULL, related='2021,2022,2023', enable=1, default_auth=0, front_display=1 WHERE id=2002;

-- 2024-06-13
DROP TABLE IF EXISTS `obe_course_requirement_report`;
CREATE TABLE `obe_course_requirement_report` (
     `id` bigint NOT NULL COMMENT '主键',
     `culture_program_id` bigint NOT NULL COMMENT '培养方案id',
     `requirement_radar` mediumtext NOT NULL COMMENT '毕业要求雷达报表',
     `requirement_detail` mediumtext NOT NULL COMMENT '毕业要求详情报表',
     `requirement_degree` double NOT NULL COMMENT '毕业要求达成值',
     PRIMARY KEY (`id`),
     UNIQUE KEY `obe_course_requirement_report_unique` (`culture_program_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='课程毕业要求报表';

ALTER TABLE t_c_final_score MODIFY COLUMN course_code varchar(100) NULL COMMENT '课程编码';
ALTER TABLE t_c_usual_score MODIFY COLUMN course_code varchar(100) NULL COMMENT '课程编码';


CREATE TABLE `obe_culture_program` (
       `id` BIGINT(20) NOT NULL,
       `school_id` BIGINT(20) NULL COMMENT '学校ID',
       `professional_id` BIGINT(20) NULL COMMENT '专业ID',
       `name` VARCHAR(100) NULL COMMENT '培养方案名称',
       `target_count` INT NULL DEFAULT 0 COMMENT '培养目标数量',
       `requirement_count` INT NULL DEFAULT 0 COMMENT '毕业要求数量',
       `course_count` INT NULL DEFAULT 0 COMMENT '课程体系数量',
       `description` MEDIUMTEXT NULL COMMENT '总体描述',
       `expect_value` DOUBLE 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`),
       INDEX `idx_1` (`professional_id` ASC, `name` ASC))
    COMMENT = '培养方案';

ALTER TABLE `t_p_course`
    ADD COLUMN `course_id` BIGINT(20) NULL COMMENT '课程ID' AFTER `culture_program_id`,
    CHANGE COLUMN `professional_id` `culture_program_id` BIGINT NOT NULL COMMENT '培养方案ID' ,
    CHANGE COLUMN `course_code` `course_code` VARCHAR(45) NULL COMMENT '课程代码' ,
    CHANGE COLUMN `course_name` `course_name` VARCHAR(100) NULL COMMENT '课程名称' , COMMENT = '培养方案课程体系' , RENAME TO  `obe_culture_program_course` ;

ALTER TABLE `t_p_requirement`
DROP COLUMN `node_count`,
ADD COLUMN `parent_id` BIGINT(20) NULL COMMENT '上级毕业要求' AFTER `name`,
CHANGE COLUMN `professional_id` `culture_program_id` BIGINT NOT NULL COMMENT '培养方案ID' , COMMENT = '培养方案毕业要求' , RENAME TO  `obe_culture_program_requirement` ;

ALTER TABLE `obe_culture_program_requirement` ADD COLUMN `content` MEDIUMTEXT NULL COMMENT '内容' AFTER `name`;
ALTER TABLE `obe_culture_program_requirement` ADD COLUMN `expect_value` DOUBLE NULL COMMENT '预期值' AFTER `sort_num`;

ALTER TABLE `t_p_matrix`
    ADD COLUMN `intensity` VARCHAR(1) NULL COMMENT '强度' AFTER `content`,
    CHANGE COLUMN `professional_id` `culture_program_id` BIGINT NOT NULL COMMENT '培养方案ID' ,
    CHANGE COLUMN `course_id` `obe_course_id` BIGINT NOT NULL COMMENT '专业认证课程ID' ,
    CHANGE COLUMN `requirement_id` `obe_requirement_id` BIGINT NOT NULL COMMENT '专业认证毕业要求ID' ,
    CHANGE COLUMN `sub_name` `obe_sub_requirement_id` BIGINT(20) NULL DEFAULT NULL COMMENT '子节点名称' , COMMENT = '培养方案毕业要求支撑矩阵' , RENAME TO  `obe_course_requirement_matrix` ;

CREATE TABLE `obe_culture_program_target` (
      `id` BIGINT(20) NOT NULL,
      `culture_program_id` BIGINT(20) NULL COMMENT '培养方案ID',
      `name` VARCHAR(100) NULL COMMENT '培养目标名称',
      `detail` VARCHAR(2000) NULL COMMENT '目标拆解详情',
      `create_id` BIGINT(20) NULL,
      `create_time` BIGINT(20) NULL,
      `update_id` BIGINT(20) NULL,
      `update_time` BIGINT(20) NULL,
      PRIMARY KEY (`id`),
      INDEX `idx_1` (`culture_program_id` ASC))
    COMMENT = '培养方案培养目标';

ALTER TABLE `t_p_professional` COMMENT = '专业表' , RENAME TO  `basic_professional` ;

CREATE TABLE `obe_requirement_target_matrix` (
         `id` BIGINT(20) NOT NULL,
         `culture_program_id` BIGINT(20) NULL COMMENT '培养方案ID',
         `obe_requirement_id` BIGINT(20) NULL COMMENT '毕业要求ID',
         `obe_target_id` BIGINT(20) NULL COMMENT '培养目标ID',
         `enable` TINYINT(1) NULL COMMENT '是否包含',
         `create_id` BIGINT(20) NULL,
         `create_time` BIGINT(20) NULL,
         `update_id` BIGINT(20) NULL,
         `update_time` BIGINT(20) NULL,
         PRIMARY KEY (`id`))
    COMMENT = '培养目标与毕业要求关系矩阵';

UPDATE `sys_privilege` SET `name` = '培养方案管理', `url` = 'CultureProgramManage' WHERE (`id` = '2035');
UPDATE `sys_privilege` SET `name` = '培养方案管理', `url` = 'CultureProgram' WHERE (`id` = '2036');
UPDATE `sys_privilege` SET `name` = '查看详情', `url` = 'CultureProgramDetail', `related` = '2044,2045,2046,2047,2048,2049,2050,2051,2052,2053,2054,2055,2058,2059,2060,2066,2067,2068,2069' WHERE (`id` = '2041');
UPDATE `sys_privilege` SET `url` = '/api/admin/obe/culture/program/page' WHERE (`id` = '2042');
UPDATE `sys_privilege` SET `url` = '/api/admin/obe/culture/program/save' WHERE (`id` = '2043');
UPDATE `sys_privilege` SET `name` = '课程体系-选择课程', `url` = '/api/admin/obe/culture/program/course/query_list' WHERE (`id` = '2044');
UPDATE `sys_privilege` SET `name` = '课程体系-查询列表', `url` = '/api/admin/obe/culture/program/course/list' WHERE (`id` = '2045');
UPDATE `sys_privilege` SET `name` = '课程体系-新增', `url` = '/api/admin/obe/culture/program/course/save' WHERE (`id` = '2046');
UPDATE `sys_privilege` SET `name` = '课程体系-排序', `url` = '/api/admin/obe/culture/program/course/sort' WHERE (`id` = '2047');
UPDATE `sys_privilege` SET `name` = '课程体系-删除', `url` = '/api/admin/obe/culture/program/course/remove' WHERE (`id` = '2048');
UPDATE `sys_privilege` SET `name` = '毕业要求-查询', `url` = '/api/admin/obe/culture/program/requirement/list' WHERE (`id` = '2049');
UPDATE `sys_privilege` SET `name` = '毕业要求-新增/编辑', `url` = '/api/admin/obe/culture/program/requirement/save' WHERE (`id` = '2050');
UPDATE `sys_privilege` SET `name` = '毕业要求-删除', `url` = '/api/admin/obe/culture/program/requirement/remove' WHERE (`id` = '2052');
UPDATE `sys_privilege` SET `name` = '课程支撑毕业要求达成矩阵-查询-查询', `url` = '/api/admin/obe/culture/program/course/matrix/get' WHERE (`id` = '2053');
UPDATE `sys_privilege` SET `name` = '课程支撑毕业要求达成矩阵-提交-提交', `url` = '/api/admin/obe/culture/program/course/matrix/save' WHERE (`id` = '2054');
UPDATE `sys_privilege` SET `name` = '培养目标-列表', `url` = '/api/admin/obe/culture/program/target/list' WHERE (`id` = '2051');
UPDATE `sys_privilege` SET `name` = '培养目标-新增/编辑', `url` = '/api/admin/obe/culture/program/target/save' WHERE (`id` = '2055');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('2058', '培养目标-删除', '/api/admin/obe/culture/program/target/remove', 'URL', '2036', '15', 'AUTH', '1', '0', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('2059', '培养目标与毕业要求关系矩阵-查询', '/api/admin/obe/culture/program/target/matrix/get', 'URL', '2036', '16', 'AUTH', '1', '0', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('2060', '培养目标与毕业要求关系矩阵-提交', '/api/admin/obe/culture/program/target/matrix/save', 'URL', '2036', '17', 'AUTH', '1', '0', '1');
UPDATE `sys_privilege` SET `url` = 'ProfessionalManage', `enable` = '1', `front_display` = '1' WHERE (`id` = '515');
UPDATE `sys_privilege` SET `enable` = '1', `front_display` = '1' WHERE (`id` = '519');
UPDATE `sys_privilege` SET `enable` = '1', `front_display` = '1' WHERE (`id` = '520');
UPDATE `sys_privilege` SET `enable` = '1', `front_display` = '1' WHERE (`id` = '522');
UPDATE `sys_privilege` SET `enable` = '1', `front_display` = '1' WHERE (`id` = '516');
UPDATE `sys_privilege` SET `enable` = '1', `front_display` = '1' WHERE (`id` = '517');
UPDATE `sys_privilege` SET `enable` = '1', `front_display` = '1' WHERE (`id` = '518');
UPDATE `sys_privilege` SET `url` = '/api/admin/basic/professional/page', `enable` = '1', `front_display` = '1' WHERE (`id` = '536');
UPDATE `sys_privilege` SET `url` = '/api/admin/basic/professional/save', `enable` = '1', `front_display` = '1' WHERE (`id` = '537');
UPDATE `sys_privilege` SET `url` = '/api/admin/basic/professional/remove', `enable` = '1', `front_display` = '1' WHERE (`id` = '538');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES ('2061', '编辑', 'Edit', 'LINK', '2036', '8', 'AUTH', '2043', '1', '0', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES ('2062', '复制', 'Copy', 'LINK', '2036', '9', 'AUTH', '2063', '1', '0', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('2063', '复制', '/api/admin/obe/culture/program/copy', 'URL', '2036', '18', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES ('2064', '删除', 'Delete', 'LINK', '2036', '10', 'AUTH', '2065', '1', '0', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('2065', '删除', '/api/admin/obe/culture/program/remove', 'URL', '2036', '19', 'AUTH', '1', '1', '1');
UPDATE `sys_privilege` SET `name` = '达成度分析' WHERE (`id` = '2000');

INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('540', '查询（不分页）', '/api/admin/basic/professional/list', 'URL', '515', '4', 'AUTH', '1', '1', '1');
UPDATE `sys_privilege` SET `related` = '536,540' WHERE (`id` = '519');
UPDATE `sys_privilege` SET `related` = '536,540' WHERE (`id` = '520');
UPDATE `sys_privilege` SET `related` = '536,540' WHERE (`id` = '522');
UPDATE `sys_privilege` SET `related` = '2042,540' WHERE (`id` = '2038');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('2066', '保存总体描述', '/api/admin/obe/culture/program/description/save', 'URL', '2036', '20', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('2067', '设置期望值', '/api/admin/obe/culture/program/requirement/expect/save', 'URL', '2036', '21', 'AUTH', '1', '1', '1');

INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('2068', '基本信息查询', '/api/admin/obe/culture/program/get', 'URL', '2036', '22', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('2069', '毕业要求-新增指标点', '/api/admin/obe/culture/program/requirement/node/add', 'URL', '2036', '23', 'AUTH', '1', '1', '1');

ALTER TABLE `obe_course_requirement_matrix` CHANGE COLUMN `content` `scale` DOUBLE NULL DEFAULT NULL COMMENT '指标值' ;
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('1170', '共用接口-OBE专业', '/api/admin/basic/condition/list_professional', 'URL', '149', '17', 'SYS', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('1171', '共用接口-OBE培养方案', '/api/admin/basic/condition/list_culture_program', 'URL', '149', '18', 'SYS', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('1172', '共用接口-OBE课程', '/api/admin/basic/condition/list_culture_program_course', 'URL', '149', '18', 'SYS', '1', '1', '1');

INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('2080', '学生毕业要求达成度', 'StudentRequirement', 'MENU', '1999', '3', 'AUTH', '1', '0', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES ('2081', '列表', 'List', 'LIST', '2080', '1', 'AUTH', '2085', '1', '0', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES ('2082', '查询条件', 'Condition', 'CONDITION', '2080', '2', 'AUTH', '2085', '1', '0', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES ('2083', '查询', 'Select', 'BUTTON', '2080', '3', 'AUTH', '2085', '1', '0', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES ('2084', '查看详情', 'Detail', 'LINK', '2080', '4', 'AUTH', '2086', '1', '0', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('2085', '查询', '/api/admin/obe/student_requirement/page', 'URL', '2080', '1', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('2086', '查看详情', '/api/admin/obe/student_requirement/detail', 'URL', '2080', '2', 'AUTH', '1', '1', '1');

INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('2070', '毕业要求达成度统计', 'GraduationRequirement', 'MENU', '1999', '1', 'AUTH', '1', '0', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES ('2071', '列表', 'List', 'LIST', '2070', '1', 'AUTH', '2075', '1', '0', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES ('2072', '查询条件', 'Condition', 'CONDITION', '2070', '2', 'AUTH', '2075', '1', '0', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES ('2073', '查询', 'Select', 'BUTTON', '2070', '3', 'AUTH', '2075', '1', '0', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES ('2074', '查看详情', 'Detail', 'LINK', '2070', '4', 'AUTH', '2076,2077', '1', '0', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('2075', '查询', '/api/admin/obe/requirements/list', 'URL', '2070', '1', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('2076', '毕业要求达成度雷达图', '/api/admin/obe/requirements/radar/report', 'URL', '2070', '2', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('2077', '毕业要求达成情况详细报表', '/api/admin/obe/requirements/detail/report', 'URL', '2070', '3', 'AUTH', '1', '1', '1');

ALTER TABLE obe_course_outline
    ADD UNIQUE INDEX obe_course_outline_name_unique (school_id ASC, name ASC);
ALTER TABLE obe_course_outline RENAME INDEX obe_course_outline_unique TO obe_course_outline_course_unique;

ALTER TABLE t_r_basic_info ADD college varchar(200) NULL COMMENT '开课学院';
ALTER TABLE t_r_basic_info ADD profession varchar(200) NULL COMMENT '开课专业';
ALTER TABLE t_r_basic_info CHANGE college college varchar(200) NULL COMMENT '开课学院' AFTER period;
ALTER TABLE t_r_basic_info CHANGE profession profession varchar(200) NULL COMMENT '开课专业' AFTER college;
ALTER TABLE t_r_basic_info ADD finish_points MEDIUMTEXT NULL COMMENT '达成情况';
ALTER TABLE t_r_basic_info CHANGE finish_points finish_points MEDIUMTEXT NULL COMMENT '达成情况' AFTER participant;
ALTER TABLE t_r_basic_info ADD requirement_points MEDIUMTEXT NULL COMMENT '课程支撑毕业要求达成情况评价';
ALTER TABLE t_r_basic_info CHANGE requirement_points requirement_points MEDIUMTEXT NULL COMMENT '课程支撑毕业要求达成情况评价' AFTER finish_points;
ALTER TABLE t_r_basic_info ADD course_suggest MEDIUMTEXT NULL COMMENT '课程持续改进';
ALTER TABLE t_r_basic_info CHANGE course_suggest course_suggest MEDIUMTEXT NULL COMMENT '课程持续改进' AFTER requirement_points;
ALTER TABLE t_r_basic_info ADD course_en_name varchar(100) NULL COMMENT '课程英文名称';
ALTER TABLE t_r_basic_info CHANGE course_en_name course_en_name varchar(100) NULL COMMENT '课程英文名称' AFTER course_name;

INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(2101, '重新计算', 'Calculate', 'LINK', 2070, 5, 'AUTH', '2102', 1, 0, 1);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(2102, '毕业要求达成情况重新计算', '/api/admin/obe/requirements/again/calculate', 'URL', 2070, 4, 'AUTH', NULL, 1, 1, 1);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(2103, '重新计算', 'Calculate', 'BUTTON', 2080, 4, 'AUTH', '2104', 1, 0, 1);
INSERT INTO sys_privilege
(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
VALUES(2104, '学生毕业要求达成度重新计算', '/api/admin/obe/student_requirement/again/calculate', 'URL', 2080, 3, 'AUTH', NULL, 1, 1, 1);