-- ----------------------------
--  Table structure for `pm_break_record`
-- ----------------------------
DROP TABLE IF EXISTS `pm_break_record`;
CREATE TABLE `pm_break_record`
(
    `id`           bigint(20)                   NOT NULL AUTO_INCREMENT,
    `create_time`  datetime(6)                  NOT NULL,
    `creator_id`   bigint(20)                    DEFAULT NULL,
    `update_time`  datetime(6)                   DEFAULT NULL,
    `updater_id`   bigint(20)                    DEFAULT NULL,
    `org_id`       bigint(20)                   NOT NULL,
    `exam_id`      bigint(20)                   NOT NULL,
    `group_type`   varchar(16) COLLATE utf8_bin NOT NULL,
    `group_name`   varchar(255) COLLATE utf8_bin DEFAULT NULL,
    `status`       varchar(16) COLLATE utf8_bin  DEFAULT NULL,
    `start_number` varchar(255) COLLATE utf8_bin DEFAULT NULL,
    `end_number`   varchar(255) COLLATE utf8_bin DEFAULT NULL,
    PRIMARY KEY (`id`),
    KEY `IDX_BREAK_RECORD_001` (`org_id`, `exam_id`, `group_type`),
    KEY `IDX_BREAK_RECORD_002` (`exam_id`)
) ENGINE = InnoDB
  AUTO_INCREMENT = 1
  DEFAULT CHARSET = utf8
  COLLATE = utf8_bin;

-- ----------------------------
--  Table structure for `pm_check_record`
-- ----------------------------
DROP TABLE IF EXISTS `pm_check_record`;
CREATE TABLE `pm_check_record`
(
    `id`           bigint(20)                   NOT NULL AUTO_INCREMENT,
    `create_time`  datetime(6)                  NOT NULL,
    `creator_id`   bigint(20)                    DEFAULT NULL,
    `update_time`  datetime(6)                   DEFAULT NULL,
    `updater_id`   bigint(20)                    DEFAULT NULL,
    `org_id`       bigint(20)                   NOT NULL,
    `exam_id`      bigint(20)                   NOT NULL,
    `group_type`   varchar(16) COLLATE utf8_bin NOT NULL,
    `status`       varchar(16) COLLATE utf8_bin NOT NULL,
    `group_name`   varchar(255) COLLATE utf8_bin DEFAULT NULL,
    `start_number` varchar(255) COLLATE utf8_bin DEFAULT NULL,
    `end_number`   varchar(255) COLLATE utf8_bin DEFAULT NULL,
    PRIMARY KEY (`id`),
    KEY `IDX_CHECK_RECORD_001` (`org_id`, `exam_id`, `group_type`),
    KEY `IDX_CHECK_RECORD_002` (`exam_id`)
) ENGINE = InnoDB
  AUTO_INCREMENT = 1
  DEFAULT CHARSET = utf8
  COLLATE = utf8_bin;

-- ----------------------------
--  Table structure for `pm_exam`
-- ----------------------------
DROP TABLE IF EXISTS `pm_exam`;
CREATE TABLE `pm_exam`
(
    `id`          bigint(20)                    NOT NULL AUTO_INCREMENT,
    `create_time` datetime(6)                   NOT NULL,
    `creator_id`  bigint(20)                    DEFAULT NULL,
    `update_time` datetime(6)                   DEFAULT NULL,
    `updater_id`  bigint(20)                    DEFAULT NULL,
    `org_id`      bigint(20)                    NOT NULL,
    `name`        varchar(255) COLLATE utf8_bin DEFAULT NULL,
    `enable`      bigint(1)                     NOT NULL,
    `group_type`  varchar(255) COLLATE utf8_bin NOT NULL,
    `check_sort`  varchar(255) COLLATE utf8_bin NOT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `IDX_EXAM_001` (`org_id`, `name`)
) ENGINE = InnoDB
  AUTO_INCREMENT = 1
  DEFAULT CHARSET = utf8
  COLLATE = utf8_bin;

-- ----------------------------
--  Table structure for `pm_exam_student`
-- ----------------------------
DROP TABLE IF EXISTS `pm_exam_student`;
CREATE TABLE `pm_exam_student`
(
    `create_time`  datetime(6)                   NOT NULL,
    `creator_id`   bigint(20)                    DEFAULT NULL,
    `update_time`  datetime(6)                   DEFAULT NULL,
    `updater_id`   bigint(20)                    DEFAULT NULL,
    `org_id`       bigint(20)                    NOT NULL,
    `exam_id`      bigint(20)                    NOT NULL,
    `sort_no`      bigint(20)                    NOT NULL,
    `name`         varchar(255) COLLATE utf8_bin DEFAULT NULL,
    `course_code`  varchar(255) COLLATE utf8_bin NOT NULL,
    `student_code` varchar(255) COLLATE utf8_bin DEFAULT NULL,
    `exam_number`  varchar(255) COLLATE utf8_bin NOT NULL,
    `exam_site`    varchar(255) COLLATE utf8_bin DEFAULT NULL,
    `exam_room`    varchar(255) COLLATE utf8_bin DEFAULT NULL,
    `exam_unit` varchar(255) COLLATE utf8_bin DEFAULT NULL COMMENT '服务单元',
    PRIMARY KEY (`exam_id`, `sort_no`),
    KEY `IDX_EXAM_STUDENT_001` (`org_id`, `exam_id`),
    KEY `IDX_EXAM_STUDENT_002` (`exam_id`)
) ENGINE = InnoDB
  DEFAULT CHARSET = utf8
  COLLATE = utf8_bin;

