/*
 Navicat Premium Data Transfer

 Source Server         : t470
 Source Server Type    : MySQL
 Source Server Version : 50717
 Source Host           : localhost:3306
 Source Schema         : tc_print_2

 Target Server Type    : MySQL
 Target Server Version : 50717
 File Encoding         : 65001

 Date: 01/04/2021 09:02:07
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for basic_attachment
-- ----------------------------
DROP TABLE IF EXISTS `basic_attachment`;
CREATE TABLE basic_attachment
(
	id BIGINT AUTO_INCREMENT PRIMARY KEY NOT NULL,
	name VARCHAR(100)
		COMMENT '文件名' NOT NULL,
	type VARCHAR(10)
		COMMENT '文件类型' NOT NULL,
	size INTEGER
		COMMENT '单位（KB）' NOT NULL,
	md5 VARCHAR(32)
		COMMENT '文件md5值' NOT NULL,
	path VARCHAR(2000)
		COMMENT '存储路径' NOT NULL,
	create_id BIGINT
		COMMENT '创建人' NULL,
	create_time BIGINT
		COMMENT '创建时间' NULL,
	obj_id BIGINT
		COMMENT '关联业务id' NULL
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='所有附件记录表';

/* Add Comments */
ALTER TABLE basic_attachment COMMENT = '所有附件记录表';
-- ----------------------------
-- Table structure for basic_card_rule
-- ----------------------------
DROP TABLE IF EXISTS `basic_card_rule`;
CREATE TABLE `basic_card_rule`  (
  `id` bigint(10) NOT NULL AUTO_INCREMENT,
  `school_id` bigint(10) NOT NULL,
  `name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '题卡规则名称',
  `exam_number_style` varchar(5) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'PRINT-印刷条码，PASTE-粘贴条码，FILL-卡号填涂',
  `paper_type` varchar(5) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'PRINT-印刷条码，FILL-卡号填涂',
  `exam_absent` tinyint(1) NOT NULL COMMENT '0-禁用，1-启用',
  `write_sign` tinyint(1) NOT NULL COMMENT '0-禁用，1-启用',
  `required_fields` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '必选字段',
  `extend_fields` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '扩展字段',
  `title_rule` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '题卡标题规则',
  `attention` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '注意事项',
  `objective_attention` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '客观题注意事项',
  `subjective_attention` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '主观题注意事项',
  `enable` tinyint(1) NOT NULL COMMENT '0-禁用，1-启用',
  `remark` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `create_id` bigint(10) NULL DEFAULT NULL,
  `create_time` bigint(13) NULL DEFAULT NULL,
  `update_id` bigint(10) NULL DEFAULT NULL,
  `update_time` bigint(13) NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '题卡规则' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for basic_course
-- ----------------------------
DROP TABLE IF EXISTS `basic_course`;
CREATE TABLE `basic_course`  (
  `id` bigint(10) NOT NULL AUTO_INCREMENT,
  `school_id` bigint(10) NOT NULL COMMENT '学校ID',
  `code` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '课程编码',
  `name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '课程名称',
  `create_id` bigint(10) NULL DEFAULT NULL COMMENT '创建人',
  `create_time` bigint(13) NULL DEFAULT NULL COMMENT '创建时间',
  `update_id` bigint(10) NULL DEFAULT NULL COMMENT '修改人',
  `update_time` bigint(13) NULL DEFAULT NULL COMMENT '修改时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '课程表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for basic_exam_rule
-- ----------------------------
DROP TABLE IF EXISTS `basic_exam_rule`;
CREATE TABLE `basic_exam_rule`  (
  `id` bigint(10) NOT NULL AUTO_INCREMENT,
  `school_id` bigint(10) NOT NULL,
  `required_fields` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '必选字段',
  `extend_fields` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '扩展字段',
  `review` tinyint(1) NOT NULL COMMENT '0-禁用，1-启用',
  `include_paper` tinyint(1) NOT NULL COMMENT '0-禁用，1-启用',
  `custom_card` tinyint(1) NOT NULL COMMENT '0-禁用，1-启用',
  `print_method` varchar(6) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'AUTO-自动，MANUAL-手动',
  `create_id` bigint(10) NULL DEFAULT NULL,
  `create_time` bigint(13) NULL DEFAULT NULL,
  `update_id` bigint(10) NULL DEFAULT NULL,
  `update_time` bigint(13) NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '考务规则' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for basic_school
-- ----------------------------
DROP TABLE IF EXISTS `basic_school`;
CREATE TABLE `basic_school`  (
  `id` bigint(10) NOT NULL AUTO_INCREMENT,
  `code` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
  `enable` tinyint(1) NOT NULL,
  `access_key` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
  `access_secret` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
  `remark` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL,
  `create_id` bigint(10) NULL DEFAULT NULL,
  `create_time` bigint(13) NULL DEFAULT NULL,
  `update_id` bigint(10) NULL DEFAULT NULL,
  `update_time` bigint(13) NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '学校表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for basic_template
-- ----------------------------
DROP TABLE IF EXISTS `basic_template`;
CREATE TABLE `basic_template`  (
  `id` bigint(10) NOT NULL AUTO_INCREMENT,
  `school_id` bigint(10) NOT NULL,
  `name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '模板名称',
  `type` varchar(8) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '模板类型：GENERIC-通卡模板，VARIABLE-变量印品模板，ORDINARY-普通印品模板',
  `classify` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'template_type值为VARIABLE、ORDINARY时，不为空。\r\n            SIGN-签到表，PACKAGE-卷袋贴，CHECK_IN-登记表',
  `attachment_id` bigint(10) NOT NULL COMMENT '模板附件ID（保存到附件表ID）',
  `enable` tinyint(1) NOT NULL COMMENT '0-禁用，1-启用',
  `remark` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `create_id` bigint(10) NULL DEFAULT NULL,
  `create_time` bigint(13) NULL DEFAULT NULL,
  `update_id` bigint(10) NULL DEFAULT NULL,
  `update_time` bigint(13) NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '通用模板' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for basic_template_org
-- ----------------------------
DROP TABLE IF EXISTS `basic_template_org`;
CREATE TABLE `basic_template_org`  (
  `id` bigint(10) NOT NULL AUTO_INCREMENT,
  `type` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '模板类型：GENERIC-通卡模板，VARIABLE-变量印品模板，ORDINARY-普通印品模板，CARD_RULE-题卡规则',
  `rule_id` bigint(10) NOT NULL COMMENT '通卡模板ID',
  `org_id` bigint(10) NOT NULL COMMENT '组织机构ID',
  `create_id` bigint(10) NULL DEFAULT NULL,
  `create_time` bigint(13) NULL DEFAULT NULL,
  `update_id` bigint(10) NULL DEFAULT NULL,
  `update_time` bigint(13) NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 24 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '适用学院（题卡规则、模板适用学院）' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for basic_user_course
-- ----------------------------
DROP TABLE IF EXISTS `basic_user_course`;
CREATE TABLE `basic_user_course`  (
  `id` bigint(10) NOT NULL AUTO_INCREMENT,
  `user_id` bigint(10) NULL DEFAULT NULL COMMENT '用户ID',
  `course_id` bigint(10) NULL DEFAULT NULL COMMENT '课程ID',
  `create_id` bigint(10) NULL DEFAULT NULL,
  `create_time` bigint(13) NULL DEFAULT NULL,
  `update_id` bigint(10) NULL DEFAULT NULL,
  `update_time` bigint(13) NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户和课程关联表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for basic_verify_code
-- ----------------------------
DROP TABLE IF EXISTS `basic_verify_code`;
CREATE TABLE `basic_verify_code`  (
  `id` bigint(10) NOT NULL AUTO_INCREMENT,
  `user_id` bigint(10) NOT NULL COMMENT '用户ID',
  `mobile_number` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '手机号',
  `expire_time` bigint(13) NOT NULL COMMENT '到期时间',
  `valid_period` int(11) NOT NULL COMMENT '单位（分）',
  `verify_code` varchar(4) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '4位数字',
  `create_id` bigint(10) NULL DEFAULT NULL,
  `create_time` bigint(13) NULL DEFAULT NULL,
  `update_id` bigint(10) NULL DEFAULT NULL,
  `update_time` bigint(13) NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '短信验证码记录表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for exam_card
-- ----------------------------
DROP TABLE IF EXISTS `exam_card`;
CREATE TABLE `exam_card`  (
  `id` bigint(10) NOT NULL AUTO_INCREMENT,
  `school_id` bigint(10) NOT NULL,
  `course_code` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '课程编码',
  `course_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '课程名称',
  `title` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '标题',
  `make_method` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '题卡制作方式：SELECT-选择已有题卡，SELF-自助创建，CUST-客户制卡',
  `create_id` bigint(10) NULL DEFAULT NULL,
  `create_time` bigint(13) NULL DEFAULT NULL COMMENT '创建时间',
  `update_id` bigint(10) NULL DEFAULT NULL,
  `update_time` bigint(13) NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '题卡' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for exam_card_detail
-- ----------------------------
DROP TABLE IF EXISTS `exam_card_detail`;
CREATE TABLE `exam_card_detail`  (
  `id` bigint(10) NOT NULL AUTO_INCREMENT,
  `card_id` bigint(10) NOT NULL COMMENT '题卡ID',
  `content` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL,
  `html_content` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL,
  `attachment_id` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL,
  `create_id` bigint(10) NULL DEFAULT NULL,
  `create_time` bigint(13) NULL DEFAULT NULL,
  `update_id` bigint(10) NULL DEFAULT NULL,
  `update_time` bigint(13) NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '题卡详情' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for exam_detail
-- ----------------------------
DROP TABLE IF EXISTS `exam_detail`;
CREATE TABLE `exam_detail`  (
  `id` bigint(10) NOT NULL AUTO_INCREMENT,
  `school_id` bigint(10) NOT NULL,
  `print_plan_id` bigint(10) NOT NULL COMMENT '印刷计划ID',
  `print_plan_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
  `exam_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '考试计划名称',
  `exam_start_time` bigint(13) NOT NULL COMMENT '考试日期',
  `exam_end_time` bigint(13) NOT NULL,
  `exam_place` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `total_subjects` int(11) NULL DEFAULT NULL COMMENT '总科次：考场总科次',
  `exam_room` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
  `print_progress` double NULL DEFAULT NULL,
  `print_user` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '打印员：一个考场只能被一个打印员认领',
  `package_code` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '考场代码：卷袋贴、签到表上条码',
  `create_id` bigint(10) NULL DEFAULT NULL,
  `create_time` bigint(13) NULL DEFAULT NULL,
  `update_id` bigint(10) NULL DEFAULT NULL,
  `update_time` bigint(13) NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '考务数据' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for exam_detail_course
-- ----------------------------
DROP TABLE IF EXISTS `exam_detail_course`;
CREATE TABLE `exam_detail_course`  (
  `id` bigint(10) NOT NULL AUTO_INCREMENT,
  `school_id` bigint(10) NOT NULL,
  `exam_detail_id` bigint(10) NOT NULL,
  `course_code` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `course_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `paper_number` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `create_id` bigint(10) NULL DEFAULT NULL,
  `create_time` bigint(13) NULL DEFAULT NULL,
  `update_id` bigint(10) NULL DEFAULT NULL,
  `update_time` bigint(13) NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '考务数据（考场关联科目）' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for exam_print_plan
-- ----------------------------
DROP TABLE IF EXISTS `exam_print_plan`;
CREATE TABLE `exam_print_plan`  (
  `id` bigint(10) NOT NULL AUTO_INCREMENT,
  `school_id` bigint(10) NOT NULL,
  `name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '印刷计划名称',
  `exam_start_time` bigint(13) NOT NULL COMMENT '考试开始时间',
  `exam_end_time` bigint(13) NOT NULL COMMENT '考试结束时间',
  `print_content` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '{“PAPER”, \"CARD\"}',
  `backup_method` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'PLACE-按考点，ROOM-按考场',
  `backup_count` int(11) NOT NULL,
  `draw_rule` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'ONE-只抽一次，CIRCLE-可循环抽取',
  `variable_content` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '[\r\n            	{\r\n            		\"type\": \"SIGN\",\r\n            		\"usedId\": 1,\r\n            		\"backupMethod\": \"ROOM\",\r\n            		\"backupCount\": 3\r\n            	},\r\n            	{\r\n            		\"type\": \"PACKAG\",\r\n            		\"usedId\": 3,\r\n            		\"backupMethod\": \"STUDENT\",\r\n            		\"backupCount\": 5\r\n            	}\r\n            ]',
  `ordinary_content` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '[\r\n            	{\r\n            		\"type\": \"CHECK_IN\",\r\n            		\"usedId\": 1,\r\n            		\"backupMethod\": \"ROOM\",\r\n            		\"backupCount\": 3\r\n            	}\r\n            ]',
  `status` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
  `create_id` bigint(10) NULL DEFAULT NULL,
  `create_time` bigint(13) NULL DEFAULT NULL,
  `update_id` bigint(10) NULL DEFAULT NULL,
  `update_time` bigint(13) NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '印刷计划管理' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for exam_student
-- ----------------------------
DROP TABLE IF EXISTS `exam_student`;
CREATE TABLE `exam_student`  (
  `id` bigint(10) NOT NULL AUTO_INCREMENT,
  `school_id` bigint(10) NOT NULL,
  `exam_detail_course_id` bigint(10) NOT NULL,
  `student_name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `student_code` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `ticket_number` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
  `site_number` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
  `print_paper` tinyint(1) NULL DEFAULT NULL,
  `print_card` tinyint(1) NULL DEFAULT NULL,
  `extend_fields` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL,
  `paper_type` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
  `create_id` bigint(10) NULL DEFAULT NULL,
  `create_time` bigint(13) NULL DEFAULT NULL,
  `update_id` bigint(10) NULL DEFAULT NULL,
  `update_time` bigint(13) NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '考生' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for exam_task
-- ----------------------------
DROP TABLE IF EXISTS `exam_task`;
CREATE TABLE `exam_task`  (
  `id` bigint(10) NOT NULL AUTO_INCREMENT,
  `school_id` bigint(10) NOT NULL,
  `course_code` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '课程代码',
  `course_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '课程名称',
  `specialty` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '适用专业',
  `paper_number` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '试卷编号',
  `start_time` datetime(0) NOT NULL COMMENT '命题开始时间',
  `end_time` datetime(0) NOT NULL COMMENT '命题结束时间',
  `card_rule_id` bigint(10) NOT NULL COMMENT '题卡规则',
  `user_id` bigint(10) NULL DEFAULT NULL COMMENT '命题老师',
  `status` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'NEW-新建任务，STAGE-暂存（命题中），SUBMIT-确认提交，CANCEL-撤回',
  `review_status` varchar(8) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '审核状态：PASS-审核通过，NOT_PASS-审核不通过，默认为空-未审核',
  `enable` tinyint(1) NULL DEFAULT NULL COMMENT '0-禁用，1-启用',
  `batch_no` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
  `create_id` bigint(10) NULL DEFAULT NULL COMMENT '创建人',
  `create_time` bigint(13) NULL DEFAULT NULL COMMENT '创建时间',
  `update_id` bigint(10) NULL DEFAULT NULL COMMENT '修改人',
  `update_time` bigint(13) NULL DEFAULT NULL COMMENT '修改时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '命题任务' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for exam_task_detail
-- ----------------------------
DROP TABLE IF EXISTS `exam_task_detail`;
CREATE TABLE `exam_task_detail`  (
  `id` bigint(10) NOT NULL AUTO_INCREMENT,
  `exam_task_id` bigint(10) NOT NULL COMMENT '命题任务ID',
  `paper_type` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '试卷类型，多个以”/“分隔，如A/B/C/D',
  `paper_attachment_ids` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '[\r\n            	{\r\n            		\"type\": \"A\",\r\n            		\"attachmentId\": 12,\r\n            		\"totalPages\": 3\r\n            	},\r\n            	{\r\n            		\"type\": \"B\",\r\n            		\"attachmentId\": 13,\r\n            		\"totalPages\": 2\r\n            	}\r\n            ]',
  `card_id` bigint(10) NULL DEFAULT NULL COMMENT '题卡ID',
  `paper_confirm_attachment_ids` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '[\r\n            	{\r\n            		\"attachmentId\": 12\r\n            	},\r\n            	{\r\n            		\"attachmentId\": 13\r\n            	}\r\n            ]',
  `remark` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `exposed_paper_type` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '曝光卷型：已打印卷型，多个以”/“分隔，如A/B/C/D',
  `relate_paper_type` varchar(5) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
  `unexposed_paper_type` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
  `create_id` bigint(10) NULL DEFAULT NULL,
  `create_time` bigint(13) NULL DEFAULT NULL,
  `update_id` bigint(10) NULL DEFAULT NULL,
  `update_time` bigint(13) NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '命题任务明细表（入库申请）' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for exam_task_review_log
-- ----------------------------
DROP TABLE IF EXISTS `exam_task_review_log`;
CREATE TABLE `exam_task_review_log`  (
  `id` bigint(10) NOT NULL AUTO_INCREMENT,
  `exam_task_id` bigint(10) NOT NULL COMMENT '命题任务ID',
  `review_status` varchar(8) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'PASS-通过，NOT_PASS-不通过',
  `reason` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '审核意见',
  `operate_id` bigint(10) NULL DEFAULT NULL,
  `operate_time` bigint(13) NULL DEFAULT NULL,
  `create_id` bigint(10) NULL DEFAULT NULL,
  `create_time` bigint(13) NULL DEFAULT NULL,
  `update_id` bigint(10) NULL DEFAULT NULL,
  `update_time` bigint(13) NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '命题任务审核日志表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for exam_task_temp
-- ----------------------------
DROP TABLE IF EXISTS `exam_task_temp`;
CREATE TABLE `exam_task_temp`  (
  `id` bigint(10) NOT NULL AUTO_INCREMENT,
  `school_id` bigint(10) NOT NULL,
  `batch_no` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '本次导入数据临时ID',
  `course_code` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '课程代码',
  `course_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '课程名称',
  `paper_number` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '试卷编号',
  `specialty` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '适用专业',
  `create_id` bigint(10) NULL DEFAULT NULL,
  `create_time` bigint(13) NULL DEFAULT NULL,
  `update_id` bigint(10) NULL DEFAULT NULL,
  `update_time` bigint(13) NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '命题任务临时表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for sys_config
-- ----------------------------
DROP TABLE IF EXISTS `sys_config`;
CREATE TABLE `sys_config`  (
  `id` bigint(10) NOT NULL AUTO_INCREMENT,
  `config_key` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '参数键名',
  `config_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '参数名称',
  `config_value` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '参数键值',
  `remark` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
  `create_id` bigint(10) NULL DEFAULT NULL,
  `create_time` bigint(10) NULL DEFAULT NULL,
  `update_id` bigint(10) NULL DEFAULT NULL,
  `update_time` bigint(13) NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '参数表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for sys_org
-- ----------------------------
DROP TABLE IF EXISTS `sys_org`;
CREATE TABLE `sys_org`  (
  `id` bigint(10) NOT NULL AUTO_INCREMENT,
  `school_id` bigint(10) NOT NULL COMMENT '学校ID',
  `code` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '机构代码',
  `name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '机构名称',
  `parent_id` bigint(10) NULL DEFAULT NULL COMMENT '上级机构ID',
  `enable` tinyint(1) NOT NULL COMMENT '0-禁用，1-启用',
  `create_id` bigint(1) NULL DEFAULT NULL COMMENT '创建人',
  `create_time` bigint(13) NULL DEFAULT NULL COMMENT '创建时间',
  `update_id` bigint(10) NULL DEFAULT NULL COMMENT '修改人',
  `update_time` bigint(13) NULL DEFAULT NULL COMMENT '修改时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '学校组织架构' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for sys_privilege
-- ----------------------------
DROP TABLE IF EXISTS `sys_privilege`;
CREATE TABLE sys_privilege
(
	id BIGINT AUTO_INCREMENT PRIMARY KEY NOT NULL,
	name VARCHAR(100)
		COMMENT '菜单名称' NOT NULL,
	url VARCHAR(100)
		COMMENT 'URL地址' NOT NULL,
	type VARCHAR(50)
		COMMENT '类型，MENU：菜单，BUTTON：按钮，LINK：链接，URL：接口地址，LIST：列表，CONDITION：查询条件' NOT NULL,
	parent_id BIGINT
		COMMENT '上级菜单' NULL,
	sequence INTEGER
		COMMENT '序号' NOT NULL,
	property VARCHAR(30)
		COMMENT '属性，NO_AUTH：无需鉴权，AUTH：鉴权，SYS：系统公用' NULL,
	remark VARCHAR(200)
		COMMENT '备注' NULL,
	create_time BIGINT NULL,
	enable TINYINT DEFAULT 1
		COMMENT '是否启用，false：停用，true：启用' NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='菜单权限表';

/* Add Comments */
ALTER TABLE sys_privilege COMMENT = '菜单权限表';

-- ----------------------------
-- Table structure for sys_role
-- ----------------------------
DROP TABLE IF EXISTS `sys_role`;
CREATE TABLE `sys_role`  (
  `id` bigint(10) NOT NULL AUTO_INCREMENT,
  `school_id` bigint(10) NOT NULL COMMENT '学校ID',
  `name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '角色名称',
  `enable` tinyint(1) NOT NULL COMMENT '是否启用',
  `type` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'INTERNAL-内置，CUSTOM-自定义',
  `create_id` bigint(10) NULL DEFAULT NULL COMMENT '创建人',
  `create_time` bigint(13) NULL DEFAULT NULL COMMENT '创建时间',
  `update_id` bigint(10) NULL DEFAULT NULL COMMENT '修改人',
  `update_time` bigint(13) NULL DEFAULT NULL COMMENT '修改时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '角色表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for sys_role_course
-- ----------------------------
DROP TABLE IF EXISTS `sys_role_course`;
CREATE TABLE `sys_role_course`  (
  `id` bigint(10) NOT NULL AUTO_INCREMENT,
  `role_id` bigint(10) NOT NULL,
  `course_id` bigint(10) NOT NULL,
  `create_id` bigint(10) NULL DEFAULT NULL,
  `create_time` bigint(13) NULL DEFAULT NULL,
  `update_id` bigint(10) NULL DEFAULT NULL,
  `update_time` bigint(13) NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '角色关联课程' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for sys_role_privilege
-- ----------------------------
DROP TABLE IF EXISTS `sys_role_privilege`;
CREATE TABLE sys_role_privilege
(
	id BIGINT AUTO_INCREMENT PRIMARY KEY NOT NULL,
	role_id BIGINT
		COMMENT '角色ID' NOT NULL,
	privilege_id BIGINT
		COMMENT '菜单ID' NOT NULL,
	enable TINYINT DEFAULT 1
		COMMENT '是否禁用，false：禁用，true：启用' NULL
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='角色和菜单关联表';

/* Add Comments */
ALTER TABLE sys_role_privilege COMMENT = '角色和菜单关联表';

-- ----------------------------
-- Table structure for sys_user
-- ----------------------------
DROP TABLE IF EXISTS `sys_user`;
CREATE TABLE `sys_user`  (
  `id` bigint(10) NOT NULL AUTO_INCREMENT,
  `school_id` bigint(10) NOT NULL COMMENT '学校ID',
  `login_name` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户名',
  `real_name` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '姓名',
  `password` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '密码',
  `mobile_number` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '手机号',
  `org_id` bigint(10) NULL DEFAULT NULL,
  `enable` tinyint(1) NOT NULL COMMENT '0-禁用，1-启用',
  `pwd_update_time` bigint(13) NULL DEFAULT NULL COMMENT '密码修改时间',
  `remark` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `create_id` bigint(10) NULL DEFAULT NULL COMMENT '创建人',
  `create_time` bigint(13) NULL DEFAULT NULL COMMENT '创建时间',
  `update_id` bigint(10) NULL DEFAULT NULL,
  `update_time` bigint(13) NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for sys_user_role
-- ----------------------------
DROP TABLE IF EXISTS `sys_user_role`;
CREATE TABLE sys_user_role
(
	id BIGINT AUTO_INCREMENT PRIMARY KEY NOT NULL,
	user_id BIGINT
		COMMENT '用户ID' NOT NULL,
	role_id BIGINT
		COMMENT '角色ID' NOT NULL,
	privilege_id BIGINT
		COMMENT '权限id' NOT NULL,
	enable TINYINT DEFAULT 1
		COMMENT '是否禁用，false：禁用，true：启用' NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='用户和角色关联表';

/* Add Comments */
ALTER TABLE sys_user_role COMMENT = '用户和角色关联表';
SET FOREIGN_KEY_CHECKS = 1;
