USE stmms_ms;

-- ----------------------------
-- Table structure for attachment
-- ----------------------------
CREATE TABLE IF NOT EXISTS `attachment`  (
    `id` bigint(64) NOT NULL AUTO_INCREMENT,
    `work_id` bigint(20) NULL DEFAULT NULL,
    `subject` varchar(10) NULL DEFAULT NULL,
    `exam_number` varchar(20) NULL DEFAULT NULL,
    `file_path_local` varchar(512) NOT NULL,
    `file_name` varchar(128) NOT NULL,
    `file_type` varchar(8) NULL DEFAULT NULL,
    `file_ext` varchar(16) NULL DEFAULT NULL,
    `bucket` varchar(64) NOT NULL,
    `object_key` varchar(128) NOT NULL,
    `oss_name` varchar(500) NOT NULL,
    `oss_status` varchar(20) NOT NULL,
    `oss_fail_msg` varchar(500) NULL DEFAULT NULL COMMENT '上传oss失败原因',
    `delete_status` varchar(20) NULL DEFAULT NULL,
    `time` datetime(0) NOT NULL,
    PRIMARY KEY (`id`) USING BTREE
    ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4;

-- ----------------------------
-- Table structure for change_level
-- ----------------------------
CREATE TABLE IF NOT EXISTS `change_level`  (
    `id` bigint(20) NOT NULL AUTO_INCREMENT,
    `work_id` bigint(20) NULL DEFAULT NULL,
    `subject` varchar(50) NULL DEFAULT NULL,
    `stage` int(2) NULL DEFAULT NULL COMMENT '阶段',
    `paper_id` bigint(20) NULL DEFAULT NULL,
    `original_level` varchar(45) NULL DEFAULT NULL COMMENT '原档位',
    `audit_status` int(1) NULL DEFAULT NULL COMMENT '改档审核：0-申请，1-同意，2-不同意',
    `paper_check_id` BIGINT(20) NULL COMMENT '试卷抽查任务ID（role=‘MARK_LEADER’时，默认为’-1’）',
    `create_id` bigint(20) NULL DEFAULT NULL COMMENT '申请改档用户id',
    `create_date` datetime(0) NULL DEFAULT NULL COMMENT '申请改档时间',
    `audit_id` bigint(20) NULL DEFAULT NULL COMMENT '审核用户id',
    `role` VARCHAR(45) NULL DEFAULT 'MARK_LEADER' COMMENT '操作员角色，MARK_LEADER-科组长，INSPECTION-纪检',
    `audit_date` datetime(0) NULL DEFAULT NULL COMMENT '审核时间',
    `suggest_level` varchar(255) NULL DEFAULT NULL,
    `is_curr` int(11) NULL DEFAULT NULL,
    PRIMARY KEY (`id`) USING BTREE
    ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COMMENT = '改档记录表';

-- ----------------------------
-- Table structure for change_level_task
-- ----------------------------
CREATE TABLE `change_level_task` (
     `id` BIGINT(20) NOT NULL AUTO_INCREMENT,
     `work_id` BIGINT(20) NOT NULL COMMENT '工作ID',
     `change_level_id` BIGINT(20) NULL COMMENT '改档数据ID',
     `question_id` BIGINT(20) NOT NULL COMMENT '考区ID',
     `paper_id` BIGINT(20) NOT NULL COMMENT '试卷ID',
     `subject` VARCHAR(45) NOT NULL COMMENT '科目',
     `stage` INT NOT NULL COMMENT '阶段',
     `marker_id` BIGINT(20) NULL COMMENT '评卷员ID',
     `marker_name` VARCHAR(45) NULL COMMENT '评卷员姓名',
     `secret_number` VARCHAR(45) NULL COMMENT '密号',
     `result` VARCHAR(3) NULL COMMENT '改档档位（纪检员同意后）',
     `is_mark` TINYINT(1) NULL DEFAULT 0 COMMENT '是否标记',
     `confirm_change_stage` TINYINT(1) NULL COMMENT '是否确认改档',
     `confirm_on` DATETIME NULL COMMENT '确认时间',
     `created_on` DATETIME NULL COMMENT '创建时间',
     PRIMARY KEY (`id`))
    COMMENT = '改档评卷员确认任务表';

-- ----------------------------
-- Table structure for check_data
-- ----------------------------
CREATE TABLE IF NOT EXISTS `check_data`  (
    `id` bigint(20) NOT NULL AUTO_INCREMENT,
    `work_id` bigint(20) NULL DEFAULT NULL COMMENT '工作ID',
    `check_item` varchar(45) NULL DEFAULT NULL COMMENT '数据校验类型',
    `param_value` int(3) NULL DEFAULT NULL COMMENT '变量值',
    `status` varchar(45) NULL DEFAULT NULL,
    `result` tinyint(1) NULL DEFAULT NULL COMMENT '是否校验通过（1：是，0：否）',
    `error_count` int(7) NULL DEFAULT 0 COMMENT '未通过数量（result=0时，数量大于0）',
    `content` varchar(200) NULL DEFAULT NULL COMMENT '校验不通过考生列表',
    `start_time` datetime(0) NULL DEFAULT NULL COMMENT '开始时间',
    `end_time` datetime(0) NULL DEFAULT NULL COMMENT '结束时间',
    PRIMARY KEY (`id`) USING BTREE
    ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COMMENT = '数据校验日志';

-- ----------------------------
-- Table structure for check_data_error
-- ----------------------------
CREATE TABLE IF NOT EXISTS `check_data_error`  (
    `id` bigint(20) NOT NULL AUTO_INCREMENT,
    `check_data_id` bigint(20) NULL DEFAULT NULL,
    `exam_number` varchar(45) NULL DEFAULT NULL COMMENT '考号',
    `student_name` varchar(100) NULL DEFAULT NULL,
    `error_message` varchar(1000) NULL DEFAULT NULL COMMENT '错误信息',
    PRIMARY KEY (`id`) USING BTREE,
    INDEX `idx_check_data_id`(`check_data_id`) USING BTREE
    ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COMMENT = '数据校验错误数据';

-- ----------------------------
-- Table structure for exam_question
-- ----------------------------
CREATE TABLE IF NOT EXISTS `exam_question`  (
    `id` bigint(20) NOT NULL AUTO_INCREMENT,
    `area_code` varchar(255) NOT NULL,
    `area_name` varchar(255) NULL DEFAULT NULL,
    `name` varchar(255) NOT NULL,
    `subject` varchar(50) NOT NULL,
    `work_id` bigint(20) NOT NULL,
    `is_test` tinyint(4) NOT NULL DEFAULT 0 COMMENT '是否试评,0:不是，1:数据已导入，2:试评中',
    PRIMARY KEY (`id`) USING BTREE
    ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4;

-- ----------------------------
-- Table structure for exam_score_prop
-- ----------------------------
CREATE TABLE IF NOT EXISTS `exam_score_prop`  (
    `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
    `subject` varchar(50) NULL DEFAULT NULL COMMENT '科目',
    `exclude` varchar(100) NULL DEFAULT NULL COMMENT '打分阶段配置过滤档位(可选一个或多个档位，多个档位用\",\"号隔开)',
    `task_sort` varchar(50) NULL DEFAULT NULL COMMENT '打分阶段配置档位排序规则(可选random/paper，为paper时，score.level.exclude置为空)',
    `enable` bit(1) NULL DEFAULT b'0' COMMENT '打分阶段配置是否启用(为false则不启用打分阶段分档)，0：不启用，1：启用',
    `work_id` bigint(20) NULL DEFAULT NULL COMMENT '工作区id',
    PRIMARY KEY (`id`) USING BTREE
    ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COMMENT = '考试打分配置';

-- ----------------------------
-- Table structure for inspect_range
-- ----------------------------
CREATE TABLE IF NOT EXISTS `inspect_range`  (
    `id` bigint(20) NOT NULL AUTO_INCREMENT,
    `condition` int(11) NULL DEFAULT NULL,
    `enabled` bit(1) NULL DEFAULT NULL,
    `student_count` int(11) NULL DEFAULT NULL,
    `type` varchar(255) NULL DEFAULT NULL,
    `work_id` bigint(20) NULL DEFAULT NULL,
    `active` bit(1) NOT NULL,
    `editable` bit(1) NOT NULL,
    PRIMARY KEY (`id`) USING BTREE
    ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4;

-- ----------------------------
-- Table structure for inspect_student
-- ----------------------------
CREATE TABLE IF NOT EXISTS `inspect_student`  (
    `id` bigint(20) NOT NULL AUTO_INCREMENT,
    `exam_number` varchar(255) NOT NULL,
    `inspect_range_id` bigint(20) NOT NULL,
    PRIMARY KEY (`id`) USING BTREE
    ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4;

-- ----------------------------
-- Table structure for inspect_task
-- ----------------------------
CREATE TABLE IF NOT EXISTS `inspect_task`  (
    `id` bigint(20) NOT NULL AUTO_INCREMENT,
    `created_on` datetime(0) NULL DEFAULT NULL,
    `inspect_range_id` bigint(20) NOT NULL,
    `marker_id` bigint(20) NOT NULL,
    `marker_name` varchar(50) NOT NULL,
    `question_id` bigint(20) NULL DEFAULT NULL,
    `subject` varchar(50) NULL DEFAULT NULL,
    `updated_on` datetime(0) NULL DEFAULT NULL,
    `work_id` bigint(20) NOT NULL,
    `paper_id` bigint(20) NOT NULL,
    `level` varchar(255) NULL DEFAULT NULL,
    `score` int(11) NULL DEFAULT NULL,
    PRIMARY KEY (`id`) USING BTREE,
    INDEX `FK4e9mfahf522t4ej4y4yd065dh`(`paper_id`) USING BTREE
    ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4;

-- ----------------------------
-- Table structure for level
-- ----------------------------
CREATE TABLE IF NOT EXISTS `level`  (
    `id` bigint(20) NOT NULL AUTO_INCREMENT,
    `code` varchar(50) NOT NULL,
    `interval_score` int(11) NOT NULL,
    `level_type` int(11) NULL DEFAULT NULL,
    `level_value` int(11) NOT NULL,
    `max_score` int(11) NOT NULL,
    `min_score` int(11) NOT NULL,
    `pt` int(11) NOT NULL,
    `score_list` varchar(255) NULL DEFAULT NULL,
    `weight` int(11) NOT NULL,
    `work_id` bigint(20) NULL DEFAULT NULL,
    `kdpt` int(11) NOT NULL,
    `rough_code` varchar(2) NULL DEFAULT NULL COMMENT '粗分档档位',
    `rough_weight` int(11) NULL DEFAULT NULL COMMENT '粗分档典型值',
    PRIMARY KEY (`id`) USING BTREE,
    UNIQUE INDEX `idx_level_workId_code`(`work_id`, `code`) USING BTREE
    ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4;

-- ----------------------------
-- Table structure for mark_log
-- ----------------------------
CREATE TABLE IF NOT EXISTS `mark_log`  (
    `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
    `create_user_id` bigint(20) NULL DEFAULT NULL COMMENT '操作人id',
    `create_user_name` varchar(100) NULL DEFAULT NULL COMMENT '操作人名字',
    `create_role` varchar(50) NULL DEFAULT NULL COMMENT '操作人角色',
    `subject` varchar(50) NULL DEFAULT NULL COMMENT '科目',
    `exam_number` varchar(50) NULL DEFAULT NULL COMMENT '准考证号',
    `student_name` varchar(100) NULL DEFAULT NULL COMMENT '学生姓名',
    `login_time` datetime(0) NULL DEFAULT NULL COMMENT '登录时间（采集专用）',
    `logout_time` datetime(0) NULL DEFAULT NULL COMMENT '登出时间（采集专用）',
    `oper_type` int(11) NULL DEFAULT NULL COMMENT '操作类型，1：分档，2：打分，3：回评档位，4：回评分数，5：档位打回，6：档位打回回评，7：一键定档，8：标准卷设置',
    `oper_name` varchar(100) NULL DEFAULT NULL,
    `oper_data_before` varchar(255) NULL DEFAULT NULL COMMENT '操作前数据',
    `oper_data_after` varchar(255) NULL DEFAULT NULL COMMENT '操作后数据',
    `create_time` datetime(0) NULL DEFAULT NULL COMMENT '操作时间',
    `work_id` bigint(20) NULL DEFAULT NULL COMMENT '考区id',
    `paper_id` bigint(20) NULL DEFAULT NULL COMMENT '试卷id',
    `remark` varchar(500) NULL DEFAULT NULL COMMENT '备注',
    `test` int(4) NULL DEFAULT 0,
    `stage` int(1) NULL DEFAULT NULL COMMENT '试卷阶段，0：初始，1：分档，2：打分',
    `work_name` varchar(255) NULL DEFAULT NULL,
    `stage_name` varchar(255) NULL DEFAULT NULL,
    PRIMARY KEY (`id`) USING BTREE,
    INDEX `union_001_index`(`create_user_id`, `oper_type`, `subject`, `exam_number`) USING BTREE,
    INDEX `idx_union_2`(`work_id`, `paper_id`, `oper_type`) USING BTREE
    ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COMMENT = '操作日志';

-- ----------------------------
-- Table structure for mark_subject
-- ----------------------------
CREATE TABLE IF NOT EXISTS `mark_subject`  (
    `id` varchar(50) NOT NULL,
    `work_id` bigint(20) NULL DEFAULT NULL,
    `collect_config` varchar(255) NULL DEFAULT NULL,
    `name` varchar(255) NULL DEFAULT NULL,
    `stage` int(11) NULL DEFAULT NULL,
    `total_score` int(11) NOT NULL,
    `sample_count` int(11) NOT NULL DEFAULT 100,
    `is_test` int(1) NOT NULL DEFAULT 0 COMMENT '是否试评,0:不是，1:数据已导入，2:试评中',
    `all_level` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否全部根据档位分配完，0:不是，1:是',
    `enable` tinyint(1) NULL DEFAULT 1 COMMENT '是否启用 0：禁用 1：启用',
    PRIMARY KEY (`id`) USING BTREE,
    INDEX `FK1tvc2mil1ebqgt08912t4hxqw`(`work_id`) USING BTREE
    ) ENGINE = InnoDB CHARACTER SET = utf8mb4;

-- ----------------------------
-- Table structure for mark_task_job
-- ----------------------------
CREATE TABLE IF NOT EXISTS `mark_task_job`  (
    `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
    `data_object` varchar(4000) NULL DEFAULT NULL COMMENT 'object',
    `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
    `status` bit(1) NULL DEFAULT b'0' COMMENT '状态，0：未记录，1：已记录',
    `work_id` bigint(20) NULL DEFAULT NULL COMMENT '工作区id',
    `version` int(11) NULL DEFAULT 0 COMMENT '版本号',
    PRIMARY KEY (`id`) USING BTREE
    ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COMMENT = '定时任务调度表';

-- ----------------------------
-- Table structure for mark_task_level
-- ----------------------------
CREATE TABLE IF NOT EXISTS `mark_task_level`  (
    `id` bigint(20) NOT NULL AUTO_INCREMENT,
    `work_id` bigint(20) NOT NULL,
    `paper_id` bigint(20) NOT NULL,
    `is_rejected` bit(1) NOT NULL,
    `level_value` int(11) NULL DEFAULT NULL,
    `marker_id` bigint(20) NOT NULL,
    `marker_name` varchar(50) NOT NULL,
    `origin_level` varchar(255) NULL DEFAULT NULL,
    `question_id` bigint(20) NULL DEFAULT NULL,
    `result` varchar(50) NULL DEFAULT NULL,
    `level` varchar(45) NULL DEFAULT NULL COMMENT '最终档位（和paper表中level一致）',
    `stage` int(11) NOT NULL,
    `subject` varchar(50) NULL DEFAULT NULL,
    `created_on` datetime(0) NULL DEFAULT NULL,
    `updated_on` datetime(0) NULL DEFAULT NULL,
    `random_seq` int(11) NULL DEFAULT NULL,
    `secret_number` varchar(255) NULL DEFAULT NULL,
    `random_seq_new` bigint(20) NULL DEFAULT NULL COMMENT '随机号',
    `is_active` bit(1) NULL DEFAULT b'0' COMMENT '是否激活',
    `is_test` int(1) NOT NULL DEFAULT 0 COMMENT '是否试评,0:不是，1:数据已导入，2:试评中',
    `batch_no` bigint(45) NULL DEFAULT NULL COMMENT '批次号',
    `is_change_stage` tinyint(1) NULL DEFAULT NULL COMMENT '是否改档',
    `serial_number` varchar(10) NULL DEFAULT NULL COMMENT '叫号序号',
    `display_number` int(11) NULL DEFAULT NULL,
    `is_sample` bit(1) NULL DEFAULT NULL COMMENT '是否标准卷',
    `deviation_direction` varchar(10) NULL DEFAULT NULL COMMENT '偏差方向',
    `is_mark` bit(1) NULL DEFAULT b'0' COMMENT '是否标记',
    PRIMARY KEY (`id`) USING BTREE,
    INDEX `idx_mark_task_paper_id`(`paper_id`) USING BTREE,
    INDEX `question_id`(`question_id`, `marker_id`, `stage`, `result`, `is_rejected`, `random_seq`, `random_seq_new`) USING BTREE,
    INDEX `idx_union_1`(`marker_id`, `stage`, `result`, `random_seq`, `random_seq_new`) USING BTREE
    ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4;

-- ----------------------------
-- Table structure for mark_task_marker_paper
-- ----------------------------
CREATE TABLE IF NOT EXISTS `mark_task_marker_paper` (
      `id` BIGINT(10) NOT NULL AUTO_INCREMENT,
      `work_id` BIGINT(10) NOT NULL COMMENT '工作ID',
      `subject` VARCHAR(2) NOT NULL COMMENT '科目',
      `stage` INT(11) NULL COMMENT '阶段',
      `marker_id` BIGINT(10) NOT NULL COMMENT '评卷员ID',
      `task_id` BIGINT(10) NOT NULL COMMENT '评卷任务ID',
      PRIMARY KEY (`id`),
      INDEX `ix_1` (`work_id` ASC, `subject` ASC, `stage` ASC,  `marker_id` ASC)
)ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COMMENT = '评卷员评卷任务表（自查）';

-- ----------------------------
-- Table structure for mark_task_rough_level
-- ----------------------------
CREATE TABLE IF NOT EXISTS `mark_task_rough_level`  (
    `id` bigint(20) NOT NULL AUTO_INCREMENT,
    `work_id` bigint(20) NOT NULL,
    `paper_id` bigint(20) NOT NULL,
    `is_rejected` bit(1) NOT NULL,
    `level_value` int(11) NULL DEFAULT NULL,
    `marker_id` bigint(20) NOT NULL,
    `marker_name` varchar(50) NOT NULL,
    `origin_level` varchar(10) NULL DEFAULT NULL,
    `question_id` bigint(20) NULL DEFAULT NULL,
    `result` varchar(2) NULL DEFAULT NULL,
    `level` varchar(2) NULL DEFAULT NULL COMMENT '最终档位（和paper表中level一致）',
    `stage` int(11) NOT NULL,
    `subject` varchar(50) NULL DEFAULT NULL,
    `created_on` datetime(0) NULL DEFAULT NULL,
    `updated_on` datetime(0) NULL DEFAULT NULL,
    `random_seq` int(11) NULL DEFAULT NULL,
    `secret_number` varchar(255) NULL DEFAULT NULL,
    `random_seq_new` bigint(20) NULL DEFAULT NULL COMMENT '随机号',
    `is_active` bit(1) NULL DEFAULT b'0' COMMENT '是否激活',
    `is_test` int(1) NOT NULL DEFAULT 0 COMMENT '是否试评,0:不是，1:数据已导入，2:试评中',
    `batch_no` bigint(45) NULL DEFAULT NULL COMMENT '批次号',
    `is_change_stage` tinyint(1) NULL DEFAULT NULL COMMENT '是否改档',
    `serial_number` varchar(10) NULL DEFAULT NULL COMMENT '叫号序号',
    `display_number` int(11) NULL DEFAULT NULL,
    `is_sample` bit(1) NULL DEFAULT NULL COMMENT '是否标准卷',
    `deviation_direction` varchar(10) NULL DEFAULT NULL COMMENT '偏差方向',
    `is_mark` bit(1) NULL DEFAULT b'0' COMMENT '是否标记',
    PRIMARY KEY (`id`) USING BTREE,
    INDEX `idx_mark_task_paper_id`(`paper_id`) USING BTREE,
    INDEX `question_id`(`question_id`, `marker_id`, `stage`, `result`, `is_rejected`, `random_seq`, `random_seq_new`) USING BTREE,
    INDEX `idx_union_1`(`marker_id`, `stage`, `result`, `random_seq`, `random_seq_new`) USING BTREE
    ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4;

-- ----------------------------
-- Table structure for mark_task_score
-- ----------------------------
CREATE TABLE IF NOT EXISTS `mark_task_score`  (
    `id` bigint(20) NOT NULL AUTO_INCREMENT,
    `work_id` bigint(20) NOT NULL,
    `paper_id` bigint(20) NOT NULL,
    `is_rejected` bit(1) NOT NULL,
    `level_value` int(11) NULL DEFAULT NULL,
    `marker_id` bigint(20) NOT NULL,
    `marker_name` varchar(50) NOT NULL,
    `origin_level` varchar(255) NULL DEFAULT NULL,
    `question_id` bigint(20) NULL DEFAULT NULL,
    `result` varchar(50) NULL DEFAULT NULL,
    `level` varchar(45) NULL DEFAULT NULL COMMENT '最终档位（和paper表中level一致）',
    `stage` int(11) NOT NULL,
    `subject` varchar(50) NULL DEFAULT NULL,
    `created_on` datetime(0) NULL DEFAULT NULL,
    `updated_on` datetime(0) NULL DEFAULT NULL,
    `random_seq` int(11) NULL DEFAULT NULL,
    `secret_number` varchar(255) NULL DEFAULT NULL,
    `random_seq_new` bigint(20) NULL DEFAULT NULL COMMENT '随机号',
    `is_active` bit(1) NULL DEFAULT b'0' COMMENT '是否激活',
    `is_test` int(1) NOT NULL DEFAULT 0 COMMENT '是否试评,0:不是，1:数据已导入，2:试评中',
    `batch_no` bigint(45) NULL DEFAULT NULL COMMENT '批次号',
    `is_change_stage` tinyint(1) NULL DEFAULT NULL COMMENT '是否改档',
    `serial_number` varchar(10) NULL DEFAULT NULL COMMENT '叫号序号',
    `display_number` int(11) NULL DEFAULT NULL,
    `is_sample` bit(1) NULL DEFAULT NULL COMMENT '是否标准卷',
    `deviation_direction` varchar(10) NULL DEFAULT NULL COMMENT '偏差方向',
    `is_mark` bit(1) NULL DEFAULT b'0' COMMENT '是否标记',
    PRIMARY KEY (`id`) USING BTREE,
    INDEX `idx_mark_task_paper_id`(`paper_id`) USING BTREE,
    INDEX `question_id`(`question_id`, `marker_id`, `stage`, `result`, `is_rejected`, `random_seq`, `random_seq_new`) USING BTREE,
    INDEX `idx_union_1`(`marker_id`, `stage`, `result`, `random_seq`, `random_seq_new`) USING BTREE
    ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4;

-- ----------------------------
-- Table structure for mark_task_self_check
-- ----------------------------
CREATE TABLE IF NOT EXISTS `mark_task_self_check` (
    `id` BIGINT(10) NOT NULL AUTO_INCREMENT,
    `work_id` BIGINT(10) NOT NULL COMMENT '工作ID',
    `subject` VARCHAR(10) NOT NULL COMMENT '科目',
    `task_id` BIGINT(10) NOT NULL COMMENT '评卷任务ID',
    `marker_id` BIGINT(10) NULL COMMENT '评卷员ID',
    `stage` INT(11) NULL COMMENT '阶段',
    `level` VARCHAR(1) NULL COMMENT '自查评卷档位',
    `level_value` INT(1) NULL COMMENT '档位值',
    `marking` BIT(1) NULL COMMENT '是否已评',
    `created_on` DATETIME NULL COMMENT '创建时间',
    `updated_on` DATETIME NULL COMMENT '修改时间',
    PRIMARY KEY (`id`),
    INDEX `ix_1` (`work_id` ASC, `task_id` ASC, `marker_id` ASC, `stage` ASC)
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COMMENT = '自查任务表';

-- ----------------------------
-- Table structure for mark_user
-- ----------------------------
CREATE TABLE IF NOT EXISTS `mark_user`  (
    `id` bigint(20) NOT NULL AUTO_INCREMENT,
    `work_id` bigint(20) NOT NULL,
    `subject` varchar(50) NULL DEFAULT NULL,
    `name` varchar(255) NULL DEFAULT NULL,
    `password` varchar(255) NULL DEFAULT NULL,
    `role` varchar(255) NULL DEFAULT NULL,
    `enabled` bit(1) NOT NULL,
    `login_name` varchar(50) NOT NULL,
    `pw_changed_count` int(11) NOT NULL,
    `session_id` varchar(255) NULL DEFAULT NULL,
    `group_id` bigint(20) NULL DEFAULT NULL,
    `mark_right` int(11) NULL DEFAULT NULL,
    `inspect_sc` bit(1) NULL DEFAULT NULL,
    `inspect_sm` bit(1) NULL DEFAULT NULL,
    `inspect_sx` bit(1) NULL DEFAULT NULL,
    `weight` double NULL DEFAULT NULL,
    `one_click_level` bit(1) NULL DEFAULT b'0' COMMENT '科组长是否开启一键定档',
    `standard_volume` bit(1) NOT NULL,
    `level_callback` bit(1) NOT NULL,
    `leader_confirm` bit(1) NULL DEFAULT NULL COMMENT '科组长打回、定档是否要确认',
    `display_count` int(1) NULL DEFAULT NULL COMMENT '显示数量：4-4张显示，6-6张显示，8-8张显示',
    `default_account` tinyint(1) NULL DEFAULT NULL COMMENT '是否默认账号（采集账号）',
    `last_login_time` datetime(0) NULL DEFAULT NULL,
    PRIMARY KEY (`id`) USING BTREE,
    UNIQUE INDEX `UK_cyf7k1neuij8lma85x19omo07`(`login_name`) USING BTREE,
    INDEX `FKinr4i9gbxj9njwo82s7cc89q5`(`group_id`) USING BTREE
    ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4;

-- ----------------------------
-- Table structure for marker_group
-- ----------------------------
CREATE TABLE IF NOT EXISTS `marker_group`  (
    `id` bigint(20) NOT NULL AUTO_INCREMENT,
    `work_id` bigint(20) NOT NULL,
    `name` varchar(255) NULL DEFAULT NULL,
    `subject` varchar(50) NOT NULL,
    `stage` int(1) NULL DEFAULT NULL,
    PRIMARY KEY (`id`) USING BTREE
    ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4;

-- ----------------------------
-- Table structure for marker_group_leader
-- ----------------------------
CREATE TABLE IF NOT EXISTS `marker_group_leader`  (
    `id` bigint(20) NOT NULL AUTO_INCREMENT,
    `work_id` bigint(20) NOT NULL COMMENT '工作ID',
    `subject` varchar(50) NOT NULL COMMENT '科目',
    `stage` int(11) NOT NULL COMMENT '阶段',
    `mark_leader_id` bigint(20) NULL DEFAULT NULL COMMENT '科组长ID',
    `marker_id` bigint(20) NULL DEFAULT NULL COMMENT '评卷员ID',
    `group_id` bigint(20) NOT NULL,
    `group_name` varchar(255) NOT NULL,
    `marking_count` INT(10) NULL DEFAULT 0 COMMENT '评卷数量（达到自查卷分发频率值时，清零后再自增。若频率值为0，继续累加）',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4;

-- ----------------------------
-- Table structure for marker_group_student
-- ----------------------------
CREATE TABLE IF NOT EXISTS `marker_group_student`  (
    `id` bigint(20) NOT NULL AUTO_INCREMENT,
    `work_id` bigint(20) NOT NULL,
    `subject` varchar(10) NULL DEFAULT NULL,
    `stage` int(1) NOT NULL COMMENT '所属阶段',
    `group_id` bigint(20) NOT NULL COMMENT '分组ID',
    `paper_id` bigint(20) NULL DEFAULT NULL COMMENT '试卷ID',
    `question_id` bigint(20) NULL DEFAULT NULL COMMENT '考区ID',
    `exam_number` varchar(50) NULL DEFAULT NULL,
    `name` varchar(50) NULL DEFAULT NULL,
    `area_code` varchar(45) NULL DEFAULT NULL,
    `area_name` varchar(255) NULL DEFAULT NULL,
    `exam_room` varchar(255) NULL DEFAULT NULL,
    `school` varchar(255) NULL DEFAULT NULL,
    `source_name` varchar(225) NULL DEFAULT NULL COMMENT '生源地',
    `batch_no` bigint(20) NULL DEFAULT NULL COMMENT '批次号',
    `used` tinyint(1) NULL DEFAULT NULL COMMENT '已否已发任务',
    PRIMARY KEY (`id`) USING BTREE
    ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4;

-- ----------------------------
-- Table structure for message
-- ----------------------------
CREATE TABLE IF NOT EXISTS `message`  (
    `id` bigint(20) NOT NULL AUTO_INCREMENT,
    `work_id` bigint(20) NULL DEFAULT NULL COMMENT '工作ID',
    `subject` varchar(10) NULL DEFAULT NULL COMMENT '科目',
    `stage` int(2) NULL DEFAULT NULL COMMENT '阶段',
    `send_user_id` bigint(20) NULL DEFAULT NULL COMMENT '发件人ID',
    `send_user_name` varchar(45) NULL DEFAULT NULL COMMENT '发件人名称',
    `content` varchar(500) NULL DEFAULT NULL COMMENT '消息内容',
    `receive_user` varchar(500) NULL DEFAULT NULL COMMENT '收件人集合json',
    `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
    PRIMARY KEY (`id`) USING BTREE
    ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COMMENT = '消息管理';

-- ----------------------------
-- Table structure for message_receive
-- ----------------------------
CREATE TABLE IF NOT EXISTS `message_receive`  (
    `id` bigint(20) NOT NULL AUTO_INCREMENT,
    `message_id` bigint(20) NULL DEFAULT NULL,
    `receive_user_id` bigint(20) NULL DEFAULT NULL,
    `is_read` tinyint(1) NULL DEFAULT NULL,
    PRIMARY KEY (`id`) USING BTREE,
    INDEX `FKsg879qydqr4dx6r0khxfkkick`(`message_id`) USING BTREE,
    CONSTRAINT `message_receive_ibfk_1` FOREIGN KEY (`message_id`) REFERENCES `message` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
    CONSTRAINT `message_receive_ibfk_2` FOREIGN KEY (`message_id`) REFERENCES `message` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
    ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COMMENT = '消息发送的用户';

-- ----------------------------
-- Table structure for paper
-- ----------------------------
CREATE TABLE IF NOT EXISTS `paper`  (
    `id` bigint(20) NOT NULL AUTO_INCREMENT,
    `work_id` bigint(20) NOT NULL,
    `subject` varchar(50) NOT NULL,
    `exam_number` varchar(50) NOT NULL,
    `student_name` varchar(50) NOT NULL,
    `area_code` varchar(50) NOT NULL,
    `is_arbitrated` bit(1) NOT NULL,
    `is_manual` bit(1) NOT NULL,
    `is_rejected` bit(1) NOT NULL,
    `is_tagged` bit(1) NOT NULL,
    `level` varchar(255) NULL DEFAULT NULL,
    `mark_by_leader` bit(1) NOT NULL,
    `marked_logic` bit(1) NOT NULL,
    `question_id` bigint(20) NOT NULL,
    `question_name` varchar(255) NOT NULL,
    `redo_level` varchar(255) NULL DEFAULT NULL,
    `score` double NULL DEFAULT NULL,
    `secret_number` varchar(255) NULL DEFAULT NULL,
    `updated_on` datetime(0) NULL DEFAULT NULL,
    `uploaded_count` int(11) NOT NULL,
    `uploaded_on` datetime(0) NULL DEFAULT NULL,
    `inspect_range` bigint(20) NULL DEFAULT NULL,
    `inspect_score` double NULL DEFAULT NULL,
    `source_name` varchar(255) NULL DEFAULT NULL,
    `inspect_level` varchar(255) NULL DEFAULT NULL,
    `inspector` bigint(20) NULL DEFAULT NULL,
    `is_rough_sample` bit(1) NULL DEFAULT NULL COMMENT '粗分档标准卷',
    `is_sample` bit(1) NOT NULL,
    `sheet_md5` varchar(255) NULL DEFAULT NULL,
    `slice_md5` varchar(255) NULL DEFAULT NULL,
    `random_seq` bigint(20) NULL DEFAULT NULL COMMENT '随机号',
    `is_missing` bit(1) NOT NULL,
    `exam_room` varchar(255) NULL DEFAULT NULL,
    `is_test` int(1) NOT NULL DEFAULT 0 COMMENT '是否试评,0:不是，1:数据已导入，2:试评中',
    `rough_batch_no` bigint(45) NULL DEFAULT NULL COMMENT '粗分档批次号',
    `batch_no` bigint(45) NULL DEFAULT NULL COMMENT '批次号',
    `score_batch_no` bigint(45) NULL DEFAULT NULL COMMENT '打分任务发布批次号',
    `is_shift` bit(1) NULL DEFAULT b'0' COMMENT '是否改档',
    `is_shift_score` bit(1) NULL DEFAULT b'0' COMMENT '是否改档打分',
    `is_rough_one_click` bit(1) NULL DEFAULT b'0',
    `is_one_click` bit(1) NULL DEFAULT b'0' COMMENT '是否一键定档',
    `is_rejected_by_leader` bit(1) NULL DEFAULT b'0' COMMENT '是否科组长打回',
    `is_relate` bit(1) NULL DEFAULT b'0' COMMENT '是否关联试卷',
    `sort_num` int(11) NULL DEFAULT 0 COMMENT '排序值',
    `scan_user_id` bigint(20) NULL DEFAULT NULL COMMENT '采集员ID',
    `is_mark` bit(1) NULL DEFAULT b'0' COMMENT '是否标记',
    `rough_level` varchar(2) NULL DEFAULT NULL,
    `redo_rough_level` varchar(2) NULL DEFAULT NULL,
    `is_admin_mark` bit(1) NULL DEFAULT b'0' COMMENT '管理员标记',
    `first_collect_size` INT NULL COMMENT '首次采集原图大小（KB）',
    `size_abnormal` BIT(1) NULL DEFAULT 0 COMMENT '大小是否异常（1：异常）',
    `rough_mark_leader_id` BIGINT(10) NULL COMMENT '粗分档阶段科组长操作ID',
    `mark_leader_id` BIGINT(10) NULL COMMENT '细分档阶段科组长操作ID',
    PRIMARY KEY (`id`) USING BTREE,
    UNIQUE KEY `uq_idx` (`work_id`,`subject`,`exam_number`,`is_test`),
    INDEX `idx_paper_exam_number`(`exam_number`) USING BTREE,
    INDEX `idx_union_1`(`batch_no`) USING BTREE,
    INDEX `idx_union_4`(`is_shift`, `is_shift_score`) USING BTREE,
    INDEX `idx_union_3`(`work_id`, `subject`, `batch_no`) USING BTREE,
    INDEX `idx_union_5`(`work_id`, `subject`, `score_batch_no`) USING BTREE
    ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4;

-- ----------------------------
-- Table structure for paper_check
-- ----------------------------
CREATE TABLE `paper_check` (
       `id` BIGINT(20) NOT NULL AUTO_INCREMENT,
       `work_id` BIGINT(20) NOT NULL COMMENT '工作ID',
       `subject` VARCHAR(45) NOT NULL COMMENT '科目',
       `stage` INT NOT NULL COMMENT '阶段',
       `name` VARCHAR(45) NOT NULL COMMENT '任务名称',
       `remark` VARCHAR(100) NULL COMMENT '备注',
       `student_count` INT NULL DEFAULT 0 COMMENT '学生数量',
       `start_deal` TINYINT(1) NULL DEFAULT 0 COMMENT '是否开始批量处理',
       `select_info` VARCHAR(150) NULL COMMENT '最后一次操作的试卷信息',
       `created_id` BIGINT(20) NULL COMMENT '创建人',
       `created_on` DATETIME NULL COMMENT '创建时间',
       PRIMARY KEY (`id`))
    COMMENT = '试卷抽查任务表';

-- ----------------------------
-- Table structure for paper_check_student
-- ----------------------------
CREATE TABLE `paper_check_student` (
       `id` BIGINT(20) NOT NULL AUTO_INCREMENT,
       `work_id` BIGINT(20) NULL COMMENT '工作ID',
       `paper_check_id` BIGINT(20) NULL COMMENT '试卷抽查任务ID',
       `subject` VARCHAR(45) NULL COMMENT '科目',
       `stage` INT NULL COMMENT '阶段',
       `paper_id` BIGINT(20) NULL COMMENT '试卷ID',
       `secret_number` VARCHAR(45) NULL COMMENT '试卷密号',
       PRIMARY KEY (`id`))
    COMMENT = '试卷抽查考生表';

-- ----------------------------
-- Table structure for param_setting
-- ----------------------------
CREATE TABLE IF NOT EXISTS `param_setting`  (
    `id` bigint(10) NOT NULL AUTO_INCREMENT,
    `work_id` bigint(10) NULL DEFAULT NULL COMMENT '工作id',
    `collect_config` varchar(1000) NULL DEFAULT NULL COMMENT '采集规则参数',
    `level_config` varchar(1000) NULL DEFAULT NULL COMMENT '细分档规则参数',
    `rough_level_config` varchar(1000) NULL DEFAULT NULL COMMENT '粗分档规则参数',
    `score_config` varchar(500) NULL DEFAULT NULL COMMENT '打分规则参数',
    PRIMARY KEY (`id`) USING BTREE
    ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COMMENT = '参数设置';

-- ----------------------------
-- Table structure for student
-- ----------------------------
CREATE TABLE IF NOT EXISTS `student`  (
    `id` bigint(20) NOT NULL AUTO_INCREMENT,
    `work_id` bigint(20) NULL DEFAULT NULL,
    `exam_number` varchar(50) NULL DEFAULT NULL,
    `name` varchar(50) NULL DEFAULT NULL,
    `area_code` varchar(255) NULL DEFAULT NULL,
    `area_name` varchar(255) NULL DEFAULT NULL,
    `exam_room` varchar(255) NULL DEFAULT NULL,
    `school` varchar(255) NULL DEFAULT NULL COMMENT '学校',
    `is_absent` bit(1) NOT NULL,
    `upload_status` varchar(255) NULL DEFAULT NULL,
    `source_name` varchar(255) NULL DEFAULT NULL,
    `relate_exam_number` varchar(50) NULL DEFAULT NULL COMMENT '关联考号',
    PRIMARY KEY (`id`) USING BTREE,
    UNIQUE INDEX `exam_number`(`exam_number`, `work_id`) USING BTREE,
    INDEX `idx_work_id`(`work_id`) USING BTREE,
    INDEX `idx_student_name`(`name`) USING BTREE
    ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4;

-- ----------------------------
-- Table structure for task_publish_setting
-- ----------------------------
CREATE TABLE IF NOT EXISTS `task_publish_setting`  (
    `id` bigint(20) NOT NULL AUTO_INCREMENT,
    `work_id` bigint(20) NULL DEFAULT NULL,
    `question_id` bigint(45) NULL DEFAULT NULL COMMENT '考区',
    `subject` varchar(50) NULL DEFAULT NULL,
    `code` varchar(45) NULL DEFAULT NULL COMMENT '档位',
    `total_count` int(11) NULL DEFAULT NULL COMMENT '总数量',
    `success_count` int(11) NULL DEFAULT NULL COMMENT '已评数量',
    `wait_count` int(11) NULL DEFAULT NULL COMMENT '待评数量',
    `sort_rule` int(1) NULL DEFAULT NULL COMMENT '排序规则：0-乱序，1-定序',
    `display_number` int(1) NULL DEFAULT NULL COMMENT '是否显示序号：0-否，1-是',
    `task_count` int(11) NULL DEFAULT NULL COMMENT '本次任务数',
    `batch_no` bigint(45) NULL DEFAULT NULL,
    `publish_count` int(3) NULL DEFAULT NULL,
    PRIMARY KEY (`id`) USING BTREE
    ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COMMENT = '发布打分任务';

-- ----------------------------
-- Table structure for work
-- ----------------------------
CREATE TABLE IF NOT EXISTS `work`  (
    `id` bigint(20) NOT NULL AUTO_INCREMENT,
    `name` varchar(255) NULL DEFAULT NULL,
    `active` bit(1) NOT NULL,
    `created_on` date NULL DEFAULT NULL,
    PRIMARY KEY (`id`) USING BTREE
    ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4;
