-- ----------------------------
-- Table structure for sys_log_longtext
-- ----------------------------
DROP TABLE IF EXISTS `sys_log_longtext`;
CREATE TABLE `sys_log_longtext`  (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `sys_id` bigint NULL DEFAULT NULL,
  `params` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '请求参数',
  `result` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '结果',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for sys_log_mediumtext
-- ----------------------------
DROP TABLE IF EXISTS `sys_log_mediumtext`;
CREATE TABLE `sys_log_mediumtext`  (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `sys_id` bigint NULL DEFAULT NULL,
  `params` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '请求参数',
  `result` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '结果',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `sys_id`(`sys_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for sys_log_text
-- ----------------------------
DROP TABLE IF EXISTS `sys_log_text`;
CREATE TABLE `sys_log_text`  (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `sys_id` bigint NULL DEFAULT NULL,
  `params` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '请求参数',
  `result` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '结果',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `sys_id`(`sys_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;



drop table if exists resources_question_snapshot;

/*==============================================================*/
/* Table: resources_question_snapshot                           */
/*==============================================================*/
CREATE TABLE `resources_question_snapshot` (
     `resources_question_snapshot_id` bigint(20) NOT NULL COMMENT '题目快照ID',
     `teacher_open_course_question_setting_id` bigint(20) NOT NULL COMMENT '开课题目配置ID',
     `course_info_id` bigint(20) DEFAULT NULL COMMENT '课程ID',
     `question_type` int(2) DEFAULT NULL COMMENT '题型(1单选 2多选 3判断)',
     `question_score` decimal(3,1) DEFAULT NULL COMMENT '分值',
     `question_stem` varchar(3000) DEFAULT NULL COMMENT '题干',
     `question_option_a` varchar(1000) DEFAULT NULL COMMENT '选项A',
     `question_option_b` varchar(1000) DEFAULT NULL COMMENT '选项B',
     `question_option_c` varchar(1000) DEFAULT NULL COMMENT '选项C',
     `question_option_d` varchar(1000) DEFAULT NULL COMMENT '选项D',
     `question_option_e` varchar(1000) DEFAULT NULL COMMENT '选项E',
     `question_answer` varchar(255) DEFAULT NULL COMMENT '答案（单选是一个 多选是多个 判断是对错）',
     `question_analysis` varchar(3000) DEFAULT NULL COMMENT '解析',
     `question_status` int(2) DEFAULT NULL COMMENT '题目状态 （1上架， 2下架）',
     `user_id` bigint(20) DEFAULT NULL COMMENT '后台用户ID',
     `org_id` bigint(20) DEFAULT NULL COMMENT '组织机构ID',
     PRIMARY KEY (`resources_question_snapshot_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='资源管理 - 题库管理-快照-关联来源';



ALTER TABLE hands_on ADD  COLUMN add_time datetime COMMENT '添加时间';
ALTER TABLE hands_on ADD  COLUMN org_id bigint(20) COMMENT '组织机构ID';
ALTER TABLE hands_on ADD  COLUMN user_id bigint(20) COMMENT '后台用户ID';
ALTER TABLE hands_on ADD  COLUMN training_data VARCHAR(1000) COMMENT '数据集（多个地址，逗号隔开）';

drop table if exists hands_on_achievement;
CREATE TABLE `hands_on_achievement` (
    `hand_on_achievement_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
    `hand_on_id` bigint(20) DEFAULT NULL COMMENT '实操项目ID',
    `class_id` bigint(20) DEFAULT NULL COMMENT '班级ID',
    `student_id` bigint(20) DEFAULT NULL COMMENT '学生ID',
    `video_score`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '观看视频得分',
    `ppt_score` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '观看PTT得分',
    `theory_score` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '理论测评得分',
    `practical_training_score` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '实训操作步骤得分',
    `report_writing_score` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '报告撰写得分',
    `total_score` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '合计得分',
    `hand_on_achievement_status` int(11) DEFAULT NULL COMMENT '状态(1正常 2删除)',
    `add_time` datetime(3) DEFAULT NULL COMMENT '添加时间',
    `org_id` bigint(20) DEFAULT NULL COMMENT '组织机构ID',
    `user_id` bigint(20) DEFAULT NULL COMMENT '后台用户ID',
    PRIMARY KEY (`hand_on_achievement_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=244 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='课程实操-实操成绩';
drop table if exists teacher_open_course_score_weight;
create table teacher_open_course_score_weight
(
    teacher_open_course_id bigint not null comment '课程id',
    teacher_id           bigint comment '老师id',
    sign_in_result       varchar(255) comment '签到成绩(权重)',
    chapter_contact_result varchar(255) comment '章节联系成绩(权重)',
    course_practice_result varchar(255) comment '课程实操成绩(权重)',
    homework_result      varchar(255) comment '作业成绩(权重)',
    examination_result   varchar(255) comment '考试成绩(权重)',
    interaction_result   varchar(255) comment '互动成绩(权重)',
    sign_in_result_setting varchar(255) comment '签到成绩设置1签到次数2到课到率',
    sign_in_score        varchar(255) comment '签到次数_每签到一次分数',
    chapter_contact_result_setting varchar(255) comment '章节联系设置1正确率积分2平均完成度计分',
    course_practice_result_setting varchar(255) comment '课程实操成绩设置1平均分2平均完成进度',
    homework_result_setting varchar(255) comment '作业成绩设置1平均分(默认1)',
    examination_result_setting varchar(255) comment '考试成绩设置1平均分(默认1)',
    interaction_result_setting varchar(255) comment '互动成绩设置1留言2提问3回答',
    interaction_result_message_score varchar(255) comment '互动成绩留言得分',
    interaction_result_question_score varchar(255) comment '互动成绩提问得分',
    interaction_result_answer_score varchar(255) comment '互动成绩回答得分',
    result_status_setting varchar(255) comment '成绩状态设置1二分法2等级法3字母法',
    dichotomy_score      varchar(255) comment '二分法分数',
    excellent_score      varchar(255) comment '等级法优秀分数',
    good_score           varchar(255) comment '等级法良好分数',
    secondary_score      varchar(255) comment '等级法中等分数',
    pass_score           varchar(255) comment '等级法及格分数',
    lettera_score        varchar(255) comment '字母法A分数',
    letterb_score        varchar(255) comment '字母法B分数',
    letterc_score        varchar(255) comment '字母法C分数',
    letterd_score        varchar(255) comment '字母法D分数',
    org_id               bigint comment '组织ID',
    user_id              bigint comment '用户ID',
    create_time          bigint comment '创建时间',
    primary key (teacher_open_course_id)
)
    auto_increment = 1
    ENGINE = InnoDB
    DEFAULT CHARACTER SET = utf8
    COLLATE = utf8_general_ci;

alter table teacher_open_course_score_weight comment '教师-我的课程-成绩权重';

ALTER TABLE teacher_open_course_score_dashboard ADD  COLUMN teacher_open_course_id bigint(20) COMMENT '课程开课ID';

ALTER TABLE resources_application ADD  COLUMN link_secret_key varchar(255) COMMENT '链接秘钥';

drop table if exists teacher_open_course_knowledge_point_relation;
CREATE TABLE `teacher_open_course_knowledge_point_relation` (
    `teacher_open_course_knowledge_relation_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '关联ID',
    `teacher_open_course_knowledge_point_id` bigint(20) NOT NULL COMMENT '课程开课-知识点ID',
    `bussiness_id` bigint(20) NOT NULL COMMENT '业务ID',
    `bussiness_type` bigint(20) NOT NULL COMMENT '业务类型1章节练习2课程实操, 业务id是主键自增存在重复',
    `create_time` datetime DEFAULT NULL COMMENT '创建时间',
    `org_id` bigint(20) DEFAULT NULL COMMENT '组织ID',
    `user_id` bigint(20) DEFAULT NULL COMMENT '用户ID',
    `del_flag` int(11) NOT NULL DEFAULT '0' COMMENT '是否删除 1删除，0未删除',
    PRIMARY KEY (`teacher_open_course_knowledge_relation_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='教师-课程开课-知识点-关联表';


# 院校增加默认管理员
ALTER TABLE universities_colleges ADD COLUMN universities_cdolleges_default_admin_user_id bigint(20) COMMENT '院校默认管理员用户ID';

drop table if exists hands_on_simulation_tasks_file;

create table hands_on_simulation_tasks_file
(
    task_file_id         bigint not null comment '实操任务文件ID',
    hands_on_id          bigint comment '实操ID',
    task_id              bigint comment '任务ID',
    file_url             varchar(255) comment '文件地址',
    file_type            varchar(32) comment '文件类型',
    file_time            varchar(32) comment '视频时长',
    file_name            varchar(64) comment '文件名称',
    add_time             datetime comment '添加时间',
    user_id              bigint comment '用户ID',
    org_id               bigint comment '部门ID',
    primary key (task_file_id)
)
    auto_increment = 1
    ENGINE = InnoDB
    DEFAULT CHARACTER SET = utf8
    COLLATE = utf8_general_ci;

alter table hands_on_simulation_tasks_file comment '课程实操-实训任务附件表';


drop table if exists teacher_open_course_merge_resources_question;

/*==============================================================*/
/* Table: teacher_open_course_merge_resources_question          */
/*==============================================================*/
create table teacher_open_course_merge_resources_question
(
    teacher_open_course_merge_resources_question_id bigint unsigned not null comment 'ID',
    teacher_open_course_id bigint comment '开课ID',
    course_info_id       bigint comment '课程ID',
    question_type        int(2) comment '题型(1单选 2多选 3判断)',
    question_score       decimal(3,1) comment '分值',
    question_stem        varchar(3000) comment '题干',
    question_option_a    varchar(1000) comment '选项A',
    question_option_b    varchar(1000) comment '选项B',
    question_option_c    varchar(1000) comment '选项C',
    question_option_d    varchar(1000) comment '选项D',
    question_option_e    varchar(1000) comment '选项E',
    question_answer      varchar(255) comment '答案（单选是一个 多选是多个 判断是对错）',
    question_analysis    varchar(3000) comment '解析',
    question_status      int(2) comment '题目状态 （1上架， 0下架）',
    user_id              bigint comment '后台用户ID',
    org_id               bigint comment '组织机构ID',
    primary key (teacher_open_course_merge_resources_question_id)
)
    auto_increment = 1
    ENGINE = InnoDB
    DEFAULT CHARACTER SET = utf8
    COLLATE = utf8_general_ci;

alter table teacher_open_course_merge_resources_question comment '开课-题库管理-离线';


drop table if exists teacher_open_course_merge_course_info;

/*==============================================================*/
/* Table: teacher_open_course_merge_course_info                 */
/*==============================================================*/
create table teacher_open_course_merge_course_info
(
    teacher_open_course_merge_course_info_id bigint unsigned not null auto_increment comment 'ID',
    teacher_open_course_id bigint comment '开课ID',
    course_info_name     varchar(255) comment '名称（课程名 或 章名 或 节名）',
    course_info_thumbnail varchar(255) comment '课程缩略图',
    course_label_id      bigint comment '课程标签ID',
    course_info_basics_count integer comment '课程学习人数基数',
    course_info_content  varchar(3000) comment '课程简介',
    course_info_status   int(2) comment '状态(1启用 2禁用 3删除)',
    course_info_type     int(2) comment '类型(1课程 2章 3节)',
    course_info_parent_id bigint comment '父节点ID',
    course_video_id      bigint comment '视频ID(resources_info_id，和节对应)',
    course_courseware_id bigint comment '课件ID(resources_info_id，和节对应)',
    course_enclosure_ids varchar(3000) comment '附件IDs(resources_info_id，和节对应)',
    resources_question_ids varchar(3000) comment '客观题IDs（和章对应）',
    resources_competition_ids varchar(3000) comment '竞赛题IDs（和章对应）',
    resources_training_ids varchar(3000) comment '实训题IDs（和章对应）',
    org_id               bigint comment '组织机构ID',
    user_id              bigint comment '后台用户ID',
    primary key (teacher_open_course_merge_course_info_id)
)
    auto_increment = 1
    ENGINE = InnoDB
    DEFAULT CHARACTER SET = utf8
    COLLATE = utf8_general_ci;

alter table teacher_open_course_merge_course_info comment '开课- 课程配置-离线';

drop table if exists teacher_open_course_hands_on;
CREATE TABLE `teacher_open_course_hands_on` (
`hands_on_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '实操主键',
`teacher_open_course_id` bigint(20) DEFAULT NULL COMMENT '开课ID',
`course_info_id` bigint(20) DEFAULT NULL COMMENT '归属课程',
`course_child_node` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '归属章节',
`hands_on_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '实操名称',
`hands_on_recommend` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci COMMENT '实操介绍',
`add_time` datetime DEFAULT NULL COMMENT '添加时间',
`org_id` bigint(20) DEFAULT NULL COMMENT '组织机构ID',
`user_id` bigint(20) DEFAULT NULL COMMENT '后台用户ID',
`training_data` varchar(1000) DEFAULT NULL COMMENT '数据集（多个地址，逗号隔开）',
PRIMARY KEY (`hands_on_id`) USING BTREE,
KEY `PK_teacher_open_course_id` (`teacher_open_course_id`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='教师开课-课程实操';

drop table if exists teacher_open_course_hands_on_simulation_tasks;
CREATE TABLE `teacher_open_course_hands_on_simulation_tasks` (
 `task_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '实训任务id',
 `hands_on_id` bigint(20) DEFAULT NULL COMMENT '实操id(关联主表)',
 `teacher_open_course_id` bigint(20) DEFAULT NULL COMMENT '开课ID',
 `task_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '任务类型',
 `task_title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '任务标题',
 `task_score` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '任务分值',
 `task_order` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '任务顺序',
 `task_status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '任务状态',
 `assessment_requirements` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '考核要求(A,B,',
 `assessment_time` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '考核时间分钟(考核要求AC必填)',
 `assessment_content` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '考核内容',
 `file_url` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci COMMENT '附件地址',
 `task_list` longtext COMMENT '题目id',
 `org_id` bigint(20) DEFAULT NULL COMMENT '组织机构ID',
 `user_id` bigint(20) DEFAULT NULL COMMENT '后台用户ID',
 `add_time` datetime DEFAULT NULL COMMENT '添加时间',
 PRIMARY KEY (`task_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='教师开课-课程实操-实训任务';

drop table if exists teacher_open_course_hands_on_simulation_tasks_file;
CREATE TABLE `teacher_open_course_hands_on_simulation_tasks_file` (
  `task_file_id` bigint(20) NOT NULL COMMENT '实操任务文件ID',
  `teacher_open_course_id` bigint(20) DEFAULT NULL COMMENT '开课ID',
  `hands_on_id` bigint(20) DEFAULT NULL COMMENT '实操ID',
  `task_id` bigint(20) DEFAULT NULL COMMENT '任务ID',
  `file_url` varchar(255) DEFAULT NULL COMMENT '文件地址',
  `file_type` varchar(32) DEFAULT NULL COMMENT '文件类型',
  `file_time` varchar(32) DEFAULT NULL COMMENT '视频时长',
  `file_name` varchar(64) DEFAULT NULL COMMENT '文件名称',
  `add_time` datetime DEFAULT NULL COMMENT '添加时间',
  `user_id` bigint(20) DEFAULT NULL COMMENT '用户ID',
  `org_id` bigint(20) DEFAULT NULL COMMENT '部门ID',
  PRIMARY KEY (`task_file_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='教师开课-课程实操-实训任务附件表';


ALTER TABLE teacher_open_course_schedule_session ADD  COLUMN teacher_open_course_schedule_session_status_week_detail varchar(100) COMMENT '开课星期 多个逗号隔开 枚举WeekDetailType';

drop table if exists teacher_open_course_merge_schedule_session;

/*==============================================================*/
/* Table: teacher_open_course_merge_schedule_session            */
/*==============================================================*/
create table teacher_open_course_merge_schedule_session
(
    teacher_open_course_merge_schedule_session_id bigint not null comment '课程开课-班级-排课配置-关联ID',
    teacher_open_course_id bigint comment '开课ID',
    teacher_open_course_schedule_session_id bigint comment '课程排课配置ID',
    teacher_open_course_merge_schedule_session_add_time datetime comment '添加时间',
    teacher_open_course_merge_schedule_session_status int(2) comment '状态',
    org_id               bigint comment '组织ID',
    user_id              bigint comment '用户ID',
    primary key (teacher_open_course_merge_schedule_session_id)
)
    auto_increment = 1
    ENGINE = InnoDB
    DEFAULT CHARACTER SET = utf8
    COLLATE = utf8_general_ci;

alter table teacher_open_course_merge_schedule_session comment '课程开课-关联-排课配置';
