/* Converted from PostgreSQL dump (Navicat) to MySQL Source Server : pgm-8vblib6zda9jw4q1fo.pgsql.zhangbei.rds.aliyuncs.com Source Server Type : PostgreSQL Source Host : pgm-8vblib6zda9jw4q1fo.pgsql.zhangbei.rds.aliyuncs.com:5432 Source Catalog : temp_education Source Schema : base Target Server Type : MySQL File Encoding : 65001 (UTF-8) Date: 17/08/2026 14:15:33 */ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for bus_class -- ---------------------------- DROP TABLE IF EXISTS `bus_class`; CREATE TABLE `bus_class` ( `id` bigint NOT NULL COMMENT '班级ID', `name` varchar(255) DEFAULT NULL COMMENT '班级名称', `code` varchar(50) DEFAULT NULL COMMENT '班级编码', `status` smallint DEFAULT NULL COMMENT '班级状态:1-未申请 2-待审核 3-报名中(作废) 4-待开班 5- 培训中 6-培训结束 -1-审核未通过 0-错误班级 其中 2、-1三个状态是预留状态,暂时没有', `start_time` datetime(0) DEFAULT NULL COMMENT '有效期开始时间', `end_time` datetime(0) DEFAULT NULL COMMENT '有效期结束时间', `tenant_id` bigint DEFAULT NULL COMMENT '租户ID', `train_class_id` bigint DEFAULT NULL COMMENT '三级教育合体班级ID', `train_class_sort` int DEFAULT NULL COMMENT '三级教育班级排序', `is_deleted` smallint DEFAULT 0 COMMENT '是否删除(0有效 1删除)', `creator` bigint DEFAULT NULL COMMENT '创建人', `updater` bigint DEFAULT NULL COMMENT '更新人', `create_date` datetime(6) DEFAULT NULL COMMENT '创建时间', `update_date` datetime(6) DEFAULT NULL COMMENT '更新时间', `old_id` varchar(50) DEFAULT NULL COMMENT '历史系统ID', `work_order_id` bigint DEFAULT NULL COMMENT '工单id', `industry_type_id` bigint DEFAULT NULL COMMENT '行业类型表id', `source_type` smallint DEFAULT NULL COMMENT '班级来源:1工单,2直开班,3活动班级', `enterprise_name` varchar(255) DEFAULT NULL COMMENT '企业名称', `post_type_id` bigint DEFAULT NULL COMMENT '岗位类型表id', `enterprise_id` bigint DEFAULT NULL COMMENT '企业id', `training_type_id` bigint DEFAULT NULL COMMENT '培训类型,如三级教育、全员培训等', `child_training_type_id` bigint DEFAULT NULL COMMENT '培训类型子类型,如三级教育培训等', `full_industry_type_name` varchar(255) DEFAULT NULL COMMENT '完整路径行业类型名称', `full_training_type_name` varchar(255) DEFAULT NULL COMMENT '完整路径培训类型名称', `child_child_training_type_id` bigint DEFAULT NULL COMMENT '培训类型子类型的子类型,如班组级、车间级等', `read_status` smallint DEFAULT NULL COMMENT '0未读 1已读', `class_created_notify_sent` smallint NOT NULL DEFAULT 0 COMMENT '开班提醒发送状态:0未发送,1已发送', `auto_class_opening` smallint DEFAULT 0 COMMENT '是否自动开班 0否 1是', `class_usage` int NOT NULL DEFAULT 1 COMMENT '班级用途:1普通学习班级,2活动模板班级', `activity_id` bigint DEFAULT NULL COMMENT '活动ID', `settlement_status` int NOT NULL DEFAULT 0 COMMENT '结算状态:0待结算 1已结算', `settlement_student_count` int NOT NULL DEFAULT 0 COMMENT '结算学员数', `settlement_time` datetime(6) DEFAULT NULL COMMENT '结算时间', `settlement_operator_id` bigint DEFAULT NULL COMMENT '结算操作人ID', `settlement_operator_name` varchar(100) DEFAULT NULL COMMENT '结算操作人姓名', `activity_period_id` bigint DEFAULT NULL COMMENT '活动期次ID,用于活动期次调整时定向同步班级', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='班级主表(核心信息)'; -- ---------------------------- -- Table structure for bus_class_certificate -- ---------------------------- DROP TABLE IF EXISTS `bus_class_certificate`; CREATE TABLE `bus_class_certificate` ( `class_id` bigint NOT NULL COMMENT '班级ID', `certificate_type` smallint DEFAULT NULL COMMENT '取证类型1-秦皇岛 2-唐山', `number_prefix` varchar(50) DEFAULT NULL COMMENT '证书编号前缀', `number_initial_value` int DEFAULT NULL COMMENT '证书编号初始值', `is_code_auto` smallint DEFAULT NULL COMMENT '是否自动生成编号', `tenant_id` bigint DEFAULT NULL COMMENT '租户id', PRIMARY KEY (`class_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='班级证书编号与取证规则'; -- ---------------------------- -- Table structure for bus_class_config -- ---------------------------- DROP TABLE IF EXISTS `bus_class_config`; CREATE TABLE `bus_class_config` ( `class_id` bigint NOT NULL COMMENT '班级ID', `trainers_number` int DEFAULT 0 COMMENT '培训人数', `issue` smallint DEFAULT 0 COMMENT '期次', `is_check_period` smallint DEFAULT NULL COMMENT '是否允许查看学时证明', `is_questionnaire` smallint DEFAULT NULL COMMENT '是否调查问卷', `sampling_number` int DEFAULT NULL COMMENT '抽查人数', `has_exam` smallint DEFAULT 0 COMMENT '是否考试(1是0否)', `number_of_exams` int DEFAULT NULL COMMENT '考试次数', `is_strengthen` smallint DEFAULT NULL COMMENT '是否效果评估(2强制 1是 0否)', `is_disarrange_question` smallint DEFAULT NULL COMMENT '是否打乱试题顺序', `tenant_id` bigint DEFAULT NULL COMMENT '租户id', `is_code_auto` smallint DEFAULT NULL COMMENT '是否生成学员档案编号(已弃用)', `survey_template_id` bigint DEFAULT NULL COMMENT '问卷模板ID', `survey_publish_id` bigint DEFAULT NULL COMMENT '问卷发放ID', PRIMARY KEY (`class_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='班级培训规则配置'; -- ---------------------------- -- Table structure for bus_class_curriculum_alias -- ---------------------------- DROP TABLE IF EXISTS `bus_class_curriculum_alias`; CREATE TABLE `bus_class_curriculum_alias` ( `id` bigint NOT NULL COMMENT '主键ID', `curriculum_id` bigint NOT NULL COMMENT '课程ID', `class_id` bigint NOT NULL COMMENT '班级ID', `curriculum_name` varchar(255) NOT NULL COMMENT '课程原名称', `curriculum_alias` varchar(255) DEFAULT NULL COMMENT '课程别名', `tenant_id` bigint DEFAULT NULL COMMENT '租户ID', `is_deleted` smallint NOT NULL DEFAULT 0 COMMENT '是否删除(0有效 1删除)', `creator` bigint DEFAULT NULL COMMENT '创建人', `updater` bigint DEFAULT NULL COMMENT '更新人', `create_date` datetime(6) DEFAULT NULL COMMENT '创建时间', `update_date` datetime(6) DEFAULT NULL COMMENT '更新时间', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='课程班级别名关联表'; -- ---------------------------- -- Table structure for bus_class_curriculum_chapter_relation -- ---------------------------- DROP TABLE IF EXISTS `bus_class_curriculum_chapter_relation`; CREATE TABLE `bus_class_curriculum_chapter_relation` ( `id` bigint NOT NULL COMMENT '主键ID', `class_id` bigint DEFAULT NULL COMMENT '班级ID', `curriculum_id` bigint DEFAULT NULL COMMENT '课程ID', `curriculum_version_info_id` bigint DEFAULT NULL COMMENT '课程版本ID', `chapter_id` bigint DEFAULT NULL COMMENT '章节ID', `tenant_id` bigint DEFAULT NULL COMMENT '租户ID', `creator` bigint DEFAULT NULL COMMENT '创建者', `create_date` datetime(6) DEFAULT NULL COMMENT '创建时间', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='代理-班级课程章节关系表'; -- ---------------------------- -- Table structure for bus_class_curriculum_exam_paper_relation -- ---------------------------- DROP TABLE IF EXISTS `bus_class_curriculum_exam_paper_relation`; CREATE TABLE `bus_class_curriculum_exam_paper_relation` ( `id` bigint NOT NULL COMMENT '主键ID', `curriculum_id` bigint DEFAULT NULL COMMENT '课程表', `exam_paper_id` bigint DEFAULT NULL COMMENT '试卷id', `class_id` bigint DEFAULT NULL COMMENT '班级id', `tenant_id` bigint DEFAULT NULL COMMENT '租户ID', `creator` varchar(255) DEFAULT NULL COMMENT '创建人', `updater` varchar(255) DEFAULT NULL COMMENT '更新人', `create_date` datetime(6) DEFAULT NULL COMMENT '创建时间', `update_date` datetime(6) DEFAULT NULL COMMENT '更新时间', `use_flag` smallint DEFAULT NULL COMMENT '使用状态:0-未使用,1-使用中', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='班级与课程试卷关联表'; -- ---------------------------- -- Table structure for bus_class_curriculum_post_exam_relation -- ---------------------------- DROP TABLE IF EXISTS `bus_class_curriculum_post_exam_relation`; CREATE TABLE `bus_class_curriculum_post_exam_relation` ( `id` bigint NOT NULL COMMENT '主键ID', `class_id` bigint NOT NULL COMMENT '班级ID', `curriculum_id` bigint NOT NULL COMMENT '课程ID', `curriculum_version_info_id` bigint NOT NULL COMMENT '课程版本ID', `department_id` bigint NOT NULL COMMENT '部门ID', `department_name` varchar(255) DEFAULT NULL COMMENT '部门名称', `post_id` bigint NOT NULL COMMENT '工种ID', `post_name` varchar(255) DEFAULT NULL COMMENT '工种名称', `exam_paper_id` bigint DEFAULT NULL COMMENT '试卷ID', `exam_paper_type` int DEFAULT NULL COMMENT '试卷类型:1-自动生成试卷,2-平台试卷', `tenant_id` bigint DEFAULT NULL COMMENT '租户ID', `creator` bigint DEFAULT NULL COMMENT '创建者', `create_date` datetime(6) DEFAULT NULL COMMENT '创建时间', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='代理-班级课程工种试卷关系表'; -- ---------------------------- -- Table structure for bus_class_curriculum_relation -- ---------------------------- DROP TABLE IF EXISTS `bus_class_curriculum_relation`; CREATE TABLE `bus_class_curriculum_relation` ( `id` bigint NOT NULL COMMENT '主键ID', `class_id` bigint DEFAULT NULL COMMENT '班级id', `curriculum_id` bigint DEFAULT NULL COMMENT '课程id', `tenant_id` bigint DEFAULT NULL COMMENT '租户ID', `creator` varchar(255) DEFAULT NULL COMMENT '创建人', `updater` varchar(255) DEFAULT NULL COMMENT '更新人', `create_date` datetime(6) DEFAULT NULL COMMENT '创建时间', `update_date` datetime(6) DEFAULT NULL COMMENT '更新时间', `curriculum_version_info_id` bigint DEFAULT NULL COMMENT '课程版本id', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='班级与课程关联表'; -- ---------------------------- -- Table structure for bus_class_enterprise_relation -- ---------------------------- DROP TABLE IF EXISTS `bus_class_enterprise_relation`; CREATE TABLE `bus_class_enterprise_relation` ( `id` bigint NOT NULL COMMENT '主键ID', `class_id` bigint DEFAULT NULL COMMENT '班级表id', `enterprise_id` bigint DEFAULT NULL COMMENT '被培训企业ID', `is_deleted` smallint DEFAULT 0 COMMENT '是否删除(0有效 1删除)', `creator` bigint DEFAULT NULL COMMENT '创建人', `updater` bigint DEFAULT NULL COMMENT '更新人', `create_date` datetime(6) DEFAULT NULL COMMENT '创建时间', `update_date` datetime(6) DEFAULT NULL COMMENT '更新时间', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='班级企业关联表'; -- ---------------------------- -- Table structure for bus_class_evaluator -- ---------------------------- DROP TABLE IF EXISTS `bus_class_evaluator`; CREATE TABLE `bus_class_evaluator` ( `class_id` bigint NOT NULL COMMENT '班级ID', `evaluator_id` bigint NOT NULL COMMENT '参加评估人ID,对应企业附件表中6人签字人员类型', `tenant_id` bigint DEFAULT NULL COMMENT '租户ID', PRIMARY KEY (`class_id`, `evaluator_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='班级参加评估人表'; -- ---------------------------- -- Table structure for bus_class_exam_config -- ---------------------------- DROP TABLE IF EXISTS `bus_class_exam_config`; CREATE TABLE `bus_class_exam_config` ( `class_id` bigint NOT NULL COMMENT '班级ID', `exam_time` date DEFAULT NULL COMMENT '考试时间', `is_face_recognition` smallint DEFAULT NULL COMMENT '是否培训人脸识别', `is_exam_face` smallint DEFAULT NULL COMMENT '是否考试人脸识别', `is_face_time` varchar(255) DEFAULT NULL COMMENT '人脸验证时间', `tenant_id` bigint DEFAULT NULL COMMENT '租户id', PRIMARY KEY (`class_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='班级考试与人脸识别配置'; -- ---------------------------- -- Table structure for bus_class_org -- ---------------------------- DROP TABLE IF EXISTS `bus_class_org`; CREATE TABLE `bus_class_org` ( `class_id` bigint NOT NULL COMMENT '班级ID', `admin_division` varchar(255) DEFAULT NULL COMMENT '行政区划描述', `province_code` varchar(50) DEFAULT NULL COMMENT '省编码', `city_code` varchar(50) DEFAULT NULL COMMENT '市编码', `county_code` varchar(50) DEFAULT NULL COMMENT '区县编码', `province_name` varchar(255) DEFAULT NULL COMMENT '省名称', `city_name` varchar(255) DEFAULT NULL COMMENT '市名称', `county_name` varchar(255) DEFAULT NULL COMMENT '区县名称', `principal` varchar(50) DEFAULT NULL COMMENT '负责人', `principal_phone` varchar(50) DEFAULT NULL COMMENT '负责人手机号', `recorder_id` bigint DEFAULT NULL COMMENT '记录人员ID', `assessor_id` bigint DEFAULT NULL COMMENT '考核人员ID', `safety_dept_id` bigint DEFAULT NULL COMMENT '安全管理部门负责人ID', `tenant_id` bigint DEFAULT NULL COMMENT '租户id', PRIMARY KEY (`class_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='班级行政区域与人员信息'; -- ---------------------------- -- Table structure for bus_class_qr_code_refresh -- ---------------------------- DROP TABLE IF EXISTS `bus_class_qr_code_refresh`; CREATE TABLE `bus_class_qr_code_refresh` ( `id` bigint NOT NULL COMMENT '主键ID', `class_id` bigint NOT NULL COMMENT '班级ID', `refresh_time` bigint NOT NULL COMMENT '二维码刷新时间戳', `tenant_id` bigint DEFAULT NULL COMMENT '租户ID', `creator` bigint DEFAULT NULL COMMENT '创建人', `create_date` datetime(6) DEFAULT NULL COMMENT '创建时间', PRIMARY KEY (`id`), UNIQUE KEY `uk_bus_class_qr_code_refresh_class_id` (`class_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='班级二维码刷新记录表'; -- ---------------------------- -- Table structure for bus_class_settlement_record -- ---------------------------- DROP TABLE IF EXISTS `bus_class_settlement_record`; CREATE TABLE `bus_class_settlement_record` ( `id` bigint NOT NULL COMMENT '主键ID', `class_id` bigint NOT NULL COMMENT '班级ID', `record_type` int NOT NULL COMMENT '流水类型:1确认结算 2反结算', `before_status` int DEFAULT NULL COMMENT '操作前结算状态', `after_status` int DEFAULT NULL COMMENT '操作后结算状态', `before_student_count` int DEFAULT NULL COMMENT '操作前结算学员数', `after_student_count` int DEFAULT NULL COMMENT '操作后结算学员数', `operator_id` bigint DEFAULT NULL COMMENT '操作人ID', `operator_name` varchar(100) DEFAULT NULL COMMENT '操作人姓名', `settlement_time` datetime(6) DEFAULT NULL COMMENT '结算操作时间', `remark` varchar(500) DEFAULT NULL COMMENT '备注', `tenant_id` bigint DEFAULT NULL COMMENT '租户ID', `creator` bigint DEFAULT NULL COMMENT '创建者', `create_date` datetime(6) DEFAULT NULL COMMENT '创建时间', `updater` bigint DEFAULT NULL COMMENT '更新者', `update_date` datetime(6) DEFAULT NULL COMMENT '更新时间', `is_deleted` int NOT NULL DEFAULT 0 COMMENT '是否删除:0否 1是', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='班级结算流水'; -- ---------------------------- -- Table structure for bus_class_student_curriculum_exam_relation -- ---------------------------- DROP TABLE IF EXISTS `bus_class_student_curriculum_exam_relation`; CREATE TABLE `bus_class_student_curriculum_exam_relation` ( `id` bigint NOT NULL COMMENT '主键ID', `class_id` bigint NOT NULL COMMENT '班级ID', `student_id` bigint NOT NULL COMMENT '学员ID', `department_id` bigint NOT NULL COMMENT '部门ID', `department_name` varchar(255) DEFAULT NULL COMMENT '部门名称', `post_id` bigint NOT NULL COMMENT '工种ID', `post_name` varchar(255) DEFAULT NULL COMMENT '工种名称', `curriculum_id` bigint NOT NULL COMMENT '课程ID', `curriculum_version_info_id` bigint NOT NULL COMMENT '课程版本ID', `exam_paper_id` bigint DEFAULT NULL COMMENT '试卷ID', `exam_paper_type` int DEFAULT NULL COMMENT '试卷类型', `stage_exam_state` int DEFAULT NULL COMMENT '考试状态(0.不考试 1.待考试 2.考试未通过3.考试通过 4.未参加)', `stage_exam_score` decimal(10,2) DEFAULT NULL COMMENT '考试得分', `tenant_id` bigint DEFAULT NULL COMMENT '租户ID', `creator` bigint DEFAULT NULL COMMENT '创建者', `create_date` datetime(6) DEFAULT NULL COMMENT '创建时间', `updater` bigint DEFAULT NULL COMMENT '更新者', `update_date` datetime(6) DEFAULT NULL COMMENT '更新时间', `is_deleted` int DEFAULT 0 COMMENT '是否删除 0否 1是', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='代理-班级学员课程试卷关联表'; -- ---------------------------- -- Table structure for bus_class_student_exam_times_adjust_record -- ---------------------------- DROP TABLE IF EXISTS `bus_class_student_exam_times_adjust_record`; CREATE TABLE `bus_class_student_exam_times_adjust_record` ( `id` bigint NOT NULL COMMENT '主键ID', `tenant_id` bigint NOT NULL COMMENT '租户ID', `class_id` bigint NOT NULL COMMENT '班级ID', `student_id` bigint NOT NULL COMMENT '学员ID', `class_student_relation_id` bigint DEFAULT NULL COMMENT '班级学员关联ID', `before_number_of_exams` int DEFAULT NULL COMMENT '调整前考试次数', `after_number_of_exams` int NOT NULL COMMENT '调整后考试次数', `adjust_type` smallint NOT NULL COMMENT '调整类型:1 手动批量调整,2 班级配置同步', `source_module` varchar(100) DEFAULT NULL COMMENT '来源模块', `operator_id` bigint DEFAULT NULL COMMENT '操作人ID', `operator_name` varchar(100) DEFAULT NULL COMMENT '操作人姓名', `operator_type` varchar(50) DEFAULT NULL COMMENT '操作人类型:admin、enterprise_user、system', `request_ip` varchar(64) DEFAULT NULL COMMENT '请求IP', `user_agent` varchar(500) DEFAULT NULL COMMENT '请求User-Agent', `remark` varchar(500) DEFAULT NULL COMMENT '备注', `creator` bigint DEFAULT NULL COMMENT '创建人ID', `create_date` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) COMMENT '创建时间', `updater` bigint DEFAULT NULL COMMENT '修改人ID', `update_date` datetime(6) DEFAULT NULL COMMENT '修改时间', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='学员考试次数调整记录'; -- ---------------------------- -- Table structure for bus_class_student_relation -- ---------------------------- DROP TABLE IF EXISTS `bus_class_student_relation`; CREATE TABLE `bus_class_student_relation` ( `id` bigint NOT NULL COMMENT '主键id', `class_id` bigint NOT NULL COMMENT '班级id', `student_id` bigint NOT NULL COMMENT '学员id', `student_info` json DEFAULT NULL COMMENT '学员信息json', `learn_status` int DEFAULT 0 COMMENT '学习状态(0:未学习 1:学习中 2:已学完 3:已完成 4:未完成 5待评估 6评估不合格)', `creator` bigint DEFAULT NULL COMMENT '创建人', `create_date` datetime(6) DEFAULT NULL COMMENT '创建时间', `updater` bigint DEFAULT NULL COMMENT '修改人', `update_date` datetime(6) DEFAULT NULL COMMENT '修改时间', `is_deleted` smallint DEFAULT 0 COMMENT '是否删除0否1是', `tenant_id` bigint DEFAULT NULL COMMENT '租户id', `signature_path` varchar(255) DEFAULT NULL COMMENT '签字图片路径', `study_start_time` datetime(6) DEFAULT NULL COMMENT '学习开始时间', `study_end_time` datetime(6) DEFAULT NULL COMMENT '学习结束时间', `complete_courseware` int DEFAULT NULL COMMENT '已完成课件数', `complete_class_hour` varchar(32) DEFAULT NULL COMMENT '学时', `number_of_exams` int DEFAULT NULL COMMENT '考试次数', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='班级与学员的关联表'; -- ---------------------------- -- Indexes for table bus_class -- ---------------------------- CREATE INDEX `idx_bus_class_activity_id` ON `bus_class` (`activity_id`); CREATE INDEX `idx_bus_class_activity_period` ON `bus_class` (`activity_id`, `activity_period_id`); CREATE INDEX `idx_bus_class_settlement_status` ON `bus_class` (`settlement_status`); CREATE INDEX `idx_bus_class_usage` ON `bus_class` (`class_usage`); CREATE INDEX `idx_service_alert_class_exam_scope` ON `bus_class` (`status`, `end_time`, `id`); CREATE INDEX `idx_service_alert_class_group_scope` ON `bus_class` (`tenant_id`, `train_class_id`, `id`); -- ---------------------------- -- Indexes for table bus_class_config -- ---------------------------- CREATE INDEX `idx_bus_class_config_survey_publish` ON `bus_class_config` (`survey_publish_id`); CREATE INDEX `idx_bus_class_config_survey_template` ON `bus_class_config` (`survey_template_id`); -- ---------------------------- -- Indexes for table bus_class_curriculum_alias -- ---------------------------- CREATE INDEX `idx_class_curriculum_alias_class_id` ON `bus_class_curriculum_alias` (`class_id`); CREATE INDEX `idx_class_curriculum_alias_curriculum_id` ON `bus_class_curriculum_alias` (`curriculum_id`); CREATE INDEX `idx_class_curriculum_alias_tenant_id` ON `bus_class_curriculum_alias` (`tenant_id`); CREATE UNIQUE INDEX `uk_class_curriculum_alias_class_curriculum_active` ON `bus_class_curriculum_alias` (`class_id`, `curriculum_id`, `is_deleted`); -- ---------------------------- -- Indexes for table bus_class_curriculum_chapter_relation -- ---------------------------- CREATE INDEX `idx_bcccr_class_id` ON `bus_class_curriculum_chapter_relation` (`class_id`); CREATE INDEX `uk_bcccr_class_curriculum_version_chapter` ON `bus_class_curriculum_chapter_relation` (`class_id`, `curriculum_id`, `curriculum_version_info_id`, `chapter_id`); -- ---------------------------- -- Indexes for table bus_class_curriculum_post_exam_relation -- ---------------------------- CREATE INDEX `idx_bccper_class_id` ON `bus_class_curriculum_post_exam_relation` (`class_id`); CREATE UNIQUE INDEX `uk_bccper_class_curriculum_version_post` ON `bus_class_curriculum_post_exam_relation` (`class_id`, `curriculum_id`, `curriculum_version_info_id`, `post_id`); -- ---------------------------- -- Indexes for table bus_class_curriculum_relation -- ---------------------------- CREATE INDEX `idx_service_alert_class_curriculum` ON `bus_class_curriculum_relation` (`class_id`, `curriculum_id`); -- ---------------------------- -- Indexes for table bus_class_settlement_record -- ---------------------------- CREATE INDEX `idx_bus_class_settlement_record_class_id` ON `bus_class_settlement_record` (`class_id`); CREATE INDEX `idx_bus_class_settlement_record_tenant_time` ON `bus_class_settlement_record` (`tenant_id`, `settlement_time`); -- ---------------------------- -- Indexes for table bus_class_student_curriculum_exam_relation -- ---------------------------- CREATE INDEX `idx_bcscer_class_id` ON `bus_class_student_curriculum_exam_relation` (`class_id`); CREATE INDEX `idx_bcscer_student_id` ON `bus_class_student_curriculum_exam_relation` (`student_id`); CREATE INDEX `idx_service_alert_exam_relation_state` ON `bus_class_student_curriculum_exam_relation` (`class_id`, `student_id`, `stage_exam_state`); CREATE UNIQUE INDEX `uk_bcscer_class_student_curriculum_version_exam` ON `bus_class_student_curriculum_exam_relation` (`class_id`, `student_id`, `curriculum_id`, `curriculum_version_info_id`, `exam_paper_id`); -- ---------------------------- -- Indexes for table bus_class_student_exam_times_adjust_record -- ---------------------------- CREATE INDEX `idx_exam_times_adjust_class_id` ON `bus_class_student_exam_times_adjust_record` (`class_id`); CREATE INDEX `idx_exam_times_adjust_create_date` ON `bus_class_student_exam_times_adjust_record` (`create_date`); CREATE INDEX `idx_exam_times_adjust_relation_id` ON `bus_class_student_exam_times_adjust_record` (`class_student_relation_id`); CREATE INDEX `idx_exam_times_adjust_student_id` ON `bus_class_student_exam_times_adjust_record` (`student_id`); -- ---------------------------- -- Indexes for table bus_class_student_relation -- ---------------------------- CREATE INDEX `idx_service_alert_class_student` ON `bus_class_student_relation` (`class_id`, `student_id`, `is_deleted`); SET FOREIGN_KEY_CHECKS = 1;