SET NAMES UTF8;

-- ----------------------------
-- Table structure for basic_attachment
-- ----------------------------
DROP TABLE IF EXISTS `basic_attachment`;
CREATE TABLE `basic_attachment` (
                                    `id` bigint NOT NULL COMMENT '主键',
                                    `school_id` bigint DEFAULT NULL COMMENT '学校id',
                                    `org_id` bigint DEFAULT NULL COMMENT '机构id',
                                    `name` varchar(100) NOT NULL COMMENT '文件名',
                                    `type` varchar(10) NOT NULL COMMENT '文件类型',
                                    `size` int NOT NULL COMMENT '单位（KB）',
                                    `md5` varchar(32) NOT NULL COMMENT '文件md5值',
                                    `path` varchar(2000) NOT NULL COMMENT '存储路径',
                                    `create_id` bigint DEFAULT NULL COMMENT '创建人',
                                    `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                                    `update_id` bigint DEFAULT NULL COMMENT '更新人',
                                    `update_time` bigint DEFAULT NULL COMMENT '更新时间',
                                    `obj_id` bigint DEFAULT NULL COMMENT '关联业务id',
                                    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='所有附件记录表';

-- ----------------------------
-- Table structure for basic_campus
-- ----------------------------
DROP TABLE IF EXISTS `basic_campus`;
CREATE TABLE `basic_campus` (
                                `id` bigint NOT NULL COMMENT '校区id',
                                `school_id` bigint NOT NULL COMMENT '学校id',
                                `campus_name` varchar(64) DEFAULT NULL COMMENT '校区名称',
                                `campus_code` varchar(64) DEFAULT NULL COMMENT '校区编码',
                                `print_house_id` bigint DEFAULT NULL COMMENT '印刷室id',
                                `enable` tinyint DEFAULT '1' COMMENT '是否可用',
                                `org_id` bigint DEFAULT NULL COMMENT '机构id',
                                `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`) USING BTREE,
                                UNIQUE KEY `campus_schoolId_code_idx` (`school_id`,`campus_code`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='基础校区表';

-- ----------------------------
-- Table structure for basic_card_rule
-- ----------------------------
DROP TABLE IF EXISTS `basic_card_rule`;
CREATE TABLE `basic_card_rule` (
                                   `id` bigint NOT NULL COMMENT '主键',
                                   `school_id` bigint NOT NULL COMMENT '学校id',
                                   `org_id` bigint DEFAULT NULL COMMENT '机构id',
                                   `name` varchar(30) NOT NULL COMMENT '题卡规则名称',
                                   `exam_number_style` varchar(5) NOT NULL COMMENT 'PRINT-印刷条码，PASTE-粘贴条码，FILL-卡号填涂',
                                   `paper_type` varchar(5) NOT NULL COMMENT 'PRINT-印刷条码，FILL-卡号填涂',
                                   `exam_absent` tinyint NOT NULL COMMENT '0-禁用，1-启用',
                                   `write_sign` tinyint NOT NULL COMMENT '0-禁用，1-启用',
                                   `discipline` tinyint(1) DEFAULT NULL COMMENT '违纪填涂（1：是，0：否）',
                                   `required_fields` text NOT NULL COMMENT '必选字段',
                                   `extend_fields` text NOT NULL COMMENT '扩展字段',
                                   `title_rule` varchar(200) NOT NULL COMMENT '题卡标题规则',
                                   `attention` text NOT NULL COMMENT '注意事项',
                                   `objective_attention` text NOT NULL COMMENT '客观题注意事项',
                                   `subjective_attention` text NOT NULL COMMENT '主观题注意事项',
                                   `enable` tinyint NOT NULL COMMENT '0-禁用，1-启用',
                                   `remark` varchar(200) DEFAULT NULL COMMENT '备注',
                                   `create_id` bigint DEFAULT NULL COMMENT '创建人id',
                                   `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                                   `update_id` bigint DEFAULT NULL COMMENT '更新人',
                                   `update_time` bigint DEFAULT NULL COMMENT '更新时间',
                                   `fill_number` tinyint DEFAULT NULL COMMENT '卡号填涂位数',
                                   PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='题卡规则';

-- ----------------------------
-- Table structure for basic_clazz
-- ----------------------------
DROP TABLE IF EXISTS `basic_clazz`;
CREATE TABLE `basic_clazz` (
                               `id` bigint NOT NULL,
                               `school_id` bigint NOT NULL COMMENT '学校id',
                               `major_id` bigint NOT NULL COMMENT '专业id',
                               `clazz_code` varchar(50) DEFAULT NULL COMMENT '班级编号',
                               `short_code` varchar(10) DEFAULT NULL COMMENT '简码',
                               `clazz_name` varchar(50) DEFAULT NULL COMMENT '班级名称',
                               `enable` tinyint(1) DEFAULT NULL COMMENT '是否可用',
                               `org_id` bigint DEFAULT NULL COMMENT '权限机构id',
                               `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`) USING BTREE,
                               UNIQUE KEY `clazz_schoolId_name_idx` (`school_id`,`clazz_name`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='基础班级表';

-- ----------------------------
-- Table structure for basic_college
-- ----------------------------
DROP TABLE IF EXISTS `basic_college`;
CREATE TABLE `basic_college` (
                                 `id` bigint NOT NULL,
                                 `school_id` bigint NOT NULL,
                                 `college_name` varchar(50) NOT NULL COMMENT '学院名称',
                                 `org_id` bigint NOT NULL COMMENT '数据权限机构id',
                                 `create_id` bigint DEFAULT NULL COMMENT '创建人',
                                 `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                                 `update_id` bigint DEFAULT NULL COMMENT '更新人',
                                 `update_time` bigint DEFAULT NULL COMMENT '更新时间',
                                 PRIMARY KEY (`id`),
                                 UNIQUE KEY `college_schoolId_name_idx` (`school_id`,`college_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='学生学院表';

-- ----------------------------
-- Table structure for basic_course
-- ----------------------------
DROP TABLE IF EXISTS `basic_course`;
CREATE TABLE `basic_course` (
                                `id` bigint NOT NULL COMMENT '主键',
                                `school_id` bigint NOT NULL COMMENT '学校id',
                                `org_id` bigint NOT NULL COMMENT '机构id',
                                `code` varchar(20) NOT NULL COMMENT '课程编码',
                                `short_code` varchar(10) DEFAULT NULL COMMENT '简码',
                                `name` varchar(50) NOT NULL COMMENT '课程名称',
                                `create_id` bigint DEFAULT NULL COMMENT '创建人',
                                `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                                `update_id` bigint DEFAULT NULL COMMENT '修改人',
                                `update_time` bigint DEFAULT NULL COMMENT '修改时间',
                                `teaching_room_id` bigint DEFAULT NULL COMMENT '教研室id',
                                `enable` tinyint DEFAULT NULL,
                                `historic_name` varchar(100) DEFAULT NULL COMMENT '历史课程名称',
                                PRIMARY KEY (`id`) USING BTREE,
                                UNIQUE KEY `course_schoolId_code_idx` (`school_id`,`code`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='课程表';

-- ----------------------------
-- Table structure for basic_exam
-- ----------------------------
DROP TABLE IF EXISTS `basic_exam`;
CREATE TABLE `basic_exam` (
                              `id` bigint NOT NULL,
                              `school_id` bigint NOT NULL,
                              `semester_id` bigint DEFAULT NULL COMMENT '学期ID',
                              `short_code` varchar(10) DEFAULT NULL COMMENT '简码',
                              `name` varchar(100) DEFAULT NULL COMMENT '考试名称',
                              `category` varchar(45) DEFAULT NULL COMMENT '考试类型（ONLINE：线上，OFFLINE：线下）',
                              `exam_model` varchar(45) DEFAULT NULL COMMENT '业务模式（MODEL1：电子交卷环节需要提交考务数据，MODEL2：电子交卷环节不需要提交考务数据，只输入印刷份数即可，MODEL3：电子交卷环节不需要提交考务数据）',
                              `enable` tinyint(1) NOT NULL DEFAULT '1' COMMENT '1启用/0禁用',
                              `in_used` tinyint(1) NOT NULL DEFAULT '1' COMMENT '1是/0否',
                              `create_id` bigint DEFAULT NULL,
                              `create_time` bigint DEFAULT NULL,
                              `update_id` bigint DEFAULT NULL,
                              `update_time` bigint DEFAULT NULL,
                              PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='考试表';

-- ----------------------------
-- Table structure for basic_exam_rule
-- ----------------------------
DROP TABLE IF EXISTS `basic_exam_rule`;
CREATE TABLE `basic_exam_rule` (
                                   `id` bigint NOT NULL COMMENT '主键',
                                   `school_id` bigint NOT NULL COMMENT '学校id',
                                   `org_id` bigint DEFAULT NULL COMMENT '机构id',
                                   `required_fields` text COMMENT '必选字段',
                                   `extend_fields` text NOT NULL COMMENT '扩展字段',
                                   `review` tinyint NOT NULL COMMENT '0-禁用，1-启用',
                                   `include_paper` tinyint NOT NULL COMMENT '0-禁用，1-启用',
                                   `print_method` varchar(6) NOT NULL COMMENT 'AUTO-自动，MANUAL-手动',
                                   `exam_number_digit` int DEFAULT NULL COMMENT '考号位数',
                                   `create_id` bigint DEFAULT NULL COMMENT '创建人',
                                   `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                                   `update_id` bigint DEFAULT NULL COMMENT '更新人',
                                   `update_time` bigint DEFAULT NULL COMMENT '更新时间',
                                   PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='考务规则';

-- ----------------------------
-- Table structure for basic_major
-- ----------------------------
DROP TABLE IF EXISTS `basic_major`;
CREATE TABLE `basic_major` (
                               `id` bigint NOT NULL COMMENT '主键',
                               `school_id` bigint NOT NULL COMMENT '学校id',
                               `org_id` bigint NOT NULL COMMENT '机构id',
                               `name` varchar(100) NOT NULL COMMENT '专业名称',
                               `code` varchar(100) DEFAULT NULL COMMENT '专业编码',
                               `enable` tinyint 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 '更新时间',
                               `belong_org_id` bigint NOT NULL COMMENT '所属机构id',
                               PRIMARY KEY (`id`) USING BTREE,
                               UNIQUE KEY `major_schoolId_name_idx` (`school_id`,`name`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='专业字典表';

-- ----------------------------
-- Table structure for basic_message
-- ----------------------------
DROP TABLE IF EXISTS `basic_message`;
CREATE TABLE `basic_message` (
                                 `id` bigint NOT NULL COMMENT '主键',
                                 `school_id` bigint DEFAULT NULL COMMENT '学校id',
                                 `org_id` bigint DEFAULT NULL COMMENT '机构id',
                                 `user_id` bigint NOT NULL COMMENT '消息接收人用户',
                                 `user_name` varchar(100) DEFAULT NULL COMMENT '用户名称',
                                 `mobile_number` varchar(11) DEFAULT NULL COMMENT '电话号码',
                                 `paper_number` varchar(50) DEFAULT NULL COMMENT '试卷编号',
                                 `course_code` varchar(50) DEFAULT NULL COMMENT '课程代码',
                                 `message_type` varchar(45) DEFAULT NULL COMMENT '消息类型',
                                 `business_operate` varchar(45) NOT NULL COMMENT '业务操作',
                                 `business_id` bigint DEFAULT NULL COMMENT '业务id',
                                 `template_code` varchar(45) NOT NULL COMMENT '消息模板代码',
                                 `variable_params` text COMMENT '变量参数内容',
                                 `template_content` mediumtext COMMENT '模板内容',
                                 `send_status` varchar(45) DEFAULT NULL COMMENT '消息发送状态',
                                 `send_result` varchar(200) DEFAULT NULL COMMENT '消息发送结果',
                                 `remark` text COMMENT '备注',
                                 `create_id` bigint DEFAULT NULL COMMENT '创建人',
                                 `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                                 `update_id` bigint DEFAULT NULL COMMENT '更新人',
                                 `update_time` bigint DEFAULT NULL COMMENT '更新时间',
                                 `resend_count` int DEFAULT NULL COMMENT '重试次数',
                                 PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Table structure for basic_operation_log
-- ----------------------------
DROP TABLE IF EXISTS `basic_operation_log`;
CREATE TABLE `basic_operation_log` (
                                       `id` bigint NOT NULL COMMENT 'id',
                                       `detail` mediumtext NOT NULL COMMENT '日志详情',
                                       `level` varchar(32) DEFAULT NULL COMMENT '日志等级（PRIMARY("一级日志：敏感信息"),SECONDARY("二级日志：重要信息"),TERTIARY("三级日志：次要信息"),QUATERNARY("四级日志：普通信息")）',
                                       `operation_type` varchar(32) DEFAULT NULL COMMENT '操作类型（UN_KNOW("未知"),SELECT("查询"),EDIT("新增或更新"),DELETE("删除")）',
                                       `operation_unit` varchar(128) DEFAULT NULL COMMENT '操作对象（略）',
                                       `system_type` varchar(32) DEFAULT NULL COMMENT '日志系统类型',
                                       `url` varchar(64) DEFAULT NULL COMMENT '请求地址url',
                                       `clazz_name` varchar(64) DEFAULT NULL COMMENT '类名称',
                                       `method` varchar(64) DEFAULT NULL COMMENT '方法名称',
                                       `args` mediumtext COMMENT '参数',
                                       `run_time` bigint DEFAULT NULL COMMENT '方法运行时间',
                                       `run_status` varchar(32) DEFAULT NULL COMMENT '方法运行状态',
                                       `return_value` mediumtext COMMENT '方法返回值',
                                       `user_id` bigint NOT NULL COMMENT '用户对象id',
                                       `user_name` varchar(32) DEFAULT NULL COMMENT '用户名称',
                                       `create_time` bigint DEFAULT NULL COMMENT '日志记录时间',
                                       PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='基础日志记录表';

-- ----------------------------
-- Table structure for basic_print_config
-- ----------------------------
DROP TABLE IF EXISTS `basic_print_config`;
CREATE TABLE `basic_print_config` (
                                      `id` bigint NOT NULL,
                                      `school_id` bigint NOT NULL COMMENT '学校ID',
                                      `exam_id` bigint DEFAULT NULL COMMENT '考试ID',
                                      `enable` tinyint(1) NOT NULL DEFAULT '1' COMMENT '1启用/0禁用',
                                      `card_rule_id` bigint DEFAULT NULL COMMENT '题卡规则（-1代表通卡）',
                                      `print_content` varchar(255) DEFAULT NULL COMMENT '试卷、题卡',
                                      `backup_method` varchar(10) DEFAULT NULL COMMENT '试卷题卡备份方式（ROOM按考场）',
                                      `backup_count` int DEFAULT NULL COMMENT '试卷题卡备份数量',
                                      `draw_rule` varchar(10) DEFAULT NULL COMMENT '抽卷规则（ONE只抽一次，CIRCLE循环抽取）',
                                      `variable_content` mediumtext COMMENT '变量印品参数json',
                                      `ordinary_content` mediumtext COMMENT '普通印品参数json',
                                      `create_id` bigint DEFAULT NULL,
                                      `create_time` bigint DEFAULT NULL,
                                      `update_id` bigint DEFAULT NULL,
                                      `update_time` bigint DEFAULT NULL,
                                      PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='印品配置表';

-- ----------------------------
-- Table structure for basic_school
-- ----------------------------
DROP TABLE IF EXISTS `basic_school`;
CREATE TABLE `basic_school` (
                                `id` bigint NOT NULL COMMENT '主键',
                                `code` varchar(20) NOT NULL COMMENT '学校编码',
                                `name` varchar(100) DEFAULT NULL COMMENT '学校名称',
                                `enable` tinyint NOT NULL DEFAULT '1' COMMENT '是否启用，false：停用，true：启用',
                                `access_key` varchar(50) DEFAULT NULL COMMENT '访问key',
                                `access_secret` varchar(50) DEFAULT NULL COMMENT '访问秘钥',
                                `remark` text COMMENT '备注',
                                `create_id` bigint DEFAULT NULL COMMENT '创建人',
                                `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                                `update_id` bigint DEFAULT NULL COMMENT '更新人',
                                `update_time` bigint DEFAULT NULL COMMENT '更新时间',
                                `logo` varchar(500) DEFAULT NULL COMMENT '学校logo',
                                PRIMARY KEY (`id`) USING BTREE,
                                UNIQUE KEY `code` (`code`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='学校表';

-- ----------------------------
-- Table structure for basic_semester
-- ----------------------------
DROP TABLE IF EXISTS `basic_semester`;
CREATE TABLE `basic_semester` (
                                  `id` bigint NOT NULL COMMENT '主键',
                                  `school_id` bigint NOT NULL COMMENT '学校id',
                                  `name` varchar(100) NOT NULL COMMENT '学期名称',
                                  `code` varchar(100) DEFAULT NULL COMMENT '学期编码',
                                  `start_time` bigint DEFAULT NULL COMMENT '开始日期',
                                  `end_time` bigint DEFAULT NULL COMMENT '结束日期',
                                  `org_id` bigint DEFAULT NULL COMMENT '机构id',
                                  `enable` tinyint 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 '更新时间',
                                  `in_used` tinyint(1) DEFAULT NULL COMMENT '是否当前使用学期',
                                  PRIMARY KEY (`id`) USING BTREE,
                                  UNIQUE KEY `semester_schoolId_name_idx` (`school_id`,`name`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='学期字典表';

-- ----------------------------
-- Table structure for basic_student
-- ----------------------------
DROP TABLE IF EXISTS `basic_student`;
CREATE TABLE `basic_student` (
                                 `id` bigint NOT NULL COMMENT '学生id',
                                 `school_id` bigint NOT NULL COMMENT '学校id',
                                 `student_name` varchar(64) NOT NULL COMMENT '学生姓名',
                                 `student_code` varchar(64) NOT NULL COMMENT '学生编号',
                                 `phone_number` varchar(11) DEFAULT NULL COMMENT '电话号码',
                                 `belong_org_id` bigint DEFAULT NULL COMMENT '所属院系',
                                 `major_id` bigint DEFAULT NULL COMMENT '专业id',
                                 `clazz_id` bigint DEFAULT NULL COMMENT '班级主键',
                                 `enable` tinyint DEFAULT '1' COMMENT '可用状态（1：可用，0：不可用）',
                                 `org_id` bigint DEFAULT NULL COMMENT '可操作人机构id',
                                 `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`) USING BTREE,
                                 UNIQUE KEY `student_schoolId_code_orgId_idx` (`school_id`,`student_code`,`belong_org_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='学校id';

-- ----------------------------
-- Table structure for basic_template
-- ----------------------------
DROP TABLE IF EXISTS `basic_template`;
CREATE TABLE `basic_template` (
                                  `id` bigint NOT NULL COMMENT '主键',
                                  `school_id` bigint NOT NULL COMMENT '学校id',
                                  `org_id` bigint DEFAULT NULL COMMENT '机构id',
                                  `name` varchar(30) NOT NULL COMMENT '模板名称',
                                  `classify` varchar(10) DEFAULT NULL COMMENT 'template_type值为VARIABLE、ORDINARY时，不为空。\n  SIGN-签到表，PACKAGE-卷袋贴，CHECK_IN-登记表',
                                  `display_range` mediumtext COMMENT '卷袋贴、签到表数据范围',
                                  `preview_path` varchar(500) DEFAULT NULL COMMENT '预览地址',
                                  `attachment_id` bigint DEFAULT NULL COMMENT '模板附件ID（保存到附件表ID）',
                                  `enable` tinyint NOT NULL COMMENT '0-禁用，1-启用',
                                  `remark` varchar(200) DEFAULT NULL COMMENT '备注',
                                  `create_id` bigint DEFAULT NULL COMMENT '创建人',
                                  `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                                  `update_id` bigint DEFAULT NULL COMMENT '更新人',
                                  `update_time` bigint DEFAULT NULL COMMENT '更新时间',
                                  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='通用模板';

-- ----------------------------
-- Table structure for basic_template_org
-- ----------------------------
DROP TABLE IF EXISTS `basic_template_org`;
CREATE TABLE `basic_template_org` (
                                      `id` bigint NOT NULL COMMENT '主键',
                                      `school_id` bigint NOT NULL COMMENT '学校id',
                                      `type` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '模板类型：GENERIC-通卡模板，VARIABLE-变量印品模板，ORDINARY-普通印品模板，CARD_RULE-题卡规则，PRINT_CONFIG-印品配置',
                                      `rule_id` bigint NOT NULL COMMENT '通卡模板ID',
                                      `org_id` bigint NOT NULL COMMENT '组织机构ID',
                                      `create_id` bigint DEFAULT NULL COMMENT '创建人',
                                      `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                                      `update_id` bigint DEFAULT NULL COMMENT '更新人',
                                      `update_time` bigint DEFAULT NULL COMMENT '更新时间',
                                      PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='适用学院（题卡规则、模板适用学院）';

-- ----------------------------
-- Table structure for basic_user_course
-- ----------------------------
DROP TABLE IF EXISTS `basic_user_course`;
CREATE TABLE `basic_user_course` (
                                     `id` bigint NOT NULL COMMENT '主键',
                                     `school_id` bigint DEFAULT NULL COMMENT '学校id',
                                     `org_id` bigint DEFAULT NULL COMMENT '机构id',
                                     `user_id` bigint DEFAULT NULL COMMENT '用户ID',
                                     `course_id` bigint DEFAULT NULL COMMENT '课程ID',
                                     `clazz_id` bigint DEFAULT NULL COMMENT '授课班级',
                                     `enable` tinyint(1) DEFAULT NULL COMMENT '是否启用？1-是 ；0-否',
                                     `create_id` bigint DEFAULT NULL COMMENT '创建人',
                                     `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                                     `update_id` bigint DEFAULT NULL COMMENT '更新人',
                                     `update_time` bigint DEFAULT NULL COMMENT '更新时间',
                                     PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户和课程关联表';

-- ----------------------------
-- Table structure for basic_verify_code
-- ----------------------------
DROP TABLE IF EXISTS `basic_verify_code`;
CREATE TABLE `basic_verify_code` (
                                     `id` bigint NOT NULL COMMENT '主键',
                                     `school_id` bigint DEFAULT NULL COMMENT '学校id',
                                     `org_id` bigint DEFAULT NULL COMMENT '机构id',
                                     `user_id` bigint NOT NULL COMMENT '用户ID',
                                     `mobile_number` varchar(11) NOT NULL COMMENT '手机号',
                                     `expire_time` bigint NOT NULL COMMENT '到期时间',
                                     `valid_period` int NOT NULL COMMENT '单位（分）',
                                     `verify_code` varchar(4) NOT NULL COMMENT '4位数字',
                                     `create_id` bigint DEFAULT NULL COMMENT '创建人',
                                     `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                                     `update_id` bigint DEFAULT NULL COMMENT '更新人',
                                     `update_time` bigint DEFAULT NULL COMMENT '更新时间',
                                     PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='短信验证码记录表';

-- ----------------------------
-- Table structure for client_print_data
-- ----------------------------
DROP TABLE IF EXISTS `client_print_data`;
CREATE TABLE `client_print_data` (
                                     `id` bigint NOT NULL COMMENT '主键',
                                     `school_id` bigint DEFAULT NULL COMMENT '学校id',
                                     `org_id` bigint DEFAULT NULL COMMENT '机构id',
                                     `exam_detail_id` bigint DEFAULT NULL COMMENT '考场ID',
                                     `machine_code` varchar(45) DEFAULT NULL COMMENT '机器唯一码',
                                     `pages_a4` int DEFAULT NULL COMMENT 'A4页数量',
                                     `pages_a3` int DEFAULT NULL COMMENT 'A3页数量',
                                     `create_id` bigint DEFAULT NULL COMMENT '创建人',
                                     `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                                     `update_id` bigint DEFAULT NULL COMMENT '更新人',
                                     `update_time` bigint DEFAULT NULL COMMENT '更新时间',
                                     PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='各机器打印数量';

-- ----------------------------
-- Table structure for client_status
-- ----------------------------
DROP TABLE IF EXISTS `client_status`;
CREATE TABLE `client_status` (
                                 `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
                                 `school_id` bigint DEFAULT NULL COMMENT '学校id',
                                 `org_id` bigint DEFAULT NULL COMMENT '机构id',
                                 `machine_code` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '机器唯一码',
                                 `exam_detail_id` bigint DEFAULT NULL COMMENT '考场ID',
                                 `print_plan_id` bigint DEFAULT NULL COMMENT '印刷计划ID',
                                 `course_code` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '课程代码',
                                 `course_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '课程名称',
                                 `paper_number` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '试卷编号',
                                 `is_try` tinyint DEFAULT NULL COMMENT '是否打样：true-是，false-否',
                                 `try_time` bigint DEFAULT NULL COMMENT '打样时间',
                                 `is_pass` tinyint DEFAULT NULL COMMENT '是否合格：true-合格，false-不合格',
                                 `is_download` tinyint DEFAULT NULL COMMENT '是否缓存：true-是，false-否',
                                 `create_id` bigint DEFAULT NULL COMMENT '创建人',
                                 `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                                 `update_id` bigint DEFAULT NULL COMMENT '更新人',
                                 `update_time` bigint DEFAULT NULL COMMENT '更新时间',
                                 PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=281784714686103553 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='机器打样记录';

-- ----------------------------
-- Table structure for cloud_user_push_status
-- ----------------------------
DROP TABLE IF EXISTS `cloud_user_push_status`;
CREATE TABLE `cloud_user_push_status` (
                                          `id` bigint NOT NULL,
                                          `school_id` bigint NOT NULL COMMENT '学校id',
                                          `user_id` bigint NOT NULL,
                                          `marker_status` varchar(100) NOT NULL COMMENT '评卷员推送状态(UserPushResultEnum):BIND_SUCCESS("绑定成功"),BIND_FAILED("绑定失败"),UNBIND_SUCCESS("解绑成功"),UNBIND_FAILED("解绑失败");',
                                          `marker_leader_status` varchar(100) NOT NULL COMMENT '科组长推送状态(UserPushResultEnum):BIND_SUCCESS("绑定成功"),BIND_FAILED("绑定失败"),UNBIND_SUCCESS("解绑成功"),UNBIND_FAILED("解绑失败");',
                                          `sync_status` varchar(100) NOT NULL COMMENT '同步状态(SyncStatusEnum)，ALREADY_PUSH("已经完成推送"),NEED_PUSH_AGAIN("需要重新推送");',
                                          `create_id` bigint DEFAULT NULL COMMENT '创建人\n',
                                          `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                                          `update_id` bigint DEFAULT NULL COMMENT '更新人',
                                          `update_time` bigint DEFAULT NULL COMMENT '更新时间',
                                          PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='云阅卷用户推送状态表';

-- ----------------------------
-- Table structure for exam_card
-- ----------------------------
DROP TABLE IF EXISTS `exam_card`;
CREATE TABLE `exam_card` (
                             `id` bigint NOT NULL COMMENT '主键',
                             `school_id` bigint NOT NULL COMMENT '学校id',
                             `org_id` bigint DEFAULT NULL COMMENT '机构id',
                             `course_code` varchar(30) DEFAULT NULL COMMENT '课程编码',
                             `course_name` varchar(100) DEFAULT NULL COMMENT '课程名称',
                             `title` varchar(200) NOT NULL COMMENT '标题',
                             `make_method` varchar(10) DEFAULT NULL COMMENT '题卡制作方式：SELECT-选择已有题卡，SELF-自助创建，CUST-客户制卡',
                             `status` varchar(45) DEFAULT NULL COMMENT 'STAGE-暂存，SUBMIT-提交',
                             `create_id` bigint DEFAULT NULL COMMENT '创建人',
                             `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                             `update_id` bigint DEFAULT NULL COMMENT '更新人',
                             `update_time` bigint DEFAULT NULL COMMENT '更新时间',
                             `type` varchar(45) NOT NULL COMMENT '题卡类型：GENERIC-通卡，CUSTOM-自定义',
                             `create_method` varchar(45) DEFAULT NULL COMMENT '通卡创建方式（UPLOAD-上传，CUSTOMIZE-自定义）',
                             `attachment_id` bigint DEFAULT NULL COMMENT 'type=GENERIC时必传，上传附件ID',
                             `sync_status` tinyint(1) DEFAULT NULL COMMENT '是否同步成功：true-是， false-否',
                             `enable` tinyint(1) DEFAULT '1' COMMENT '1正常，0禁用',
                             `remark` mediumtext COMMENT '备注',
                             `card_rule_id` bigint DEFAULT NULL COMMENT '题卡规则Id',
                             PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='题卡';

-- ----------------------------
-- Table structure for exam_card_detail
-- ----------------------------
DROP TABLE IF EXISTS `exam_card_detail`;
CREATE TABLE `exam_card_detail` (
                                    `id` bigint NOT NULL COMMENT '主键',
                                    `card_id` bigint NOT NULL COMMENT '题卡ID',
                                    `content` mediumtext COMMENT '题卡工具制作题卡内容',
                                    `html_content` mediumtext COMMENT 'html格式内容',
                                    `attachment_id` mediumtext COMMENT '备用题卡json',
                                    `cust_attachment_id` bigint DEFAULT NULL COMMENT '客服制卡上传附件ID',
                                    `jpg_attachment_info` text COMMENT '题卡转换成的jpg文件信息',
                                    `create_id` bigint DEFAULT NULL COMMENT '创建人',
                                    `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                                    `update_id` bigint DEFAULT NULL COMMENT '更新人',
                                    `update_time` bigint DEFAULT NULL COMMENT '更新时间',
                                    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='题卡详情';

-- ----------------------------
-- Table structure for exam_detail
-- ----------------------------
DROP TABLE IF EXISTS `exam_detail`;
CREATE TABLE `exam_detail` (
                               `id` bigint NOT NULL COMMENT '主键',
                               `school_id` bigint NOT NULL COMMENT '学校id',
                               `org_id` bigint NOT NULL COMMENT '机构id',
                               `print_plan_id` bigint NOT NULL COMMENT '印刷计划ID',
                               `print_plan_name` varchar(100) DEFAULT NULL COMMENT '印刷计划名称',
                               `exam_start_time` bigint NOT NULL COMMENT '考试开始日期',
                               `exam_end_time` bigint NOT NULL COMMENT '考试结束日期',
                               `exam_place` varchar(30) NOT NULL COMMENT '考场',
                               `total_subjects` int DEFAULT NULL COMMENT '总科次：考场总科次',
                               `exam_room` varchar(30) DEFAULT NULL COMMENT '教室',
                               `print_progress` double DEFAULT NULL COMMENT '打印进度',
                               `print_user` varchar(30) DEFAULT NULL COMMENT '打印员：一个考场只能被一个打印员认领',
                               `package_code` varchar(30) DEFAULT NULL COMMENT '考场代码：卷袋贴、签到表上条码',
                               `pages_a3` int DEFAULT NULL COMMENT 'A3印量小计（页）',
                               `pages_a4` int DEFAULT NULL COMMENT 'A4印量小计（页）',
                               `status` varchar(30) DEFAULT NULL COMMENT '状态：NEW: "新建",READY: "就绪",WAITING: "待印刷",PRINTING: "印刷中",FINISH: "已完成"',
                               `validate` tinyint(1) DEFAULT '0' COMMENT '是否校验：true-是，false-否',
                               `print_start_time` bigint DEFAULT NULL COMMENT '打印开始时间',
                               `print_end_time` bigint DEFAULT NULL COMMENT '打印完成时间',
                               `attachment_id` bigint DEFAULT NULL COMMENT '附件id',
                               `card_attachment_id` bigint DEFAULT NULL COMMENT '题卡合并A3文件附件ID',
                               `create_id` bigint DEFAULT NULL COMMENT '创建人',
                               `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                               `update_id` bigint DEFAULT NULL COMMENT '更新人',
                               `update_time` bigint DEFAULT NULL COMMENT '更新时间',
                               `attachment_path` mediumtext COMMENT '印品附件路径',
                               `exam_data_source` varchar(20) DEFAULT NULL COMMENT '数据来源（EXAM_TASK：卷库查询生成，FILE_IMPORT：考务文件导入）',
                               `normal` tinyint DEFAULT '1' COMMENT '是否正常，true正常，false做废',
                               `print_house_id` bigint DEFAULT NULL COMMENT '印刷室ID',
                               `print_count` int DEFAULT NULL COMMENT '模式2，考生数量（打印数量）',
                               PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='考务数据';

-- ----------------------------
-- Table structure for exam_detail_course
-- ----------------------------
DROP TABLE IF EXISTS `exam_detail_course`;
CREATE TABLE `exam_detail_course` (
                                      `id` bigint NOT NULL COMMENT '主键',
                                      `school_id` bigint NOT NULL COMMENT '学校id',
                                      `org_id` bigint NOT NULL COMMENT '机构id',
                                      `exam_detail_id` bigint NOT NULL COMMENT '考试明细id',
                                      `course_code` varchar(20) NOT NULL COMMENT '课程编码',
                                      `course_name` varchar(50) NOT NULL COMMENT '课程名称',
                                      `paper_number` varchar(30) NOT NULL COMMENT '页数',
                                      `total_subjects` int DEFAULT NULL COMMENT '总科次：考场总科次',
                                      `paper_pages_a3` int DEFAULT NULL COMMENT '试卷单科次准印量A3（页）',
                                      `card_pages_a3` int DEFAULT NULL COMMENT '题卡单科次准印量A3（页）',
                                      `clazz_id` text,
                                      `create_id` bigint DEFAULT NULL COMMENT '创建人',
                                      `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                                      `update_id` bigint DEFAULT NULL COMMENT '更新人',
                                      `update_time` bigint DEFAULT NULL COMMENT '更新时间',
                                      `paper_type` varchar(30) DEFAULT NULL COMMENT '当前试卷类型',
                                      `attachment_id` mediumtext COMMENT '备用题卡json',
                                      `common_attachment_id` mediumtext COMMENT '模式2下考生公共题卡json',
                                      PRIMARY KEY (`id`) USING BTREE,
                                      KEY `detail_course_schoolId_idx` (`school_id`,`paper_number`,`paper_type`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='考务数据（考场关联科目）';

-- ----------------------------
-- Table structure for exam_paper_group
-- ----------------------------
DROP TABLE IF EXISTS `exam_paper_group`;
CREATE TABLE `exam_paper_group` (
                                    `id` bigint NOT NULL COMMENT '分组id',
                                    `exam_paper_structure_id` bigint NOT NULL COMMENT '试卷结构id',
                                    `group_number` int NOT NULL COMMENT '分组序号',
                                    `double_rate` tinyint DEFAULT NULL COMMENT '双评比例（0关闭，1开启）',
                                    `arbitrate_threshold` int DEFAULT NULL COMMENT '仲裁阈值（开启双评必填）',
                                    `score_policy` varchar(45) DEFAULT NULL COMMENT '合分策略 开启双评是必填 AVG("平均分", 1), MAX("最高分", 2), MIN("最低分", 3)',
                                    `trial_count` int DEFAULT NULL COMMENT '试评数量',
                                    `mark_mode` varchar(45) DEFAULT NULL COMMENT '评卷模式 COMMON("普通"), TRACK("轨迹")',
                                    `question_info` text COMMENT '题目信息',
                                    `picture_config` text COMMENT '图片配置',
                                    `create_id` bigint DEFAULT NULL COMMENT '创建人',
                                    `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                                    `update_id` bigint DEFAULT NULL COMMENT '更新人',
                                    `update_time` bigint DEFAULT NULL COMMENT '更新时间',
                                    PRIMARY KEY (`id`),
                                    UNIQUE KEY `exam_paper_group_unique` (`exam_paper_structure_id`,`group_number`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='试卷分组表';

-- ----------------------------
-- Table structure for exam_paper_group_marker
-- ----------------------------
DROP TABLE IF EXISTS `exam_paper_group_marker`;
CREATE TABLE `exam_paper_group_marker` (
                                           `id` bigint NOT NULL COMMENT '评卷员-分组关系id',
                                           `group_id` bigint NOT NULL COMMENT '分组id',
                                           `marker_id` bigint NOT NULL COMMENT '评卷员id',
                                           `login_name` varchar(100) DEFAULT NULL COMMENT '评卷员登录名',
                                           `create_id` bigint DEFAULT NULL COMMENT '创建人',
                                           `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                                           `update_id` bigint DEFAULT NULL COMMENT '更新人',
                                           `update_time` bigint DEFAULT NULL COMMENT '更新时间',
                                           PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='评卷员-分组关系表';

-- ----------------------------
-- Table structure for exam_paper_structure
-- ----------------------------
DROP TABLE IF EXISTS `exam_paper_structure`;
CREATE TABLE `exam_paper_structure` (
                                        `id` bigint NOT NULL COMMENT '主键',
                                        `school_id` bigint DEFAULT NULL COMMENT '学校ID',
                                        `semester_id` bigint DEFAULT NULL COMMENT '学期ID',
                                        `semester_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '学期',
                                        `exam_id` bigint NOT NULL COMMENT '考试id',
                                        `third_relate_id` bigint DEFAULT NULL COMMENT '云阅卷考试ID',
                                        `third_relate_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '云阅卷考试名称',
                                        `paper_number` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '试卷编号',
                                        `course_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '课程代码',
                                        `course_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '课程名称',
                                        `sequence` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '课程创建的任务序号（和exam_task保持一致）',
                                        `paper_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '试卷类型',
                                        `status` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '状态。INIT：未开始；START：开始同步；PAPER_FINISH：试卷同步成功；ANSWER_FINISH：标答同步成功；OBJECTIVE_FINISH：客观题结构同步成功；SUBJECTIVE_FINISH：主观题结构同步成功；FINISH：结束。',
                                        `paper_answer` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT '试卷原卷和标答附件ID',
                                        `objective_structure` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT '客观题试卷结构JSON',
                                        `subjective_structure` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT '主观题试卷结构JSON',
                                        `paper_info_json` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT '整个试卷信息json（前端提供的全部信息）',
                                        `proposition_teacher_id` bigint DEFAULT NULL COMMENT '命题老师ID',
                                        `enable` tinyint(1) DEFAULT NULL COMMENT '是否启用（0-禁用，1-启用）',
                                        `mark_leader` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT '科组长，样例：[{markerId:1, loginName:"mt01"}]',
                                        `cloud_info_json` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT '云阅卷试卷结构',
                                        `structure_change` tinyint(1) DEFAULT NULL COMMENT '云阅卷试卷结构和知学知考结构不一样（默认false）',
                                        `create_id` bigint DEFAULT NULL,
                                        `create_time` bigint DEFAULT NULL,
                                        `update_id` bigint DEFAULT NULL,
                                        `update_time` bigint DEFAULT NULL,
                                        PRIMARY KEY (`id`) USING BTREE,
                                        UNIQUE KEY `exam_paper_structure_unique` (`school_id`,`exam_id`,`paper_number`,`paper_type`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- ----------------------------
-- Table structure for exam_print_plan
-- ----------------------------
DROP TABLE IF EXISTS `exam_print_plan`;
CREATE TABLE `exam_print_plan` (
                                   `id` bigint NOT NULL COMMENT '主键',
                                   `exam_id` bigint NOT NULL COMMENT '考试id',
                                   `school_id` bigint NOT NULL COMMENT '学校id',
                                   `org_id` bigint NOT NULL COMMENT '机构id',
                                   `name` varchar(150) DEFAULT NULL COMMENT '名称',
                                   `exam_start_time` bigint NOT NULL COMMENT '考试开始时间',
                                   `exam_end_time` bigint NOT NULL COMMENT '考试结束时间',
                                   `print_content` varchar(30) NOT NULL COMMENT '{“PAPER”, "CARD"}',
                                   `backup_method` varchar(10) NOT NULL COMMENT 'PLACE-按考点，ROOM-按考场',
                                   `backup_count` int NOT NULL COMMENT '备份数量',
                                   `draw_rule` varchar(10) DEFAULT NULL COMMENT 'ONE-只抽一次，CIRCLE-可循环抽取',
                                   `variable_content` text NOT NULL COMMENT '[\n  	{\n  		"type": "SIGN",\n  		"usedId": 1,\n  		"backupMethod": "ROOM",\n  		"backupCount": 3\n  	},\n  	{\n  		"type": "PACKAG",\n  		"usedId": 3,\n  		"backupMethod": "STUDENT",\n  		"backupCount": 5\n  	}\n  ]',
                                   `ordinary_content` text NOT NULL COMMENT '[\n  	{\n  		"type": "CHECK_IN",\n  		"usedId": 1,\n  		"backupMethod": "ROOM",\n  		"backupCount": 3\n  	}\n  ]',
                                   `status` varchar(20) NOT NULL COMMENT '印刷计划状态',
                                   `create_id` bigint DEFAULT NULL COMMENT '创建人',
                                   `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                                   `update_id` bigint DEFAULT NULL COMMENT '更新人',
                                   `update_time` bigint DEFAULT NULL COMMENT '更新时间',
                                   `third_relate_id` bigint DEFAULT NULL COMMENT '第三方系统关联ID（目前只有云阅卷）',
                                   `third_relate_name` varchar(100) DEFAULT NULL COMMENT '第三方系统关联考试名称（目前只有云阅卷）',
                                   `sync_status` varchar(20) DEFAULT NULL COMMENT '是否同步成功',
                                   PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='印刷计划管理';

-- ----------------------------
-- Table structure for exam_student
-- ----------------------------
DROP TABLE IF EXISTS `exam_student`;
CREATE TABLE `exam_student` (
                                `id` bigint NOT NULL COMMENT '主键',
                                `school_id` bigint NOT NULL COMMENT '学校id',
                                `org_id` bigint NOT NULL COMMENT '机构id',
                                `exam_detail_course_id` bigint NOT NULL COMMENT '考试明细课程id',
                                `student_name` varchar(30) NOT NULL COMMENT '考生姓名',
                                `student_code` varchar(30) NOT NULL COMMENT '考生代码',
                                `paper_number` varchar(30) NOT NULL COMMENT '试卷编号',
                                `ticket_number` varchar(30) DEFAULT NULL COMMENT '准考证号',
                                `site_number` varchar(30) DEFAULT NULL COMMENT '座位号',
                                `print_paper` tinyint DEFAULT NULL COMMENT '打印试卷',
                                `print_card` tinyint DEFAULT NULL COMMENT '打印题卡',
                                `extend_fields` text COMMENT '扩展字段',
                                `paper_type` varchar(2) DEFAULT NULL COMMENT '试卷类型',
                                `college_name` varchar(100) DEFAULT NULL COMMENT '学生学院名称',
                                `major_name` varchar(100) DEFAULT NULL COMMENT '专业名称',
                                `clazz_id` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '班级Id',
                                `clazz_name` varchar(100) DEFAULT NULL COMMENT '班级名称',
                                `teach_clazz_id` bigint DEFAULT NULL COMMENT '教学班id',
                                `teach_clazz_name` varchar(100) DEFAULT NULL COMMENT '教学班名称',
                                `student_clazz_type` varchar(100) DEFAULT NULL COMMENT '主体班级类型',
                                `campus_name` varchar(200) DEFAULT NULL COMMENT '校区',
                                `create_id` bigint DEFAULT NULL COMMENT '创建人',
                                `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                                `update_id` bigint DEFAULT NULL COMMENT '更新人',
                                `update_time` bigint DEFAULT NULL COMMENT '更新时间',
                                `attachment_id` bigint DEFAULT NULL COMMENT '附件id',
                                `sync_status` tinyint(1) DEFAULT NULL COMMENT '是否同步成功：true-是， false-否',
                                PRIMARY KEY (`id`) USING BTREE,
                                KEY `exam_student_schoolId_idx` (`school_id`,`student_code`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='考生';

-- ----------------------------
-- Table structure for exam_task
-- ----------------------------
DROP TABLE IF EXISTS `exam_task`;
CREATE TABLE `exam_task` (
                             `id` bigint NOT NULL COMMENT '主键',
                             `exam_id` bigint NOT NULL COMMENT '考试id',
                             `school_id` bigint NOT NULL COMMENT '学校id',
                             `org_id` bigint DEFAULT NULL COMMENT '机构id',
                             `course_code` varchar(20) NOT NULL COMMENT '课程代码',
                             `course_name` varchar(50) NOT NULL COMMENT '课程名称',
                             `specialty` varchar(100) DEFAULT NULL COMMENT '适用专业',
                             `paper_number` varchar(30) NOT NULL COMMENT '试卷编号',
                             `paper_number_id` bigint DEFAULT NULL COMMENT '试卷编号ID（用于推送云阅卷）',
                             `sequence` varchar(5) DEFAULT NULL COMMENT '课程创建的任务序号',
                             `start_time` bigint DEFAULT NULL COMMENT '命题开始时间',
                             `end_time` bigint DEFAULT NULL COMMENT '命题结束时间',
                             `card_rule_id` bigint NOT NULL COMMENT '题卡规则',
                             `user_id` bigint DEFAULT NULL COMMENT '命题老师',
                             `status` varchar(50) DEFAULT NULL COMMENT '任务状态，DRAFT：新建，SUBMIT：已提交，STAGE：待命题',
                             `review` tinyint DEFAULT NULL COMMENT '是否审核，0-禁用，1-启用',
                             `review_status` varchar(8) DEFAULT NULL COMMENT '审核状态：PASS-审核通过，NOT_PASS-审核不通过，默认为空-未审核',
                             `enable` tinyint DEFAULT '1' COMMENT '是否启用，false：停用，true：启用',
                             `batch_no` varchar(32) DEFAULT NULL COMMENT '批次id',
                             `teaching_room_id` bigint DEFAULT NULL COMMENT '教学单位、教研室',
                             `teacher_name` varchar(100) DEFAULT NULL COMMENT '拟卷教师',
                             `lecturer_name` varchar(100) DEFAULT NULL COMMENT '主讲教师',
                             `paper_name` varchar(100) DEFAULT NULL COMMENT '试卷名称',
                             `create_id` bigint DEFAULT NULL COMMENT '创建人',
                             `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                             `update_id` bigint DEFAULT NULL COMMENT '修改人',
                             `update_time` bigint DEFAULT NULL COMMENT '修改时间',
                             `flow_id` bigint DEFAULT NULL COMMENT '流程id',
                             `approve_form_attachment_id` bigint DEFAULT NULL COMMENT '命题任务审批表附件id',
                             PRIMARY KEY (`id`) USING BTREE,
                             KEY `task_schoolId_flowId_idx` (`school_id`,`flow_id`,`card_rule_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='命题任务';

-- ----------------------------
-- Table structure for exam_task_apply_temp
-- ----------------------------
DROP TABLE IF EXISTS `exam_task_apply_temp`;
CREATE TABLE `exam_task_apply_temp` (
                                        `id` bigint unsigned NOT NULL,
                                        `school_id` bigint NOT NULL COMMENT '学校Id',
                                        `org_id` bigint NOT NULL COMMENT '机构id',
                                        `exam_task_content` mediumtext COMMENT '命题任务json',
                                        `create_id` bigint DEFAULT NULL,
                                        `create_time` bigint DEFAULT NULL,
                                        `update_id` bigint DEFAULT NULL,
                                        `update_time` bigint DEFAULT NULL,
                                        PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='卷库查询-命题任务申请临时表';

-- ----------------------------
-- Table structure for exam_task_detail
-- ----------------------------
DROP TABLE IF EXISTS `exam_task_detail`;
CREATE TABLE `exam_task_detail` (
                                    `id` bigint NOT NULL COMMENT '主键',
                                    `exam_task_id` bigint NOT NULL COMMENT '命题任务ID',
                                    `paper_type` varchar(20) DEFAULT NULL COMMENT '试卷类型，多个以”/“分隔，如A/B/C/D',
                                    `draw_count` int DEFAULT NULL COMMENT '单次抽卷数量',
                                    `paper_attachment_ids` text COMMENT '转换为A3格式的试卷附件\n[\\n  	{\\n  		"type": "A",\\n  		"attachmentId": 12,\\n  		"totalPages": 3\\n  	},\\n  	{\\n  		"type": "B",\\n  		"attachmentId": 13,\\n  		"totalPages": 2\\n  	}\\n  ]',
                                    `make_method` varchar(45) DEFAULT NULL COMMENT '题卡绑定方式',
                                    `paper_confirm_attachment_ids` text COMMENT '[\n  	{\n  		"attachmentId": 12\n  	},\n  	{\n  		"attachmentId": 13\n  	}\n  ]',
                                    `remark` varchar(200) DEFAULT NULL COMMENT '备注',
                                    `exposed_paper_type` varchar(20) DEFAULT NULL COMMENT '曝光卷型：已打印卷型，多个以”/“分隔，如A/B/C/D',
                                    `relate_paper_type` varchar(5) DEFAULT NULL COMMENT '已曝光卷型',
                                    `unexposed_paper_type` varchar(20) DEFAULT NULL COMMENT '未曝光卷型',
                                    `create_id` bigint DEFAULT NULL COMMENT '创建人',
                                    `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                                    `update_id` bigint DEFAULT NULL COMMENT '更新人',
                                    `update_time` bigint DEFAULT NULL COMMENT '更新时间',
                                    `enable` tinyint DEFAULT '1' COMMENT '0-禁用，1-启用',
                                    PRIMARY KEY (`id`) USING BTREE,
                                    KEY `exam_task_detail_idx` (`exam_task_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='命题任务明细表（入库申请）';

-- ----------------------------
-- Table structure for exam_task_paper_log
-- ----------------------------
DROP TABLE IF EXISTS `exam_task_paper_log`;
CREATE TABLE `exam_task_paper_log` (
                                       `id` bigint NOT NULL COMMENT '主键',
                                       `exam_task_id` bigint NOT NULL COMMENT '命题任务ID',
                                       `paper_type` varchar(45) DEFAULT NULL COMMENT '试卷类型',
                                       `paper_attachment_ids` mediumtext COMMENT '修改后试卷',
                                       `card_id` bigint DEFAULT NULL COMMENT '修改后题卡ID',
                                       `review` tinyint(1) DEFAULT NULL COMMENT '是否审核：true-审核，false-未审核',
                                       `review_status` varchar(45) DEFAULT NULL COMMENT '审核状态：PASS-通过，NOT_PASS-不通过',
                                       `create_id` bigint DEFAULT NULL COMMENT '创建人',
                                       `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                                       `update_id` bigint DEFAULT NULL COMMENT '更新人',
                                       `update_time` bigint DEFAULT NULL COMMENT '更新时间',
                                       PRIMARY KEY (`id`) USING BTREE,
                                       KEY `exam_task_paper_idx` (`exam_task_id`,`review`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='卷库修改审核临时表';

-- ----------------------------
-- Table structure for exam_task_print
-- ----------------------------
DROP TABLE IF EXISTS `exam_task_print`;
CREATE TABLE `exam_task_print` (
                                   `id` bigint NOT NULL,
                                   `school_id` bigint DEFAULT NULL,
                                   `org_id` bigint DEFAULT NULL,
                                   `print_plan_id` bigint DEFAULT NULL COMMENT '印刷计划ID',
                                   `course_code` varchar(45) DEFAULT NULL COMMENT '课程代码',
                                   `course_name` varchar(50) DEFAULT NULL COMMENT '课程名称',
                                   `paper_number` varchar(45) DEFAULT NULL COMMENT '试卷编号',
                                   `exam_start_time` bigint DEFAULT NULL COMMENT '考试开始时间',
                                   `exam_end_time` bigint DEFAULT NULL COMMENT '考试结束时间',
                                   `package_seq` varchar(30) DEFAULT NULL COMMENT '卷袋序号',
                                   `exam_place` varchar(100) DEFAULT NULL,
                                   `exam_room` varchar(100) DEFAULT NULL,
                                   `invigilator_teacher` varchar(45) DEFAULT NULL COMMENT '监考老师',
                                   `class_id` varchar(100) DEFAULT NULL COMMENT '班级ID集合',
                                   `class_name` varchar(500) DEFAULT NULL COMMENT '班级名称集合',
                                   `student_count` int DEFAULT NULL COMMENT '考生总人数',
                                   `campus_id` bigint DEFAULT NULL COMMENT '校区ID',
                                   `print_house_id` bigint DEFAULT NULL COMMENT '印刷室ID',
                                   `print_house_name` varchar(100) DEFAULT NULL COMMENT '印刷室名称',
                                   `exam_detail_id` bigint DEFAULT NULL COMMENT '考场ID',
                                   `extend_fields` text COMMENT '扩展字段',
                                   `create_id` bigint DEFAULT NULL,
                                   `create_time` bigint DEFAULT NULL,
                                   `update_id` bigint DEFAULT NULL,
                                   `update_time` bigint DEFAULT NULL,
                                   PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='以试卷作为起点生成考务数据';

-- ----------------------------
-- Table structure for exam_task_review_log
-- ----------------------------
DROP TABLE IF EXISTS `exam_task_review_log`;
CREATE TABLE `exam_task_review_log` (
                                        `id` bigint NOT NULL COMMENT '主键',
                                        `exam_task_id` bigint NOT NULL COMMENT '命题任务ID',
                                        `review_status` varchar(8) NOT NULL COMMENT 'PASS-通过，NOT_PASS-不通过',
                                        `reason` mediumtext COMMENT '审核意见',
                                        `operate_id` bigint DEFAULT NULL COMMENT '操作人id',
                                        `operate_time` bigint DEFAULT NULL COMMENT '操作时间',
                                        `create_id` bigint DEFAULT NULL COMMENT '创建人',
                                        `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                                        `update_id` bigint DEFAULT NULL COMMENT '更新人',
                                        `update_time` bigint DEFAULT NULL COMMENT '更新时间',
                                        PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='命题任务审核日志表';

-- ----------------------------
-- Table structure for exam_task_temp
-- ----------------------------
DROP TABLE IF EXISTS `exam_task_temp`;
CREATE TABLE `exam_task_temp` (
                                  `id` bigint NOT NULL COMMENT '主键',
                                  `school_id` bigint NOT NULL COMMENT '学校id',
                                  `org_id` bigint DEFAULT NULL COMMENT '机构id',
                                  `batch_no` varchar(32) NOT NULL COMMENT '本次导入数据临时ID',
                                  `course_code` varchar(20) NOT NULL COMMENT '课程代码',
                                  `course_name` varchar(50) NOT NULL COMMENT '课程名称',
                                  `paper_number` varchar(30) DEFAULT NULL COMMENT '试卷编号',
                                  `specialty` varchar(100) DEFAULT NULL COMMENT '适用专业',
                                  `user_account` varchar(45) DEFAULT NULL COMMENT '命题老师账号',
                                  `user_name` varchar(45) DEFAULT NULL COMMENT '命题老师姓名',
                                  `create_id` bigint DEFAULT NULL COMMENT '创建人',
                                  `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                                  `update_id` bigint DEFAULT NULL COMMENT '更新人',
                                  `update_time` bigint DEFAULT NULL COMMENT '更新时间',
                                  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='命题任务临时表';

-- ----------------------------
-- Table structure for grade_batch
-- ----------------------------
DROP TABLE IF EXISTS `grade_batch`;
CREATE TABLE `grade_batch` (
                               `id` bigint NOT NULL COMMENT '分析批次主键',
                               `school_id` bigint NOT NULL COMMENT '学校id',
                               `semester_id` bigint NOT NULL COMMENT '学期id',
                               `batch_code` varchar(32) NOT NULL COMMENT '批次编号（在学校下唯一）',
                               `batch_name` varchar(32) NOT NULL COMMENT '批次名称（2020~2021学年上学期期末考试）',
                               `batch_time` bigint NOT NULL COMMENT '分析批次时间',
                               `status` varchar(32) NOT NULL COMMENT '批次状态\nSETTING_GRADE_PAPER("设置分析试卷"),PUSH_GRADE_BATCH("推送教研分析批次数据"),SETTING_GRADE_PAPER_PARAM("设置分析试卷参数"),READY_TO_CALCULATE("待计算"),FINISH_CALCULATE("完成计算")',
                               `third_semester_id` bigint DEFAULT NULL COMMENT '教研分析学期id',
                               `third_exam_id` bigint DEFAULT NULL COMMENT '第三方考试id',
                               `create_id` bigint DEFAULT NULL,
                               `create_time` bigint DEFAULT NULL,
                               `update_id` bigint DEFAULT NULL,
                               `update_time` bigint DEFAULT NULL,
                               `source` varchar(1000) DEFAULT NULL COMMENT '原始数据',
                               `progress` decimal(8,2) DEFAULT NULL COMMENT '进度',
                               `report_file_path` varchar(500) DEFAULT NULL COMMENT '报告路径',
                               `notify_time` bigint DEFAULT NULL COMMENT '回调时间',
                               `result` varchar(30) DEFAULT NULL COMMENT '数据结果，SUCCESS：成功，ERROR：失败',
                               PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='分析-批次表';

-- ----------------------------
-- Table structure for grade_batch_paper
-- ----------------------------
DROP TABLE IF EXISTS `grade_batch_paper`;
CREATE TABLE `grade_batch_paper` (
                                     `id` bigint NOT NULL,
                                     `school_id` bigint NOT NULL COMMENT '学校id',
                                     `batch_id` bigint NOT NULL COMMENT '分析批次id',
                                     `grade_paper_id` bigint DEFAULT NULL COMMENT '试卷id',
                                     `paper_number` varchar(100) NOT NULL COMMENT '试卷编号',
                                     `paper_type` varchar(16) NOT NULL COMMENT '试卷类型',
                                     `status` varchar(32) NOT NULL COMMENT '分析试卷状态\nSETTING_GRADE_PAPER("设置分析试卷"),PUSH_GRADE_BATCH("推送教研分析批次数据"),SETTING_GRADE_PAPER_PARAM("设置分析试卷参数"),READY_TO_CALCULATE("待计算"),FINISH_CALCULATE("完成计算")',
                                     `teach_college_id` bigint NOT NULL COMMENT '当前开课学院id',
                                     `teach_college_name` varchar(100) NOT NULL COMMENT '当前开课学院名称',
                                     `paper_name` varchar(100) DEFAULT NULL COMMENT '试卷名称',
                                     `enable` tinyint DEFAULT NULL COMMENT '是否可用',
                                     `publish_status` tinyint DEFAULT NULL COMMENT '是否发布',
                                     `grade_course_code` varchar(100) DEFAULT NULL COMMENT '推送教研分析后回传的教研分析课程编号（考试下唯一）',
                                     `create_id` bigint DEFAULT NULL,
                                     `create_time` bigint DEFAULT NULL,
                                     `update_id` bigint DEFAULT NULL,
                                     `update_time` bigint DEFAULT NULL,
                                     PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='分析-批次试卷关联关系表';

-- ----------------------------
-- Table structure for grade_batch_student
-- ----------------------------
DROP TABLE IF EXISTS `grade_batch_student`;
CREATE TABLE `grade_batch_student` (
                                       `id` bigint NOT NULL,
                                       `batch_id` bigint DEFAULT NULL COMMENT '分析-批次表ID',
                                       `course_code` varchar(50) DEFAULT NULL COMMENT '课程编码',
                                       `course_name` varchar(100) DEFAULT NULL COMMENT '课程名称',
                                       `paper_number` varchar(50) DEFAULT NULL COMMENT '试卷编号',
                                       `paper_type` varchar(16) DEFAULT NULL COMMENT '试卷类型',
                                       `student_code` varchar(45) DEFAULT NULL COMMENT '学号',
                                       `student_name` varchar(100) DEFAULT NULL COMMENT '学生姓名',
                                       `ticket_number` varchar(45) DEFAULT NULL COMMENT '准考证号',
                                       `teacher_name` varchar(100) DEFAULT NULL COMMENT '任课老师',
                                       `teacher_number` varchar(45) DEFAULT NULL COMMENT '任课老师工号',
                                       `create_id` bigint DEFAULT NULL,
                                       `create_time` bigint DEFAULT NULL,
                                       `update_id` bigint DEFAULT NULL,
                                       `update_time` bigint DEFAULT NULL,
                                       PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='考务数据（包含任课老师）';

-- ----------------------------
-- Table structure for grade_batch_student_clazz
-- ----------------------------
DROP TABLE IF EXISTS `grade_batch_student_clazz`;
CREATE TABLE `grade_batch_student_clazz` (
                                             `id` bigint NOT NULL,
                                             `batch_id` bigint DEFAULT NULL COMMENT '分析-批次表ID',
                                             `course_code` varchar(50) DEFAULT NULL COMMENT '课程编码',
                                             `course_name` varchar(100) DEFAULT NULL COMMENT '课程名称',
                                             `paper_number` varchar(50) DEFAULT NULL COMMENT '试卷编号',
                                             `paper_type` varchar(16) DEFAULT NULL COMMENT '试卷类型',
                                             `clazz_id` varchar(45) DEFAULT NULL COMMENT '班级ID',
                                             `clazz_name` varchar(100) DEFAULT NULL COMMENT '班级名称',
                                             `teacher_name` varchar(100) DEFAULT NULL COMMENT '任课老师',
                                             `teacher_number` varchar(45) DEFAULT NULL COMMENT '任课老师工号',
                                             `create_id` bigint DEFAULT NULL,
                                             `create_time` bigint DEFAULT NULL,
                                             `update_id` bigint DEFAULT NULL,
                                             `update_time` bigint DEFAULT NULL,
                                             PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='考务数据班级（包含任课老师）';

-- ----------------------------
-- Table structure for grade_module_define
-- ----------------------------
DROP TABLE IF EXISTS `grade_module_define`;
CREATE TABLE `grade_module_define` (
                                       `id` bigint NOT NULL COMMENT '模块熟练度主键',
                                       `school_id` bigint NOT NULL COMMENT '学校id',
                                       `paper_number` varchar(100) NOT NULL COMMENT '试卷编号',
                                       `paper_type` varchar(16) NOT NULL COMMENT '试卷类型',
                                       `paper_name` varchar(100) DEFAULT NULL COMMENT '试卷名称',
                                       `module_type` varchar(32) NOT NULL COMMENT '维度模块类型',
                                       `interpret` varchar(255) DEFAULT NULL COMMENT '解释',
                                       `remark` varchar(255) DEFAULT NULL COMMENT '备注',
                                       `define` varchar(255) DEFAULT NULL COMMENT '二级熟练度定义',
                                       `level` varchar(32) DEFAULT NULL COMMENT '等级',
                                       `min` varchar(32) DEFAULT NULL COMMENT '展示用最小边界',
                                       `max` varchar(32) DEFAULT NULL COMMENT '展示用最大边界',
                                       `scope` varchar(32) DEFAULT NULL COMMENT '取值范围（计算用）',
                                       `create_id` bigint DEFAULT NULL,
                                       `create_time` bigint DEFAULT NULL,
                                       `update_id` bigint DEFAULT NULL,
                                       `update_time` bigint DEFAULT NULL,
                                       PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='分析-模块二级考察点维度熟练度配置，及模块简要描述表';

-- ----------------------------
-- Table structure for grade_module_evaluation
-- ----------------------------
DROP TABLE IF EXISTS `grade_module_evaluation`;
CREATE TABLE `grade_module_evaluation` (
                                           `id` bigint NOT NULL,
                                           `school_id` bigint NOT NULL COMMENT '学校id',
                                           `paper_number` varchar(100) NOT NULL COMMENT '试卷编号',
                                           `paper_type` varchar(16) NOT NULL COMMENT '试卷类型',
                                           `paper_name` varchar(100) DEFAULT NULL COMMENT '试卷名称',
                                           `module_type` varchar(64) NOT NULL COMMENT '模块类型（知识、维度、素养）',
                                           `formula` varchar(64) NOT NULL COMMENT '计算公式规则',
                                           `scope` varchar(64) NOT NULL COMMENT '取值范围（计算用）',
                                           `level_code` varchar(32) NOT NULL COMMENT '等级',
                                           `level_name` varchar(32) NOT NULL COMMENT '水平等级层次',
                                           `result` text COMMENT '诊断结果',
                                           `advice` text COMMENT '学习建议',
                                           `create_id` bigint DEFAULT NULL,
                                           `create_time` bigint DEFAULT NULL,
                                           `update_id` bigint DEFAULT NULL,
                                           `update_time` bigint DEFAULT NULL,
                                           PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='校验-考察点模块评价建议表';

-- ----------------------------
-- Table structure for grade_paper
-- ----------------------------
DROP TABLE IF EXISTS `grade_paper`;
CREATE TABLE `grade_paper` (
                               `id` bigint NOT NULL COMMENT '试卷id',
                               `school_id` bigint NOT NULL COMMENT '学校id',
                               `paper_number` varchar(100) NOT NULL COMMENT '试卷编号',
                               `paper_type` varchar(16) NOT NULL COMMENT '试卷类型',
                               `paper_name` varchar(100) NOT NULL COMMENT '试卷名称',
                               `start_time` bigint DEFAULT NULL COMMENT '该试卷考试开始时间',
                               `end_time` bigint DEFAULT NULL COMMENT '该试卷考试结束时间',
                               `coefficient` decimal(12,4) DEFAULT NULL COMMENT '赋分系数（赋值分=卷面成绩 +（卷面满分-卷面成绩）/ 赋分系数）',
                               `total_score` decimal(12,4) NOT NULL COMMENT '试卷满分',
                               `pass_score` decimal(12,4) NOT NULL COMMENT '试卷及格分',
                               `score_type` varchar(64) NOT NULL COMMENT '赋分类型\\n1.NEED_ASSIGN_SCORE("是","需要且按照公式赋分")\\n2.NO_NEED_ASSIGN_SCORE("否","不需要赋分，标准分即为赋分")\\n3.SPECIAL_ASSIGN_SCORE("特殊赋分","特殊赋分，按照excel表进行赋分")',
                               `create_id` bigint DEFAULT NULL,
                               `create_time` bigint DEFAULT NULL,
                               `update_id` bigint DEFAULT NULL,
                               `update_time` bigint DEFAULT NULL,
                               PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='试卷基础信息表（赋分系数、试卷类型、满分、及格分等）';

-- ----------------------------
-- Table structure for grade_paper_dimension
-- ----------------------------
DROP TABLE IF EXISTS `grade_paper_dimension`;
CREATE TABLE `grade_paper_dimension` (
                                         `id` bigint NOT NULL,
                                         `school_id` bigint NOT NULL COMMENT '学校id',
                                         `paper_number` varchar(100) NOT NULL COMMENT '试卷编号',
                                         `paper_type` varchar(16) NOT NULL COMMENT '试卷类型',
                                         `paper_name` varchar(100) NOT NULL COMMENT '试卷名称',
                                         `dimension_type` varchar(32) NOT NULL COMMENT '维度类型 - 知识，能力，素养',
                                         `code_primary` varchar(32) NOT NULL COMMENT '一级维度编号',
                                         `name_primary` varchar(255) NOT NULL COMMENT '一级维度名称',
                                         `code_second` varchar(32) DEFAULT NULL COMMENT '二级维度编号',
                                         `name_second` varchar(255) DEFAULT NULL COMMENT '二级维度名称',
                                         `interpretation` varchar(255) DEFAULT NULL COMMENT '一级维度术语解释',
                                         `create_id` bigint DEFAULT NULL,
                                         `create_time` bigint DEFAULT NULL,
                                         `update_id` bigint DEFAULT NULL,
                                         `update_time` bigint DEFAULT NULL,
                                         PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='分析-考察点维度表';

-- ----------------------------
-- Table structure for grade_paper_struct
-- ----------------------------
DROP TABLE IF EXISTS `grade_paper_struct`;
CREATE TABLE `grade_paper_struct` (
                                      `id` bigint NOT NULL,
                                      `school_id` bigint NOT NULL COMMENT '学校id',
                                      `paper_number` varchar(100) NOT NULL COMMENT '试卷编号',
                                      `paper_type` varchar(16) NOT NULL COMMENT '试卷类型',
                                      `paper_name` varchar(100) NOT NULL COMMENT '试卷名称',
                                      `question_name` varchar(200) NOT NULL COMMENT '大题名称',
                                      `number_type` varchar(32) NOT NULL COMMENT '题号类型（客观题、主观题）',
                                      `big_question_number` varchar(64) NOT NULL COMMENT '大题号',
                                      `small_question_number` varchar(64) NOT NULL COMMENT '小题号(每一课程试卷的唯一标识)',
                                      `big_topic_name` varchar(64) NOT NULL COMMENT '大题名称',
                                      `full_score` decimal(12,4) NOT NULL COMMENT '满分',
                                      `score_rules` varchar(32) DEFAULT NULL COMMENT '计分规则',
                                      `rules_desc` varchar(500) DEFAULT NULL COMMENT '规则说明',
                                      `knowledge_dimension` varchar(255) NOT NULL COMMENT '知识维度',
                                      `ability_dimension` varchar(255) DEFAULT NULL COMMENT '能力维度',
                                      `literacy_dimension` varchar(255) DEFAULT NULL COMMENT '素养维度',
                                      `create_id` bigint DEFAULT NULL,
                                      `create_time` bigint DEFAULT NULL,
                                      `update_id` bigint DEFAULT NULL,
                                      `update_time` bigint DEFAULT NULL,
                                      PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='分析-试卷结构（蓝图）表';

-- ----------------------------
-- Table structure for qrtz_blob_triggers
-- ----------------------------
DROP TABLE IF EXISTS `qrtz_blob_triggers`;
CREATE TABLE `qrtz_blob_triggers` (
                                      `SCHED_NAME` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                                      `TRIGGER_NAME` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                                      `TRIGGER_GROUP` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                                      `BLOB_DATA` blob,
                                      PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`) USING BTREE,
                                      KEY `SCHED_NAME` (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Table structure for qrtz_calendars
-- ----------------------------
DROP TABLE IF EXISTS `qrtz_calendars`;
CREATE TABLE `qrtz_calendars` (
                                  `SCHED_NAME` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                                  `CALENDAR_NAME` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                                  `CALENDAR` blob NOT NULL,
                                  PRIMARY KEY (`SCHED_NAME`,`CALENDAR_NAME`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Table structure for qrtz_cron_triggers
-- ----------------------------
DROP TABLE IF EXISTS `qrtz_cron_triggers`;
CREATE TABLE `qrtz_cron_triggers` (
                                      `SCHED_NAME` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                                      `TRIGGER_NAME` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                                      `TRIGGER_GROUP` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                                      `CRON_EXPRESSION` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                                      `TIME_ZONE_ID` varchar(80) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
                                      PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Table structure for qrtz_fired_triggers
-- ----------------------------
DROP TABLE IF EXISTS `qrtz_fired_triggers`;
CREATE TABLE `qrtz_fired_triggers` (
                                       `SCHED_NAME` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                                       `ENTRY_ID` varchar(95) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                                       `TRIGGER_NAME` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                                       `TRIGGER_GROUP` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                                       `INSTANCE_NAME` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                                       `FIRED_TIME` bigint NOT NULL,
                                       `SCHED_TIME` bigint NOT NULL,
                                       `PRIORITY` int NOT NULL,
                                       `STATE` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                                       `JOB_NAME` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
                                       `JOB_GROUP` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
                                       `IS_NONCONCURRENT` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
                                       `REQUESTS_RECOVERY` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
                                       PRIMARY KEY (`SCHED_NAME`,`ENTRY_ID`) USING BTREE,
                                       KEY `IDX_QRTZ_FT_TRIG_INST_NAME` (`SCHED_NAME`,`INSTANCE_NAME`) USING BTREE,
                                       KEY `IDX_QRTZ_FT_INST_JOB_REQ_RCVRY` (`SCHED_NAME`,`INSTANCE_NAME`,`REQUESTS_RECOVERY`) USING BTREE,
                                       KEY `IDX_QRTZ_FT_J_G` (`SCHED_NAME`,`JOB_NAME`,`JOB_GROUP`) USING BTREE,
                                       KEY `IDX_QRTZ_FT_JG` (`SCHED_NAME`,`JOB_GROUP`) USING BTREE,
                                       KEY `IDX_QRTZ_FT_T_G` (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`) USING BTREE,
                                       KEY `IDX_QRTZ_FT_TG` (`SCHED_NAME`,`TRIGGER_GROUP`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Table structure for qrtz_job_details
-- ----------------------------
DROP TABLE IF EXISTS `qrtz_job_details`;
CREATE TABLE `qrtz_job_details` (
                                    `SCHED_NAME` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                                    `JOB_NAME` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                                    `JOB_GROUP` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                                    `DESCRIPTION` varchar(250) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
                                    `JOB_CLASS_NAME` varchar(250) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                                    `IS_DURABLE` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                                    `IS_NONCONCURRENT` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                                    `IS_UPDATE_DATA` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                                    `REQUESTS_RECOVERY` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                                    `JOB_DATA` blob,
                                    PRIMARY KEY (`SCHED_NAME`,`JOB_NAME`,`JOB_GROUP`) USING BTREE,
                                    KEY `IDX_QRTZ_J_REQ_RECOVERY` (`SCHED_NAME`,`REQUESTS_RECOVERY`) USING BTREE,
                                    KEY `IDX_QRTZ_J_GRP` (`SCHED_NAME`,`JOB_GROUP`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Table structure for qrtz_locks
-- ----------------------------
DROP TABLE IF EXISTS `qrtz_locks`;
CREATE TABLE `qrtz_locks` (
                              `SCHED_NAME` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                              `LOCK_NAME` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                              PRIMARY KEY (`SCHED_NAME`,`LOCK_NAME`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Table structure for qrtz_paused_trigger_grps
-- ----------------------------
DROP TABLE IF EXISTS `qrtz_paused_trigger_grps`;
CREATE TABLE `qrtz_paused_trigger_grps` (
                                            `SCHED_NAME` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                                            `TRIGGER_GROUP` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                                            PRIMARY KEY (`SCHED_NAME`,`TRIGGER_GROUP`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Table structure for qrtz_scheduler_state
-- ----------------------------
DROP TABLE IF EXISTS `qrtz_scheduler_state`;
CREATE TABLE `qrtz_scheduler_state` (
                                        `SCHED_NAME` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                                        `INSTANCE_NAME` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                                        `LAST_CHECKIN_TIME` bigint NOT NULL,
                                        `CHECKIN_INTERVAL` bigint NOT NULL,
                                        PRIMARY KEY (`SCHED_NAME`,`INSTANCE_NAME`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Table structure for qrtz_simple_triggers
-- ----------------------------
DROP TABLE IF EXISTS `qrtz_simple_triggers`;
CREATE TABLE `qrtz_simple_triggers` (
                                        `SCHED_NAME` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                                        `TRIGGER_NAME` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                                        `TRIGGER_GROUP` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                                        `REPEAT_COUNT` bigint NOT NULL,
                                        `REPEAT_INTERVAL` bigint NOT NULL,
                                        `TIMES_TRIGGERED` bigint NOT NULL,
                                        PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Table structure for qrtz_simprop_triggers
-- ----------------------------
DROP TABLE IF EXISTS `qrtz_simprop_triggers`;
CREATE TABLE `qrtz_simprop_triggers` (
                                         `SCHED_NAME` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                                         `TRIGGER_NAME` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                                         `TRIGGER_GROUP` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                                         `STR_PROP_1` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
                                         `STR_PROP_2` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
                                         `STR_PROP_3` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
                                         `INT_PROP_1` int DEFAULT NULL,
                                         `INT_PROP_2` int DEFAULT NULL,
                                         `LONG_PROP_1` bigint DEFAULT NULL,
                                         `LONG_PROP_2` bigint DEFAULT NULL,
                                         `DEC_PROP_1` decimal(13,4) DEFAULT NULL,
                                         `DEC_PROP_2` decimal(13,4) DEFAULT NULL,
                                         `BOOL_PROP_1` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
                                         `BOOL_PROP_2` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
                                         PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Table structure for qrtz_triggers
-- ----------------------------
DROP TABLE IF EXISTS `qrtz_triggers`;
CREATE TABLE `qrtz_triggers` (
                                 `SCHED_NAME` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                                 `TRIGGER_NAME` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                                 `TRIGGER_GROUP` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                                 `JOB_NAME` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                                 `JOB_GROUP` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                                 `DESCRIPTION` varchar(250) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
                                 `NEXT_FIRE_TIME` bigint DEFAULT NULL,
                                 `PREV_FIRE_TIME` bigint DEFAULT NULL,
                                 `PRIORITY` int DEFAULT NULL,
                                 `TRIGGER_STATE` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                                 `TRIGGER_TYPE` varchar(8) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                                 `START_TIME` bigint NOT NULL,
                                 `END_TIME` bigint DEFAULT NULL,
                                 `CALENDAR_NAME` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
                                 `MISFIRE_INSTR` smallint DEFAULT NULL,
                                 `JOB_DATA` blob,
                                 PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`) USING BTREE,
                                 KEY `IDX_QRTZ_T_J` (`SCHED_NAME`,`JOB_NAME`,`JOB_GROUP`) USING BTREE,
                                 KEY `IDX_QRTZ_T_JG` (`SCHED_NAME`,`JOB_GROUP`) USING BTREE,
                                 KEY `IDX_QRTZ_T_C` (`SCHED_NAME`,`CALENDAR_NAME`) USING BTREE,
                                 KEY `IDX_QRTZ_T_G` (`SCHED_NAME`,`TRIGGER_GROUP`) USING BTREE,
                                 KEY `IDX_QRTZ_T_STATE` (`SCHED_NAME`,`TRIGGER_STATE`) USING BTREE,
                                 KEY `IDX_QRTZ_T_N_STATE` (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`,`TRIGGER_STATE`) USING BTREE,
                                 KEY `IDX_QRTZ_T_N_G_STATE` (`SCHED_NAME`,`TRIGGER_GROUP`,`TRIGGER_STATE`) USING BTREE,
                                 KEY `IDX_QRTZ_T_NEXT_FIRE_TIME` (`SCHED_NAME`,`NEXT_FIRE_TIME`) USING BTREE,
                                 KEY `IDX_QRTZ_T_NFT_ST` (`SCHED_NAME`,`TRIGGER_STATE`,`NEXT_FIRE_TIME`) USING BTREE,
                                 KEY `IDX_QRTZ_T_NFT_MISFIRE` (`SCHED_NAME`,`MISFIRE_INSTR`,`NEXT_FIRE_TIME`) USING BTREE,
                                 KEY `IDX_QRTZ_T_NFT_ST_MISFIRE` (`SCHED_NAME`,`MISFIRE_INSTR`,`NEXT_FIRE_TIME`,`TRIGGER_STATE`) USING BTREE,
                                 KEY `IDX_QRTZ_T_NFT_ST_MISFIRE_GRP` (`SCHED_NAME`,`MISFIRE_INSTR`,`NEXT_FIRE_TIME`,`TRIGGER_GROUP`,`TRIGGER_STATE`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Table structure for sys_config
-- ----------------------------
DROP TABLE IF EXISTS `sys_config`;
CREATE TABLE `sys_config` (
                              `id` bigint NOT NULL COMMENT '主键',
                              `school_id` bigint DEFAULT NULL COMMENT '学校id',
                              `org_id` bigint DEFAULT NULL COMMENT '机构id',
                              `config_key` varchar(100) NOT NULL COMMENT '参数键名',
                              `config_name` varchar(100) NOT NULL COMMENT '参数名称',
                              `config_value` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '参数键值',
                              `remark` varchar(100) DEFAULT NULL COMMENT '备注',
                              `create_id` bigint DEFAULT NULL COMMENT '创建人',
                              `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                              `update_id` bigint DEFAULT NULL COMMENT '更新人',
                              `update_time` bigint DEFAULT NULL COMMENT '更新时间',
                              PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='参数表';

-- ----------------------------
-- Table structure for sys_org
-- ----------------------------
DROP TABLE IF EXISTS `sys_org`;
CREATE TABLE `sys_org` (
                           `id` bigint NOT NULL COMMENT '主键',
                           `school_id` bigint NOT NULL COMMENT '学校id',
                           `type` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '类型，SCHOOL：学校，COLLEGE：学院，FACULTY：院系，TEACHING_ROOM：教研室，PRINTING_HOUSE：印刷厂',
                           `code` varchar(20) DEFAULT NULL COMMENT '机构代码',
                           `name` varchar(100) NOT NULL COMMENT '机构名称',
                           `parent_id` bigint DEFAULT NULL COMMENT '上级机构id',
                           `enable` tinyint NOT NULL DEFAULT '1' COMMENT '是否启用，0：停用，1：启用',
                           `create_id` bigint DEFAULT NULL COMMENT '创建人',
                           `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                           `update_id` bigint DEFAULT NULL COMMENT '修改人',
                           `update_time` bigint DEFAULT NULL COMMENT '修改时间',
                           `historic_name` varchar(100) DEFAULT NULL COMMENT '历史机构名称',
                           PRIMARY KEY (`id`) USING BTREE,
                           UNIQUE KEY `org_schoolId_name_idx` (`school_id`,`name`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='学校组织架构';

-- ----------------------------
-- Table structure for sys_privilege
-- ----------------------------
DROP TABLE IF EXISTS `sys_privilege`;
CREATE TABLE `sys_privilege` (
                                 `id` bigint NOT NULL COMMENT '主键',
                                 `name` varchar(100) NOT NULL COMMENT '菜单名称',
                                 `url` varchar(100) NOT NULL COMMENT 'URL地址',
                                 `type` varchar(50) NOT NULL COMMENT '类型，MENU：菜单，BUTTON：按钮，LINK：链接，URL：接口地址，LIST：列表，CONDITION：查询条件，TAB：选项卡',
                                 `parent_id` bigint DEFAULT NULL COMMENT '上级菜单',
                                 `sequence` int NOT NULL COMMENT '序号',
                                 `property` varchar(30) DEFAULT NULL COMMENT '属性，NO_AUTH：无需鉴权，AUTH：鉴权，SYS：系统公用',
                                 `related` text COMMENT '关联属性，type为URL且property为AUTH才有',
                                 `enable` tinyint NOT NULL DEFAULT '1' COMMENT '是否启用，0：停用，1：启用',
                                 `default_auth` tinyint DEFAULT '1' COMMENT '默认权限，0：否，1：是',
                                 `front_display` tinyint(1) DEFAULT '1' COMMENT '是否前端展示',
                                 PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='菜单权限表';

-- ----------------------------
-- Table structure for sys_role
-- ----------------------------
DROP TABLE IF EXISTS `sys_role`;
CREATE TABLE `sys_role` (
                            `id` bigint NOT NULL COMMENT '主键',
                            `school_id` bigint DEFAULT NULL COMMENT '学校id',
                            `org_id` bigint DEFAULT NULL COMMENT '机构id',
                            `name` varchar(50) NOT NULL COMMENT '角色名称',
                            `enable` tinyint NOT NULL DEFAULT '1' COMMENT '是否启用，0：停用，1：启用',
                            `type` varchar(20) DEFAULT NULL COMMENT '角色类别，ADMIN：超级管理员，SCHOOL_ADMIN：管理员：EXAM_TEACHER：考务老师，QUESTION_TEACHER：命题老师，CUSTOMER：客服人员，PRINTER：印刷人员，CUSTOM：自定义',
                            `create_id` bigint DEFAULT NULL COMMENT '创建人',
                            `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                            `update_id` bigint DEFAULT NULL COMMENT '修改人',
                            `update_time` bigint DEFAULT NULL COMMENT '修改时间',
                            `default_role` tinyint NOT NULL DEFAULT '0' COMMENT '是否系统内置角色，1：是，0：不是',
                            `source` varchar(100) DEFAULT NULL COMMENT '角色来源，ANALYSIS：教研分析',
                            `interpret` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '角色说明',
                            PRIMARY KEY (`id`) USING BTREE,
                            UNIQUE KEY `role_schoolId_name_idx` (`school_id`,`name`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='角色表';

-- ----------------------------
-- Table structure for sys_role_group_member
-- ----------------------------
DROP TABLE IF EXISTS `sys_role_group_member`;
CREATE TABLE `sys_role_group_member` (
                                         `id` bigint NOT NULL COMMENT '主键',
                                         `role_id` bigint NOT NULL COMMENT '角色id',
                                         `user_id` bigint NOT NULL COMMENT '用户id',
                                         `member_id` bigint NOT NULL COMMENT '成员id',
                                         `enable` tinyint NOT NULL DEFAULT '1' COMMENT '是否启用，0：停用，1：启用',
                                         PRIMARY KEY (`id`) USING BTREE,
                                         UNIQUE KEY `role_group_roleId_memberId_idx` (`role_id`,`member_id`,`enable`) USING BTREE,
                                         KEY `role_group_member_idx` (`role_id`,`user_id`,`member_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='角色组成员表';

-- ----------------------------
-- Table structure for sys_role_privilege
-- ----------------------------
DROP TABLE IF EXISTS `sys_role_privilege`;
CREATE TABLE `sys_role_privilege` (
                                      `id` bigint NOT NULL COMMENT '主键',
                                      `role_id` bigint NOT NULL COMMENT '角色id',
                                      `privilege_id` bigint NOT NULL COMMENT '菜单id',
                                      `enable` tinyint DEFAULT '1' COMMENT '是否启用，0：停用，1：启用',
                                      PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='角色和菜单关联表';

-- ----------------------------
-- Table structure for sys_user
-- ----------------------------
DROP TABLE IF EXISTS `sys_user`;
CREATE TABLE `sys_user` (
                            `id` bigint NOT NULL COMMENT '主键',
                            `school_id` bigint DEFAULT NULL COMMENT '学校id',
                            `login_name` varchar(100) NOT NULL COMMENT '用户名',
                            `real_name` varchar(100) NOT NULL COMMENT '姓名',
                            `code` varchar(100) DEFAULT NULL COMMENT '工号',
                            `password` varchar(50) NOT NULL COMMENT '密码',
                            `mobile_number` varchar(11) DEFAULT NULL COMMENT '手机号',
                            `org_id` bigint DEFAULT NULL COMMENT '机构id',
                            `enable` tinyint NOT NULL DEFAULT '1' COMMENT '是否启用，0：停用，1：启用',
                            `pwd_count` tinyint DEFAULT '0' COMMENT '密码修改次数，默认为0',
                            `pwd_update_time` bigint DEFAULT NULL COMMENT '密码修改时间',
                            `remark` varchar(200) DEFAULT NULL COMMENT '备注',
                            `create_id` bigint DEFAULT NULL COMMENT '创建人',
                            `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                            `update_id` bigint DEFAULT NULL COMMENT '修改人',
                            `update_time` bigint DEFAULT NULL COMMENT '修改时间',
                            `historic_name` varchar(100) DEFAULT NULL COMMENT '历史用户名称',
                            PRIMARY KEY (`id`) USING BTREE,
                            UNIQUE KEY `user_schoolId_loginName_idx` (`school_id`,`login_name`) USING BTREE,
                            UNIQUE KEY `uq_school_id_mobile_number` (`school_id`,`mobile_number`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户表';

-- ----------------------------
-- Table structure for sys_user_role
-- ----------------------------
DROP TABLE IF EXISTS `sys_user_role`;
CREATE TABLE `sys_user_role` (
                                 `id` bigint NOT NULL COMMENT '主键',
                                 `user_id` bigint NOT NULL COMMENT '用户id',
                                 `role_id` bigint NOT NULL COMMENT '角色id',
                                 `privilege_id` bigint DEFAULT NULL COMMENT '权限id',
                                 `enable` tinyint NOT NULL DEFAULT '1' COMMENT '是否启用，0：停用，1：启用',
                                 PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户和角色关联表';

-- ----------------------------
-- Table structure for t_b_session
-- ----------------------------
DROP TABLE IF EXISTS `t_b_session`;
CREATE TABLE `t_b_session` (
                               `id` varchar(100) NOT NULL COMMENT '主键',
                               `school_id` bigint DEFAULT NULL COMMENT '学校id',
                               `org_id` bigint DEFAULT NULL COMMENT '机构id',
                               `identity` varchar(100) NOT NULL COMMENT '用户标识',
                               `type` varchar(50) NOT NULL COMMENT '用户类型',
                               `source` varchar(50) NOT NULL COMMENT '访问来源',
                               `platform` varchar(50) NOT NULL COMMENT '设备分类',
                               `device_id` varchar(100) NOT NULL COMMENT '设备标识',
                               `address` varchar(100) NOT NULL COMMENT '登录IP地址',
                               `access_token` varchar(50) NOT NULL COMMENT '访问令牌',
                               `last_access_time` bigint DEFAULT NULL COMMENT '最近访问时间',
                               `last_access_ip` varchar(100) DEFAULT NULL COMMENT '最近访问IP地址',
                               `update_time` bigint DEFAULT NULL COMMENT '令牌更新时间',
                               `expire_time` bigint DEFAULT NULL COMMENT '令牌强制失效时间',
                               `app_source` varchar(50) DEFAULT NULL COMMENT '应用来源',
                               PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='会话表';

-- ----------------------------
-- Table structure for t_b_sync_task
-- ----------------------------
DROP TABLE IF EXISTS `t_b_sync_task`;
CREATE TABLE `t_b_sync_task` (
                                 `id` bigint NOT NULL COMMENT '主键',
                                 `school_id` bigint DEFAULT NULL COMMENT '学校id',
                                 `org_id` bigint DEFAULT NULL COMMENT '机构id',
                                 `type` varchar(50) NOT NULL COMMENT '推送类型，USER_PUSH：用户推送',
                                 `third_relate_id` bigint DEFAULT NULL COMMENT '第三方系统关联ID（目前只有云阅卷）',
                                 `object_id` bigint DEFAULT NULL COMMENT '印刷计划id',
                                 `status` varchar(30) NOT NULL COMMENT '任务状态，INIT：未开始，RUNNING：进行中，FINISH：已完成',
                                 `summary` text 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 '备注',
                                 `reset_count` int DEFAULT '0' COMMENT '重试次数',
                                 `error_message` varchar(500) DEFAULT NULL COMMENT '人工错误原因',
                                 `report_file_path` varchar(500) DEFAULT NULL COMMENT '报告路径',
                                 PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='云阅卷同步任务表';

-- ----------------------------
-- Table structure for t_b_task
-- ----------------------------
DROP TABLE IF EXISTS `t_b_task`;
CREATE TABLE `t_b_task` (
                            `id` bigint NOT NULL COMMENT '主键',
                            `type` varchar(50) NOT NULL COMMENT '任务类型，USER_IMPORT：用户导入，\nQUESTION_MISSION_BATCH_CREATE：批量新建命题任务，\nSAMPLE_EXPORT：导出审核样本，\nPAPER_DOWNLOAD：卷库下载，\nEXAMINATION_IMPORT：考务数据导入，\nEXAMINATION_EXPORT：考务数据导出，\nPRINT_PDF_DOWNLOAD：批量下载pdf，\nCREATE_PDF：生成pdf，\nCOURSE_IMPORT：课程导入',
                            `entity_id` bigint DEFAULT NULL COMMENT '关联业务对象id',
                            `status` varchar(30) NOT NULL COMMENT '任务状态，INIT：未开始，RUNNING：进行中，FINISH：已完成',
                            `summary` text COMMENT '实时摘要信息',
                            `progress` double DEFAULT NULL COMMENT '执行进度',
                            `result` varchar(30) DEFAULT NULL COMMENT '数据结果，SUCCESS：成功，ERROR：失败',
                            `enable` tinyint NOT NULL DEFAULT '1' COMMENT '是否启用，false：停用，true：启用',
                            `import_file_name` varchar(100) DEFAULT NULL COMMENT '导入文件名',
                            `import_file_path` varchar(500) DEFAULT NULL COMMENT '导入文件路径',
                            `result_file_path` varchar(500) DEFAULT NULL COMMENT '导出文件路径',
                            `report_file_path` varchar(500) DEFAULT NULL COMMENT '报告路径',
                            `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                            `update_id` bigint DEFAULT NULL COMMENT '更新人',
                            `update_time` bigint DEFAULT NULL COMMENT '更新时间',
                            `create_id` bigint DEFAULT NULL COMMENT '创建人',
                            `school_id` bigint DEFAULT NULL COMMENT '学校id',
                            `org_id` bigint DEFAULT NULL COMMENT '机构id',
                            `print_plan_id` bigint DEFAULT NULL COMMENT '印刷计划id',
                            `remark` mediumtext COMMENT '备注',
                            `obj_name` varchar(500) DEFAULT NULL COMMENT '实体名称',
                            `reset_count` int DEFAULT '0' COMMENT '重试次数',
                            `version` int DEFAULT '0' COMMENT '更新版本号',
                            `error_message` varchar(500) DEFAULT NULL COMMENT '人工错误原因',
                            PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='导入导出任务表';

-- ----------------------------
-- Table structure for t_c_statistics
-- ----------------------------
DROP TABLE IF EXISTS `t_c_statistics`;
CREATE TABLE `t_c_statistics` (
                                  `id` bigint NOT NULL COMMENT '主键',
                                  `exam_id` bigint NOT NULL COMMENT '考试id',
                                  `exam_task_detail_ids` mediumtext COMMENT '命题任务明细id',
                                  `exam_detail_course_ids` mediumtext COMMENT '考务数据课程id',
                                  `college_id` bigint NOT NULL COMMENT '学院id',
                                  `college_name` varchar(100) NOT NULL COMMENT '学院名称',
                                  `course_name` varchar(100) NOT NULL COMMENT '课程名称',
                                  `course_code` varchar(100) NOT NULL COMMENT '课程代码',
                                  `teaching_room_id` bigint NOT NULL COMMENT '教研室id',
                                  `teaching_room_name` varchar(100) NOT NULL COMMENT '教研室名称',
                                  `teacher_name` mediumtext NOT NULL COMMENT '任课老师名称',
                                  `clazz_ids` varchar(100) NOT NULL COMMENT '班级ids',
                                  `clazz_name` varchar(100) NOT NULL COMMENT '班级名称',
                                  `paper_number` varchar(100) DEFAULT NULL COMMENT '试卷编号',
                                  `print_plan_id` bigint DEFAULT NULL COMMENT '印刷计划id',
                                  `batch_no` varchar(100) NOT NULL COMMENT '批次号',
                                  `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 '更新时间',
                                  `print_sum` varchar(100) DEFAULT NULL COMMENT '总印份数',
                                  `status` varchar(50) DEFAULT NULL COMMENT '完成状态，FINISH：已完成，UN_FINISH：未完成',
                                  `exam_detail_id` bigint DEFAULT NULL COMMENT '命题明细id',
                                  `clazz_content` mediumtext COMMENT '班级详细信息内容',
                                  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='命题统计表';

-- ----------------------------
-- Table structure for t_c_statistics_temp
-- ----------------------------
DROP TABLE IF EXISTS `t_c_statistics_temp`;
CREATE TABLE `t_c_statistics_temp` (
                                       `id` bigint NOT NULL COMMENT '主键',
                                       `exam_id` bigint NOT NULL COMMENT '考试id',
                                       `exam_task_detail_id` bigint DEFAULT NULL COMMENT '命题任务明细id',
                                       `exam_detail_course_id` bigint DEFAULT NULL COMMENT '考务数据课程id',
                                       `college_id` bigint NOT NULL COMMENT '学院id',
                                       `college_name` varchar(100) NOT NULL COMMENT '学院名称',
                                       `course_name` varchar(100) NOT NULL COMMENT '课程名称',
                                       `course_code` varchar(100) NOT NULL COMMENT '课程代码',
                                       `teaching_room_id` bigint NOT NULL COMMENT '教研室id',
                                       `teaching_room_name` varchar(100) NOT NULL COMMENT '教研室名称',
                                       `teacher_name` mediumtext NOT NULL COMMENT '任课老师名称',
                                       `clazz_ids` varchar(100) NOT NULL COMMENT '班级ids',
                                       `clazz_name` varchar(100) NOT NULL COMMENT '班级名称',
                                       `paper_number` varchar(100) DEFAULT NULL COMMENT '试卷编号',
                                       `print_plan_id` bigint DEFAULT NULL COMMENT '印刷计划id',
                                       `batch_no` varchar(100) NOT NULL COMMENT '批次号',
                                       `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 '更新时间',
                                       `data_source` varchar(50) DEFAULT NULL COMMENT '数据来源，IMPORT：导入，JOIN：关联查询的数据',
                                       `exam_detail_id` bigint DEFAULT NULL COMMENT '命题明细id',
                                       PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='命题统计表';

-- ----------------------------
-- Table structure for t_f_custom_flow
-- ----------------------------
DROP TABLE IF EXISTS `t_f_custom_flow`;
CREATE TABLE `t_f_custom_flow` (
                                   `id` bigint NOT NULL COMMENT '主键',
                                   `school_id` bigint NOT NULL COMMENT '学校id',
                                   `org_id` bigint DEFAULT NULL COMMENT '机构id',
                                   `name` varchar(100) NOT NULL COMMENT '流程名称',
                                   `model_type` varchar(50) NOT NULL COMMENT '模式类型，USER_FIXED：指定人员,APPROVE_SET：发起人指定',
                                   `type` varchar(100) NOT NULL COMMENT '流程类型，ELECTRON_FLOW：电子交卷审核，QUESTION_ELECTRON_FLOW：题库试题提交审核，PAPER_ELECTRON_FLOW：题库试卷审核',
                                   `enable` tinyint DEFAULT '1' COMMENT '是否启用，0：停用，1：启用',
                                   `publish` tinyint NOT NULL DEFAULT '1' COMMENT '是否发布，0：否，1：是',
                                   `object_data` mediumtext NOT NULL COMMENT '自定义流程源数据',
                                   `create_id` bigint DEFAULT NULL COMMENT '创建人',
                                   `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                                   `update_id` bigint DEFAULT NULL COMMENT '更新人',
                                   `update_time` bigint DEFAULT NULL COMMENT '更新时间',
                                   `version` bigint NOT NULL DEFAULT '1' COMMENT '版本号',
                                   `flow_key` varchar(100) DEFAULT NULL COMMENT '流程key',
                                   `act_flow_id` varchar(100) DEFAULT NULL COMMENT '流程版本id',
                                   `flow_process_var` mediumtext COMMENT '流程过程变量数据',
                                   PRIMARY KEY (`id`) USING BTREE,
                                   UNIQUE KEY `custom_flow_schoolId_type_idx` (`school_id`,`type`,`enable`,`publish`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='自定义流程表';

-- ----------------------------
-- Table structure for t_f_custom_flow_entity
-- ----------------------------
DROP TABLE IF EXISTS `t_f_custom_flow_entity`;
CREATE TABLE `t_f_custom_flow_entity` (
                                          `id` bigint NOT NULL COMMENT '主键',
                                          `t_f_custom_flow_id` bigint NOT NULL COMMENT '自定义流程id',
                                          `flow_id` bigint DEFAULT NULL COMMENT '流程id',
                                          `flow_process_var` mediumtext NOT NULL COMMENT '流程过程变量',
                                          `create_id` bigint DEFAULT NULL COMMENT '创建人',
                                          `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                                          `update_id` bigint DEFAULT NULL COMMENT '更新人',
                                          `update_time` bigint DEFAULT NULL COMMENT '更新时间',
                                          PRIMARY KEY (`id`) USING BTREE,
                                          KEY `flow_entity_flowId_idx` (`flow_id`),
                                          KEY `flow_entity_custom_flowId_idx` (`t_f_custom_flow_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='自定义流程实体数据';

-- ----------------------------
-- Table structure for t_f_flow_approve
-- ----------------------------
DROP TABLE IF EXISTS `t_f_flow_approve`;
CREATE TABLE `t_f_flow_approve` (
                                    `id` bigint NOT NULL COMMENT '主键',
                                    `school_id` bigint NOT NULL COMMENT '学校id',
                                    `org_id` bigint DEFAULT NULL COMMENT '机构id',
                                    `flow_id` bigint NOT NULL COMMENT '流程id',
                                    `approve_id` bigint DEFAULT NULL COMMENT '审核id',
                                    `status` varchar(50) NOT NULL COMMENT '状态，START：已开始，AUDITING：审核中，REJECT：已驳回，END：已终止，FINISH：已结束',
                                    `create_id` bigint DEFAULT NULL COMMENT '创建人',
                                    `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                                    `update_id` bigint DEFAULT NULL COMMENT '更新人',
                                    `update_time` bigint DEFAULT NULL COMMENT '更新时间',
                                    `setup` tinyint NOT NULL COMMENT '计划步骤',
                                    `approve_setup` int DEFAULT NULL COMMENT '审批步骤',
                                    `approve_max_setup` int DEFAULT NULL COMMENT '最大审批步骤',
                                    `transfer_assignee` mediumtext COMMENT '流程转办',
                                    `all_assignee` mediumtext COMMENT '会签审批人',
                                    `reject_link` mediumtext COMMENT '驳回路线',
                                    `enable` tinyint NOT NULL DEFAULT '1' COMMENT '是否启用，0：停用，1：启用',
                                    PRIMARY KEY (`id`) USING BTREE,
                                    KEY `flow_approve_idx` (`school_id`,`flow_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='流程审核表';

-- ----------------------------
-- Table structure for t_f_flow_join
-- ----------------------------
DROP TABLE IF EXISTS `t_f_flow_join`;
CREATE TABLE `t_f_flow_join` (
                                 `id` bigint NOT NULL COMMENT '主键',
                                 `flow_entity_id` bigint NOT NULL COMMENT '自定义流程实体id',
                                 `object_table` varchar(100) NOT NULL COMMENT '实体表',
                                 `object_id` bigint NOT NULL COMMENT '实体id',
                                 `flow_id` bigint NOT NULL COMMENT '流程id',
                                 `level` int NOT NULL COMMENT '流程等级',
                                 `type` varchar(50) NOT NULL COMMENT '类型，NEW：新增，RESTART：重新提交',
                                 `create_id` bigint DEFAULT NULL COMMENT '创建人',
                                 `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                                 PRIMARY KEY (`id`) USING BTREE,
                                 KEY `task_flowId_idx` (`flow_id`) USING BTREE,
                                 KEY `task_objectId_idx` (`object_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='实体和流程关联表';

-- ----------------------------
-- Table structure for t_f_flow_log
-- ----------------------------
DROP TABLE IF EXISTS `t_f_flow_log`;
CREATE TABLE `t_f_flow_log` (
                                `id` bigint NOT NULL COMMENT '主键',
                                `school_id` bigint NOT NULL COMMENT '学校id',
                                `org_id` bigint DEFAULT NULL COMMENT '机构id',
                                `flow_id` bigint NOT NULL COMMENT '流程id',
                                `object_table` varchar(100) DEFAULT NULL COMMENT '实体表',
                                `object_id` bigint NOT NULL COMMENT '实体id',
                                `approve_id` bigint DEFAULT NULL COMMENT '审核人id',
                                `approve_setup` tinyint DEFAULT NULL COMMENT '审核步骤',
                                `approve_remark` mediumtext COMMENT '审核意见',
                                `enable` tinyint NOT NULL DEFAULT '1' COMMENT '是否启用，0：停用，1：启用',
                                `create_id` bigint DEFAULT NULL COMMENT '创建人',
                                `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                                `update_id` bigint DEFAULT NULL COMMENT '更新人',
                                `update_time` bigint DEFAULT NULL COMMENT '更新时间',
                                `approve_operation` varchar(50) NOT NULL COMMENT '审批操作，SUBMIT：提交，APPROVE：审批，REJECT：驳回，END：终止',
                                `pend_approve_id` mediumtext COMMENT '待审核人id',
                                `paper_attachment_id` mediumtext COMMENT '试卷附件',
                                `approve_multi_setup` int DEFAULT NULL COMMENT '审批步骤',
                                `approve_user_approve_type` varchar(30) DEFAULT NULL COMMENT '审批用户类别，ORDER：依次审批，ALL：会签（所有人必须审批），SOME：或签（一名审批人同意或拒绝即可）',
                                PRIMARY KEY (`id`) USING BTREE,
                                KEY `flow_log_idx` (`school_id`,`flow_id`) USING BTREE,
                                KEY `flow_log_objectId_idx` (`object_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='流程流水表';

-- ----------------------------
-- Table structure for t_g_error
-- ----------------------------
DROP TABLE IF EXISTS `t_g_error`;
CREATE TABLE `t_g_error` (
                             `id` bigint NOT NULL COMMENT '主键',
                             `school_id` bigint DEFAULT NULL COMMENT '学校id',
                             `org_id` bigint DEFAULT NULL COMMENT '机构id',
                             `obj_id` bigint DEFAULT NULL COMMENT '实体id',
                             `summary` mediumtext COMMENT '实时摘要信息',
                             `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                             PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='全局异常错误信息表';

-- ----------------------------
-- Table structure for t_m_mq_message
-- ----------------------------
DROP TABLE IF EXISTS `t_m_mq_message`;
CREATE TABLE `t_m_mq_message` (
                                  `id` varchar(50) NOT NULL COMMENT '主键',
                                  `school_id` bigint DEFAULT NULL COMMENT '学校id',
                                  `org_id` bigint DEFAULT NULL COMMENT '机构id',
                                  `topic` varchar(100) NOT NULL COMMENT '消息topic',
                                  `tag` varchar(100) NOT NULL COMMENT '消息tag',
                                  `body` mediumtext COMMENT '消息内容',
                                  `type` varchar(50) NOT NULL COMMENT '消息类型',
                                  `obj_id` varchar(50) NOT NULL COMMENT '关联业务id',
                                  `obj_name` varchar(100) DEFAULT NULL COMMENT '关联业务名称',
                                  `ack` tinyint NOT NULL COMMENT '消息ack',
                                  `sequence` int DEFAULT NULL COMMENT '消息序号',
                                  `properties` varchar(1000) DEFAULT NULL COMMENT '扩展类型',
                                  `create_time` bigint NOT NULL COMMENT '创建时间',
                                  `update_id` bigint DEFAULT NULL COMMENT '更新人',
                                  `update_time` bigint DEFAULT NULL COMMENT '更新时间',
                                  `timestamp` bigint NOT NULL COMMENT '时间戳',
                                  `create_id` bigint DEFAULT NULL COMMENT '创建人',
                                  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='mq消息';

-- ----------------------------
-- Table structure for t_s_auth
-- ----------------------------
DROP TABLE IF EXISTS `t_s_auth`;
CREATE TABLE `t_s_auth` (
                            `id` bigint NOT NULL COMMENT '主键',
                            `school_id` bigint NOT NULL COMMENT '学校id',
                            `access_key` varchar(255) DEFAULT NULL COMMENT 'accessKey',
                            `access_secret` varchar(255) DEFAULT NULL COMMENT 'accessSecret',
                            `description` text COMMENT '离线授权证书',
                            `type` varchar(16) NOT NULL COMMENT '授权类型',
                            `create_id` bigint DEFAULT NULL COMMENT '创建人',
                            `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                            `update_id` bigint DEFAULT NULL COMMENT '更新人',
                            `update_time` bigint DEFAULT NULL COMMENT '更新时间',
                            `expire_time` bigint DEFAULT NULL COMMENT '过期时间',
                            `file` mediumblob COMMENT '文件数据',
                            PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='激活授权配置表';

-- ----------------------------
-- Table structure for t_school_privilege
-- ----------------------------
DROP TABLE IF EXISTS `t_school_privilege`;
CREATE TABLE `t_school_privilege` (
                                      `id` bigint NOT NULL COMMENT '主键',
                                      `school_id` bigint NOT NULL COMMENT '学校id',
                                      `privilege_id` bigint NOT NULL COMMENT '菜单权限id',
                                      PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='学校菜单权限表';

-- ----------------------------
-- Table structure for t_sync_exam_student_score
-- ----------------------------
DROP TABLE IF EXISTS `t_sync_exam_student_score`;
CREATE TABLE `t_sync_exam_student_score` (
                                             `id` bigint NOT NULL COMMENT '主键',
                                             `school_id` bigint DEFAULT NULL COMMENT '学校id',
                                             `org_id` bigint DEFAULT NULL COMMENT '机构id',
                                             `semester_id` bigint DEFAULT NULL COMMENT '学期id',
                                             `major_name` varchar(100) DEFAULT NULL COMMENT '专业id',
                                             `clazz_id` bigint DEFAULT NULL COMMENT '班级id',
                                             `exam_id` bigint DEFAULT NULL COMMENT '云阅卷考试id',
                                             `exam_code` varchar(100) DEFAULT NULL COMMENT '云阅卷考试标识',
                                             `exam_number` varchar(100) DEFAULT NULL COMMENT '准考证号',
                                             `student_code` varchar(100) DEFAULT NULL COMMENT '学号',
                                             `name` varchar(100) NOT NULL COMMENT '姓名',
                                             `subject_code` varchar(100) DEFAULT NULL COMMENT '科目代码',
                                             `subject_name` varchar(100) DEFAULT NULL COMMENT '科目名称',
                                             `paper_type` varchar(50) DEFAULT NULL COMMENT '试卷类型',
                                             `college` varchar(100) DEFAULT NULL COMMENT '学院',
                                             `clazz_name` varchar(100) DEFAULT NULL COMMENT '班级',
                                             `teacher` varchar(100) DEFAULT NULL COMMENT '教师',
                                             `status` tinyint DEFAULT NULL COMMENT '考生状态，1-正常，2-缺考(包含未上传)，3-违纪',
                                             `sheet_urls` mediumtext COMMENT '原卷url',
                                             `local_sheet_urls` mediumtext COMMENT '从云阅卷下载下来的原图url',
                                             `total_score` double DEFAULT NULL COMMENT '总分',
                                             `objective_score` double DEFAULT NULL COMMENT '客观题分数',
                                             `subjective_score` double DEFAULT NULL COMMENT '主观题分数',
                                             `sync_data` mediumtext COMMENT '同步数据json',
                                             `trajectory_urls` varchar(500) DEFAULT NULL COMMENT '轨迹图地址',
                                             `create_id` bigint DEFAULT NULL COMMENT '创建人id',
                                             `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                                             PRIMARY KEY (`id`) USING BTREE,
                                             KEY `score_schoolId_idx` (`school_id`,`semester_id`,`org_id`,`major_name`,`clazz_id`,`student_code`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='同步考生成绩表';

-- ----------------------------
-- Table structure for teach_clazz
-- ----------------------------
DROP TABLE IF EXISTS `teach_clazz`;
CREATE TABLE `teach_clazz` (
                               `id` bigint NOT NULL COMMENT '教学班表主键',
                               `school_id` bigint NOT NULL COMMENT '学校id',
                               `teach_clazz_code` varchar(20) DEFAULT NULL COMMENT '教学班编号',
                               `teach_clazz_name` varchar(50) NOT NULL COMMENT '教学班名称',
                               `user_id` bigint NOT NULL COMMENT '用户id',
                               `teach_course_id` bigint NOT NULL COMMENT '教学课程主键',
                               `create_id` bigint DEFAULT NULL COMMENT '创建人',
                               `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                               `update_id` bigint DEFAULT NULL COMMENT '更新人',
                               `update_time` bigint DEFAULT NULL COMMENT '更新时间',
                               PRIMARY KEY (`id`),
                               UNIQUE KEY `teach_clazz_unique` (`school_id`,`teach_course_id`,`teach_clazz_name`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='教学班表';

-- ----------------------------
-- Table structure for teach_course
-- ----------------------------
DROP TABLE IF EXISTS `teach_course`;
CREATE TABLE `teach_course` (
                                `id` bigint NOT NULL,
                                `school_id` bigint NOT NULL COMMENT '学校id',
                                `basic_course_id` bigint NOT NULL COMMENT '基础课程id',
                                `user_id` bigint NOT NULL COMMENT '创建此教学课程的用户id',
                                `enable` tinyint(1) DEFAULT NULL COMMENT '是否删除',
                                `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 `teach_course_unique` (`school_id`,`basic_course_id`,`user_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='教学课程表';

-- ----------------------------
-- Table structure for teach_student
-- ----------------------------
DROP TABLE IF EXISTS `teach_student`;
CREATE TABLE `teach_student` (
                                 `id` bigint NOT NULL COMMENT '教学学生关系表主键',
                                 `school_id` bigint NOT NULL COMMENT '学校id',
                                 `student_id` bigint NOT NULL COMMENT '学生id',
                                 `teach_clazz_id` bigint NOT NULL COMMENT '教学班级id',
                                 `teach_course_id` bigint NOT NULL COMMENT '教学课程id（冗余）',
                                 `user_id` bigint NOT NULL COMMENT '用户id（冗余）',
                                 `create_id` bigint DEFAULT NULL COMMENT '创建人',
                                 `create_time` bigint DEFAULT NULL COMMENT '创建时间',
                                 `update_id` bigint DEFAULT NULL COMMENT '更新人',
                                 `update_time` bigint DEFAULT NULL COMMENT '更新时间',
                                 PRIMARY KEY (`id`),
                                 UNIQUE KEY `teach_student_unique` (`school_id`,`student_id`,`teach_clazz_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='教学学生关系表';