-- ----------------------------
--  Table structure for `pm_exam_user_relation`
-- ----------------------------
DROP TABLE IF EXISTS `pm_exam_user_relation`;
CREATE TABLE `pm_exam_user_relation`
(
    `user_id`     bigint(20)  NOT NULL,
    `exam_id`     bigint(20)  NOT NULL,
    `create_time` datetime(6) NOT NULL,
    `update_time` datetime(6) NOT NULL,
    `creator_id`  bigint(20) DEFAULT NULL,
    `updater_id`  bigint(20) DEFAULT NULL,
    PRIMARY KEY (`user_id`, `exam_id`)
) ENGINE = InnoDB
  DEFAULT CHARSET = utf8
  COLLATE = utf8_bin;

-- ----------------------------
--  Table structure for `pm_org`
-- ----------------------------
DROP TABLE IF EXISTS `pm_org`;
CREATE TABLE `pm_org`
(
    `id`            bigint(20)                    NOT NULL AUTO_INCREMENT,
    `create_time`   datetime(6)                   NOT NULL,
    `update_time`   datetime(6)                   NOT NULL,
    `name`          varchar(255) COLLATE utf8_bin NOT NULL,
    `code`          varchar(255) COLLATE utf8_bin NOT NULL,
    `enable`        bit(1)                        NOT NULL,
    `access_key`    varchar(255) COLLATE utf8_bin DEFAULT NULL,
    `access_secret` varchar(255) COLLATE utf8_bin DEFAULT NULL,
    `description`   varchar(255) COLLATE utf8_bin DEFAULT NULL,
    `domain_name`   varchar(255) COLLATE utf8_bin DEFAULT NULL,
    `logo_url`      varchar(255) COLLATE utf8_bin DEFAULT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `IDX_ORG_01` (`code`),
    UNIQUE KEY `IDX_ORG_02` (`domain_name`)
) ENGINE = InnoDB
  AUTO_INCREMENT = 1
  DEFAULT CHARSET = utf8
  COLLATE = utf8_bin;

INSERT INTO `pm_org` VALUES (1, '2023-10-23 16:22:02.000000', '2023-10-23 16:22:05.000000', '启明泰和', 'qmth', b'1', NULL, NULL, NULL, NULL, 'https://solar-file.qmth.com.cn/org/logo/1.png');

-- ----------------------------
--  Table structure for `pm_user`
-- ----------------------------
DROP TABLE IF EXISTS `pm_user`;
CREATE TABLE `pm_user`
(
    `id`          bigint(20)                    NOT NULL AUTO_INCREMENT,
    `create_time` datetime(6)                   NOT NULL,
    `creator_id`  bigint(20)                    DEFAULT NULL,
    `update_time` datetime(6)                   NOT NULL,
    `updater_id`  bigint(20)                    DEFAULT NULL,
    `login_name`  varchar(255) COLLATE utf8_bin NOT NULL,
    `name`        varchar(255) COLLATE utf8_bin DEFAULT NULL,
    `enable`      bit(1)                        NOT NULL,
    `password`    varchar(255) COLLATE utf8_bin DEFAULT NULL,
    `password_count` int NOT NULL DEFAULT '0' COMMENT '密码修改次数',
    `role`        varchar(64) COLLATE utf8_bin  NOT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `IDX_USER_01` (`login_name`)
) ENGINE = InnoDB
  AUTO_INCREMENT = 1
  DEFAULT CHARSET = utf8
  COLLATE = utf8_bin;

INSERT INTO `pm_user` VALUES (1, '2023-10-11 10:26:02.000000', 1, '2023-10-11 10:26:02.000000', 1, 'admin1', '超管1', b'1', '123456', 1, 'ADMIN');
INSERT INTO `pm_user` VALUES (2, '2023-10-23 16:18:03.000000', 1, '2023-10-23 16:18:17.000000', 1, 'admin2', '超管2', b'1', '123456', 1, 'ADMIN');
INSERT INTO `pm_user` VALUES (3, '2023-10-23 16:19:12.000000', 1, '2023-10-23 16:19:15.000000', 1, 'admin3', '超管3', b'1', '123456', 1, 'ADMIN');
INSERT INTO `pm_user` VALUES (4, '2023-10-23 16:19:38.000000', 1, '2023-10-23 16:19:41.000000', 1, 'admin4', '超管4', b'1', '123456', 1, 'ADMIN');
INSERT INTO `pm_user` VALUES (5, '2023-10-23 16:20:03.000000', 1, '2023-10-23 16:20:05.000000', 1, 'admin5', '超管5', b'1', '123456', 1, 'ADMIN');

