
-- ----------------------------
-- Table structure for mps_course
-- ----------------------------
DROP TABLE IF EXISTS `mps_course`;
CREATE TABLE `mps_course` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `create_time` bigint DEFAULT NULL,
  `update_time` bigint DEFAULT NULL,
  `creator_id` bigint DEFAULT NULL,
  `updater_id` bigint DEFAULT NULL,
  `code` varchar(255) COLLATE utf8_bin NOT NULL,
  `name` varchar(255) COLLATE utf8_bin NOT NULL,
  `school_id` bigint NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `IDX_COURSE_01` (`school_id`,`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

-- ----------------------------
-- Table structure for mps_exam
-- ----------------------------
DROP TABLE IF EXISTS `mps_exam`;
CREATE TABLE `mps_exam` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `create_time` bigint DEFAULT NULL,
  `update_time` bigint DEFAULT NULL,
  `creator_id` bigint DEFAULT NULL,
  `updater_id` bigint DEFAULT NULL,
  `exam_status` varchar(255) COLLATE utf8_bin NOT NULL,
  `name` varchar(255) COLLATE utf8_bin NOT NULL,
  `school_id` bigint NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `IDX_EXAM_01` (`school_id`,`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

-- ----------------------------
-- Table structure for mps_paper
-- ----------------------------
DROP TABLE IF EXISTS `mps_paper`;
CREATE TABLE `mps_paper` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `create_time` bigint DEFAULT NULL,
  `update_time` bigint DEFAULT NULL,
  `creator_id` bigint DEFAULT NULL,
  `updater_id` bigint DEFAULT NULL,
  `course_id` bigint NOT NULL,
  `exam_id` bigint NOT NULL,
  `group_finish` bit(1) DEFAULT NULL,
  `group_info` text COLLATE utf8_bin,
  `objective_score` double DEFAULT NULL,
  `paper_type` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  `school_id` bigint NOT NULL,
  `struct_info` text COLLATE utf8_bin,
  `subjective_score` double DEFAULT NULL,
  `total_score` double DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `IDX_PAPER_01` (`school_id`,`exam_id`,`course_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

-- ----------------------------
-- Table structure for mps_privilege
-- ----------------------------
DROP TABLE IF EXISTS `mps_privilege`;
CREATE TABLE `mps_privilege` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `create_time` bigint DEFAULT NULL,
  `update_time` bigint DEFAULT NULL,
  `creator_id` bigint DEFAULT NULL,
  `updater_id` bigint DEFAULT NULL,
  `code` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  `description` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  `ext1` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  `ext2` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  `ext3` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  `ext4` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  `ext5` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  `name` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  `parent_id` bigint DEFAULT NULL,
  `seq` int DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `IDX_PRIVILEGE_01` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

-- ----------------------------
-- Table structure for mps_role_privilege_relation
-- ----------------------------
DROP TABLE IF EXISTS `mps_role_privilege_relation`;
CREATE TABLE `mps_role_privilege_relation` (
  `role` varchar(255) COLLATE utf8_bin NOT NULL,
  `privilege_id` bigint NOT NULL,
  `create_time` bigint DEFAULT NULL,
  `update_time` bigint DEFAULT NULL,
  `creator_id` bigint DEFAULT NULL,
  `updater_id` bigint DEFAULT NULL,
  PRIMARY KEY (`role`,`privilege_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

-- ----------------------------
-- Table structure for mps_school
-- ----------------------------
DROP TABLE IF EXISTS `mps_school`;
CREATE TABLE `mps_school` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `create_time` bigint DEFAULT NULL,
  `update_time` bigint DEFAULT NULL,
  `creator_id` bigint DEFAULT NULL,
  `updater_id` bigint DEFAULT NULL,
  `contacts` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  `enable` bit(1) NOT NULL,
  `name` varchar(255) COLLATE utf8_bin NOT NULL,
  `region` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  `telephone` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `IDX_SCHOOL_01` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

-- ----------------------------
-- Table structure for mps_user
-- ----------------------------
DROP TABLE IF EXISTS `mps_user`;
CREATE TABLE `mps_user` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `create_time` bigint DEFAULT NULL,
  `update_time` bigint DEFAULT NULL,
  `creator_id` bigint DEFAULT NULL,
  `updater_id` bigint DEFAULT NULL,
  `course` text COLLATE utf8_bin,
  `enable` bit(1) NOT NULL,
  `login_name` varchar(255) COLLATE utf8_bin NOT NULL,
  `name` varchar(255) COLLATE utf8_bin NOT NULL,
  `password` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  `role` varchar(255) COLLATE utf8_bin NOT NULL,
  `school_id` bigint NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `IDX_USER_01` (`school_id`,`login_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
