USE teachcloud_db;

CREATE TABLE `t_p_professional` (
       `id` BIGINT(20) NOT NULL,
       `school_id` BIGINT(20) NULL COMMENT '学校ID',
       `name` VARCHAR(80) NULL COMMENT '专业名称',
       `org_id` BIGINT(20) NULL COMMENT '所属学院ID',
       `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`))
    COMMENT = '专业认证专业表';

CREATE TABLE `t_p_course` (
     `id` BIGINT(20) NOT NULL,
     `professional_id` BIGINT(20) NOT NULL COMMENT '专业ID',
     `course_code` VARCHAR(45) NOT NULL COMMENT '课程代码',
     `course_name` VARCHAR(100) NOT NULL COMMENT '课程名称',
     `sort_num` INT 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`),
     KEY `uq_professional_id` (`professional_id`))
    COMMENT = '专业认证课程';

CREATE TABLE `t_p_requirement` (
      `id` BIGINT(20) NOT NULL,
      `professional_id` BIGINT(20) NOT NULL COMMENT '专业ID',
      `code` VARCHAR(50) NULL COMMENT '毕业要求code',
      `name` VARCHAR(50) NOT NULL COMMENT '毕业要求',
      `node_count` INT NULL COMMENT '节点数量',
      `sort_num` INT 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`),
      KEY `uq_professional_id` (`professional_id`))
    COMMENT = '专业认证毕业要求';

CREATE TABLE `t_p_matrix` (
         `id` BIGINT(20) NOT NULL,
         `professional_id` BIGINT(20) NOT NULL COMMENT '专业ID',
         `course_id` BIGINT(20) NOT NULL COMMENT '专业认证课程ID',
         `requirement_id` BIGINT(20) NOT NULL COMMENT '专业认证毕业要求ID',
         `sub_name` VARCHAR(45) NULL COMMENT '子节点名称',
         `content` 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`),
         KEY `uq_professional_id` (`professional_id`))
    COMMENT = '专业认证毕业要求支撑矩阵';


INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `enable`, `default_auth`, `front_display`) VALUES ('1999', '课程目标达成度', 'DegreeManage', 'MENU', '2000', '2', '1', '0', '1');
UPDATE `sys_privilege` SET `parent_id` = '1999' WHERE (`id` = '2001');
UPDATE `sys_privilege` SET `parent_id` = '1999' WHERE (`id` = '2002');

INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `enable`, `default_auth`, `front_display`) VALUES ('2035', '专业认证管理', 'ProfessionalCertificationManage', 'MENU', '2000', '1', '1', '0', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `enable`, `default_auth`, `front_display`) VALUES ('2036', '专业认证', 'ProfessionalCertification', 'MENU', '2035', '1', '1', '0', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES ('2037', '列表', 'List', 'LIST', '2036', '1', 'AUTH', '2042', '1', '0', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES ('2038', '查询条件', 'Condition', 'CONDITION', '2036', '2', 'AUTH', '2042', '1', '0', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES ('2039', '查询', 'Select', 'BUTTON', '2036', '3', 'AUTH', '2042', '1', '0', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES ('2040', '新增', 'Add', 'BUTTON', '2036', '4', 'AUTH', '2043', '1', '0', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES ('2041', '管理', 'CertificationManage', 'LINK', '2036', '5', 'AUTH', '2044,2045,2046,2047,2048,2049,2050,2051,2052,2053,2054,2055', '1', '0', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('2042', '查询', '/api/admin/professional/certification/page', 'URL', '2036', '1', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('2043', '新增', '/api/admin/professional/certification/save', 'URL', '2036', '2', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('2044', '课程管理-选择课程', '/api/admin/professional/certification/course/query_list', 'URL', '2036', '3', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('2045', '课程管理-查询列表', '/api/admin/professional/certification/course/list', 'URL', '2036', '4', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('2046', '课程管理-新增', '/api/admin/professional/certification/course/save', 'URL', '2036', '5', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('2047', '课程管理-排序', '/api/admin/professional/certification/course/sort', 'URL', '2036', '6', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('2048', '课程管理-删除', '/api/admin/professional/certification/course/remove', 'URL', '2036', '7', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('2049', '毕业要求管理-查询', '/api/admin/professional/certification/requirement/list', 'URL', '2036', '8', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('2050', '毕业要求管理-新增/编辑', '/api/admin/professional/certification/requirement/save', 'URL', '2036', '9', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('2051', '毕业要求管理-排序', '/api/admin/professional/certification/requirement/sort', 'URL', '2036', '10', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('2052', '毕业要求管理-删除', '/api/admin/professional/certification/requirement/remove', 'URL', '2036', '11', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('2053', '毕业支撑矩阵-查询', '/api/admin/professional/certification/matrix/get', 'URL', '2036', '12', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('2054', '毕业支撑矩阵-提交', '/api/admin/professional/certification/matrix/save', 'URL', '2036', '13', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('2055', '毕业支撑矩阵-下载', '/api/admin/professional/certification/matrix/download', 'URL', '2036', '14', 'AUTH', '1', '1', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('2056', '是否可编辑（课程）', 'canEditCourse', 'LINK', '2036', '6', 'AUTH', '1', '0', '1');
INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('2057', '是否可编辑（毕业要求）', 'canEditRequirement', 'LINK', '2036', '7', 'AUTH', '1', '0', '1');

update scan_omr_task set conditions='QUESTION_BLANK' where conditions='QUESTION_SINGLE_BLANK' OR conditions='QUESTION_MULTI_BLANK' ;
