paper_struct_db.sql 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. DROP TABLE IF EXISTS `mps_wxapp_info`;
  2. CREATE TABLE `mps_wxapp_info` (
  3. `id` bigint NOT NULL AUTO_INCREMENT,
  4. `create_time` datetime DEFAULT NULL,
  5. `update_time` datetime DEFAULT NULL,
  6. `creator_id` bigint DEFAULT NULL,
  7. `updater_id` bigint DEFAULT NULL,
  8. `openid` varchar(255) COLLATE utf8_bin NOT NULL,
  9. `phone` varchar(255) COLLATE utf8_bin NOT NULL,
  10. PRIMARY KEY (`id`),
  11. UNIQUE KEY `IDX_WXAPP_INFO_01` (`openid`)
  12. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  13. DROP TABLE IF EXISTS `mps_wxapp_access_token`;
  14. CREATE TABLE `mps_wxapp_access_token` (
  15. `id` bigint NOT NULL AUTO_INCREMENT,
  16. `create_time` datetime DEFAULT NULL,
  17. `update_time` datetime DEFAULT NULL,
  18. `creator_id` bigint DEFAULT NULL,
  19. `updater_id` bigint DEFAULT NULL,
  20. `access_token` varchar(512) COLLATE utf8_bin DEFAULT NULL,
  21. `expires_time` bigint DEFAULT NULL,
  22. PRIMARY KEY (`id`)
  23. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  24. -- ----------------------------
  25. -- Table structure for mps_course
  26. -- ----------------------------
  27. DROP TABLE IF EXISTS `mps_course`;
  28. CREATE TABLE `mps_course` (
  29. `id` bigint NOT NULL AUTO_INCREMENT,
  30. `create_time` datetime DEFAULT NULL,
  31. `update_time` datetime DEFAULT NULL,
  32. `creator_id` bigint DEFAULT NULL,
  33. `updater_id` bigint DEFAULT NULL,
  34. `code` varchar(255) COLLATE utf8_bin NOT NULL,
  35. `name` varchar(255) COLLATE utf8_bin NOT NULL,
  36. `school_id` bigint NOT NULL,
  37. PRIMARY KEY (`id`),
  38. UNIQUE KEY `IDX_COURSE_01` (`school_id`,`code`)
  39. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  40. -- ----------------------------
  41. -- Table structure for mps_exam
  42. -- ----------------------------
  43. DROP TABLE IF EXISTS `mps_exam`;
  44. CREATE TABLE `mps_exam` (
  45. `id` bigint NOT NULL AUTO_INCREMENT,
  46. `create_time` datetime DEFAULT NULL,
  47. `update_time` datetime DEFAULT NULL,
  48. `creator_id` bigint DEFAULT NULL,
  49. `updater_id` bigint DEFAULT NULL,
  50. `exam_status` varchar(255) COLLATE utf8_bin NOT NULL,
  51. `name` varchar(255) COLLATE utf8_bin NOT NULL,
  52. `code` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  53. `school_id` bigint NOT NULL,
  54. PRIMARY KEY (`id`),
  55. UNIQUE KEY `IDX_EXAM_01` (`school_id`,`code`)
  56. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  57. -- ----------------------------
  58. -- Table structure for mps_paper
  59. -- ----------------------------
  60. DROP TABLE IF EXISTS `mps_paper`;
  61. CREATE TABLE `mps_paper` (
  62. `id` bigint NOT NULL AUTO_INCREMENT,
  63. `create_time` datetime DEFAULT NULL,
  64. `update_time` datetime DEFAULT NULL,
  65. `creator_id` bigint DEFAULT NULL,
  66. `updater_id` bigint DEFAULT NULL,
  67. `course_id` bigint NOT NULL,
  68. `exam_id` bigint NOT NULL,
  69. `group_finish` bit(1) NOT NULL,
  70. `struct_finish` bit(1) NOT NULL,
  71. `objective_score` double NOT NULL,
  72. `paper_type` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  73. `school_id` bigint NOT NULL,
  74. `subjective_score` double NOT NULL,
  75. `total_score` double NOT NULL,
  76. PRIMARY KEY (`id`),
  77. UNIQUE KEY `IDX_PAPER_01` (`school_id`,`exam_id`,`course_id`)
  78. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  79. -- ----------------------------
  80. -- Table structure for mps_paper_detail
  81. -- ----------------------------
  82. DROP TABLE IF EXISTS `mps_paper_detail`;
  83. CREATE TABLE `mps_paper_detail` (
  84. `id` bigint NOT NULL AUTO_INCREMENT,
  85. `create_time` datetime DEFAULT NULL,
  86. `update_time` datetime DEFAULT NULL,
  87. `creator_id` bigint DEFAULT NULL,
  88. `updater_id` bigint DEFAULT NULL,
  89. `name` varchar(255) COLLATE utf8_bin NOT NULL,
  90. `number` int NOT NULL,
  91. `paper_id` bigint NOT NULL,
  92. PRIMARY KEY (`id`),
  93. UNIQUE KEY `IDX_PAPER_DETAIL_01` (`paper_id`,`number`)
  94. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  95. -- ----------------------------
  96. -- Table structure for mps_paper_detail_unit
  97. -- ----------------------------
  98. DROP TABLE IF EXISTS `mps_paper_detail_unit`;
  99. CREATE TABLE `mps_paper_detail_unit` (
  100. `id` bigint NOT NULL AUTO_INCREMENT,
  101. `create_time` datetime DEFAULT NULL,
  102. `update_time` datetime DEFAULT NULL,
  103. `creator_id` bigint DEFAULT NULL,
  104. `updater_id` bigint DEFAULT NULL,
  105. `detail_id` bigint NOT NULL,
  106. `detail_number` int NOT NULL,
  107. `number` int NOT NULL,
  108. `objective` bit(1) NOT NULL,
  109. `paper_id` bigint NOT NULL,
  110. `score` double NOT NULL,
  111. `score_step` double NOT NULL,
  112. PRIMARY KEY (`id`),
  113. UNIQUE KEY `IDX_PAPER_DETAIL_UNIT_01` (`paper_id`,`detail_id`,`number`)
  114. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  115. -- ----------------------------
  116. -- Table structure for mps_paper_group
  117. -- ----------------------------
  118. DROP TABLE IF EXISTS `mps_paper_group`;
  119. CREATE TABLE `mps_paper_group` (
  120. `id` bigint NOT NULL AUTO_INCREMENT,
  121. `create_time` datetime DEFAULT NULL,
  122. `update_time` datetime DEFAULT NULL,
  123. `creator_id` bigint DEFAULT NULL,
  124. `updater_id` bigint DEFAULT NULL,
  125. `number` int NOT NULL,
  126. `paper_id` bigint NOT NULL,
  127. `double_enable` tinyint(1) DEFAULT '0' COMMENT '是否开启双评',
  128. `double_rate` double DEFAULT NULL COMMENT '双评比例',
  129. `arbitrate_threshold` double DEFAULT NULL COMMENT '仲裁阈值',
  130. `arbitrate_method` varchar(16) COLLATE utf8_bin DEFAULT NULL COMMENT '仲裁方式(小题仲裁、分组仲裁)',
  131. PRIMARY KEY (`id`),
  132. UNIQUE KEY `IDX_PAPER_GROUP_01` (`paper_id`,`number`)
  133. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  134. -- ----------------------------
  135. -- Table structure for mps_paper_group_unit
  136. -- ----------------------------
  137. DROP TABLE IF EXISTS `mps_paper_group_unit`;
  138. CREATE TABLE `mps_paper_group_unit` (
  139. `id` bigint NOT NULL AUTO_INCREMENT,
  140. `create_time` datetime DEFAULT NULL,
  141. `update_time` datetime DEFAULT NULL,
  142. `creator_id` bigint DEFAULT NULL,
  143. `updater_id` bigint DEFAULT NULL,
  144. `group_id` bigint NOT NULL,
  145. `paper_id` bigint NOT NULL,
  146. `detail_number` int NOT NULL,
  147. `detail_unit_number` int NOT NULL,
  148. `arbitrate_threshold` double DEFAULT NULL COMMENT '仲裁阈值',
  149. PRIMARY KEY (`id`),
  150. UNIQUE KEY `IDX_PAPER_GROUP_UNIT_01` (`paper_id`,`detail_number`,`detail_unit_number`),
  151. KEY `IDX_PAPER_GROUP_UNIT_02` (`group_id`)
  152. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  153. -- ----------------------------
  154. -- Table structure for mps_privilege
  155. -- ----------------------------
  156. DROP TABLE IF EXISTS `mps_privilege`;
  157. CREATE TABLE `mps_privilege` (
  158. `id` bigint NOT NULL AUTO_INCREMENT,
  159. `create_time` datetime DEFAULT NULL,
  160. `update_time` datetime DEFAULT NULL,
  161. `creator_id` bigint DEFAULT NULL,
  162. `updater_id` bigint DEFAULT NULL,
  163. `code` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  164. `description` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  165. `ext1` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  166. `ext2` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  167. `ext3` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  168. `ext4` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  169. `ext5` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  170. `name` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  171. `parent_id` bigint DEFAULT NULL,
  172. `seq` int DEFAULT NULL,
  173. PRIMARY KEY (`id`),
  174. UNIQUE KEY `IDX_PRIVILEGE_01` (`code`)
  175. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  176. -- ----------------------------
  177. -- Table structure for mps_role
  178. -- ----------------------------
  179. DROP TABLE IF EXISTS `mps_role`;
  180. CREATE TABLE `mps_role` (
  181. `id` bigint NOT NULL AUTO_INCREMENT,
  182. `create_time` datetime DEFAULT NULL,
  183. `update_time` datetime DEFAULT NULL,
  184. `creator_id` bigint DEFAULT NULL,
  185. `updater_id` bigint DEFAULT NULL,
  186. `code` varchar(255) COLLATE utf8_bin NOT NULL,
  187. `name` varchar(255) COLLATE utf8_bin NOT NULL,
  188. `school_id` bigint NOT NULL,
  189. PRIMARY KEY (`id`),
  190. UNIQUE KEY `IDX_ROLE_01` (`school_id`,`code`)
  191. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  192. -- ----------------------------
  193. -- Table structure for mps_role_privilege_relation
  194. -- ----------------------------
  195. DROP TABLE IF EXISTS `mps_role_privilege_relation`;
  196. CREATE TABLE `mps_role_privilege_relation` (
  197. `school_id` bigint NOT NULL,
  198. `role_id` bigint NOT NULL,
  199. `privilege_id` bigint NOT NULL,
  200. `create_time` datetime DEFAULT NULL,
  201. `update_time` datetime DEFAULT NULL,
  202. `creator_id` bigint DEFAULT NULL,
  203. `updater_id` bigint DEFAULT NULL,
  204. PRIMARY KEY (`school_id`,`role_id`,`privilege_id`)
  205. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  206. -- ----------------------------
  207. -- Table structure for mps_school
  208. -- ----------------------------
  209. DROP TABLE IF EXISTS `mps_school`;
  210. CREATE TABLE `mps_school` (
  211. `id` bigint NOT NULL AUTO_INCREMENT,
  212. `create_time` datetime DEFAULT NULL,
  213. `update_time` datetime DEFAULT NULL,
  214. `creator_id` bigint DEFAULT NULL,
  215. `updater_id` bigint DEFAULT NULL,
  216. `contacts` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  217. `enable` bit(1) NOT NULL,
  218. `name` varchar(255) COLLATE utf8_bin NOT NULL,
  219. `code` varchar(255) COLLATE utf8_bin NOT NULL,
  220. `access_key` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  221. `access_secret` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  222. `region` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  223. `telephone` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  224. PRIMARY KEY (`id`),
  225. UNIQUE KEY `IDX_SCHOOL_01` (`code`)
  226. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  227. -- ----------------------------
  228. -- Table structure for mps_user
  229. -- ----------------------------
  230. DROP TABLE IF EXISTS `mps_user`;
  231. CREATE TABLE `mps_user` (
  232. `id` bigint NOT NULL AUTO_INCREMENT,
  233. `create_time` datetime DEFAULT NULL,
  234. `update_time` datetime DEFAULT NULL,
  235. `creator_id` bigint DEFAULT NULL,
  236. `updater_id` bigint DEFAULT NULL,
  237. `enable` bit(1) NOT NULL,
  238. `login_name` varchar(255) COLLATE utf8_bin NOT NULL,
  239. `name` varchar(255) COLLATE utf8_bin NOT NULL,
  240. `password` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  241. `role_id` bigint NOT NULL,
  242. `school_id` bigint NOT NULL,
  243. PRIMARY KEY (`id`),
  244. UNIQUE KEY `IDX_USER_01` (`login_name`)
  245. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  246. -- ----------------------------
  247. -- Table structure for mps_user_course_relation
  248. -- ----------------------------
  249. DROP TABLE IF EXISTS `mps_user_course_relation`;
  250. CREATE TABLE `mps_user_course_relation` (
  251. `user_id` bigint NOT NULL,
  252. `course_id` bigint NOT NULL,
  253. `create_time` datetime DEFAULT NULL,
  254. `update_time` datetime DEFAULT NULL,
  255. `creator_id` bigint DEFAULT NULL,
  256. `updater_id` bigint DEFAULT NULL,
  257. PRIMARY KEY (`user_id`,`course_id`)
  258. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  259. INSERT INTO `mps_wxapp_access_token` (`id`,`expires_time`) VALUES (1,-1);
  260. INSERT INTO `mps_school` (`id`,`code`, `create_time`, `update_time`, `enable`, `name`) VALUES (1,'qmth', now(), now(), 1, '启明泰和');
  261. INSERT INTO `mps_privilege` (`id`, `create_time`, `update_time`, `code`, `description`, `ext1`, `ext2`, `ext3`, `ext4`, `ext5`, `name`, `parent_id`, `seq`) VALUES (1, now(), now(), 'index_school', NULL, 'menu', NULL, NULL, NULL, '/struct/school', '学校管理', NULL, 1);
  262. INSERT INTO `mps_privilege` (`id`, `create_time`, `update_time`, `code`, `description`, `ext1`, `ext2`, `ext3`, `ext4`, `ext5`, `name`, `parent_id`, `seq`) VALUES (2, now(), now(), 'exam_manage', '', 'menu', '', '', '', '', '考试管理', NULL, 2);
  263. INSERT INTO `mps_privilege` (`id`, `create_time`, `update_time`, `code`, `description`, `ext1`, `ext2`, `ext3`, `ext4`, `ext5`, `name`, `parent_id`, `seq`) VALUES (3, now(), now(), 'index_exam', '', 'menu', '', '', '', '/struct/exam', '考试批次管理', 2, 1);
  264. INSERT INTO `mps_privilege` (`id`, `create_time`, `update_time`, `code`, `description`, `ext1`, `ext2`, `ext3`, `ext4`, `ext5`, `name`, `parent_id`, `seq`) VALUES (4, now(), now(), 'index_paper', '', 'menu', '', '', '', '/struct/paper', '科目试卷结构', 2, 2);
  265. INSERT INTO `mps_privilege` (`id`, `create_time`, `update_time`, `code`, `description`, `ext1`, `ext2`, `ext3`, `ext4`, `ext5`, `name`, `parent_id`, `seq`) VALUES (5, now(), now(), 'index_user', '', 'menu', '', '', '', '/struct/user', '用户管理', NULL, 3);
  266. INSERT INTO `mps_role` (`id`, `create_time`, `update_time`, `code`, `name`, `school_id`) VALUES (1, now(), now(), 'SUPER_ADMIN', '超级管理员', -1);
  267. INSERT INTO `mps_role` (`id`, `create_time`, `update_time`, `code`, `name`, `school_id`) VALUES (2, now(), now(), 'SCHOOL_ADMIN', '机构管理员', -1);
  268. INSERT INTO `mps_role` (`id`, `create_time`, `update_time`, `code`, `name`, `school_id`) VALUES (3, now(), now(), 'SECTION_LEADER', '科组长', -1);
  269. INSERT INTO `mps_role_privilege_relation` (`privilege_id`, `role_id`, `school_id`, `create_time`, `update_time`) VALUES (1, 2, -1, now(), now());
  270. INSERT INTO `mps_role_privilege_relation` (`privilege_id`, `role_id`, `school_id`, `create_time`, `update_time`) VALUES (2, 2, -1, now(), now());
  271. INSERT INTO `mps_role_privilege_relation` (`privilege_id`, `role_id`, `school_id`, `create_time`, `update_time`) VALUES (3, 2, -1, now(), now());
  272. INSERT INTO `mps_role_privilege_relation` (`privilege_id`, `role_id`, `school_id`, `create_time`, `update_time`) VALUES (4, 2, -1, now(), now());
  273. INSERT INTO `mps_role_privilege_relation` (`privilege_id`, `role_id`, `school_id`, `create_time`, `update_time`) VALUES (5, 2, -1, now(), now());
  274. INSERT INTO `mps_user` (`id`, `create_time`, `update_time`, `enable`, `login_name`, `name`, `password`, `school_id`, `role_id`) VALUES (1, now(), now(), 1, 'admin1', '超管1', UPPER(SHA2('0',256)), 1, 1);
  275. INSERT INTO `mps_user` (`id`, `create_time`, `update_time`, `enable`, `login_name`, `name`, `password`, `school_id`, `role_id`) VALUES (2, now(), now(), 1, 'admin2', '超管2', UPPER(SHA2('0',256)), 1, 1);
  276. INSERT INTO `mps_user` (`id`, `create_time`, `update_time`, `enable`, `login_name`, `name`, `password`, `school_id`, `role_id`) VALUES (3, now(), now(), 1, 'admin3', '超管3', UPPER(SHA2('0',256)), 1, 1);
  277. INSERT INTO `mps_user` (`id`, `create_time`, `update_time`, `enable`, `login_name`, `name`, `password`, `school_id`, `role_id`) VALUES (4, now(), now(), 1, 'admin4', '超管4', UPPER(SHA2('0',256)), 1, 1);
  278. INSERT INTO `mps_user` (`id`, `create_time`, `update_time`, `enable`, `login_name`, `name`, `password`, `school_id`, `role_id`) VALUES (5, now(), now(), 1, 'admin5', '超管5', UPPER(SHA2('0',256)), 1, 1);