init.sql 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. DROP TABLE IF EXISTS `mps_wxapp_access_token`;
  2. CREATE TABLE `mps_wxapp_access_token` (
  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. `access_token` varchar(512) COLLATE utf8_bin DEFAULT NULL,
  9. `expires_time` bigint DEFAULT NULL,
  10. PRIMARY KEY (`id`)
  11. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  12. -- ----------------------------
  13. -- Table structure for mps_course
  14. -- ----------------------------
  15. DROP TABLE IF EXISTS `mps_course`;
  16. CREATE TABLE `mps_course` (
  17. `id` bigint NOT NULL AUTO_INCREMENT,
  18. `create_time` datetime DEFAULT NULL,
  19. `update_time` datetime DEFAULT NULL,
  20. `creator_id` bigint DEFAULT NULL,
  21. `updater_id` bigint DEFAULT NULL,
  22. `code` varchar(255) COLLATE utf8_bin NOT NULL,
  23. `name` varchar(255) COLLATE utf8_bin NOT NULL,
  24. `school_id` bigint NOT NULL,
  25. PRIMARY KEY (`id`),
  26. UNIQUE KEY `IDX_COURSE_01` (`school_id`,`code`)
  27. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  28. -- ----------------------------
  29. -- Table structure for mps_exam
  30. -- ----------------------------
  31. DROP TABLE IF EXISTS `mps_exam`;
  32. CREATE TABLE `mps_exam` (
  33. `id` bigint NOT NULL AUTO_INCREMENT,
  34. `create_time` datetime DEFAULT NULL,
  35. `update_time` datetime DEFAULT NULL,
  36. `creator_id` bigint DEFAULT NULL,
  37. `updater_id` bigint DEFAULT NULL,
  38. `exam_status` varchar(255) COLLATE utf8_bin NOT NULL,
  39. `name` varchar(255) COLLATE utf8_bin NOT NULL,
  40. `school_id` bigint NOT NULL,
  41. PRIMARY KEY (`id`),
  42. UNIQUE KEY `IDX_EXAM_01` (`school_id`,`name`)
  43. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  44. -- ----------------------------
  45. -- Table structure for mps_paper
  46. -- ----------------------------
  47. DROP TABLE IF EXISTS `mps_paper`;
  48. CREATE TABLE `mps_paper` (
  49. `id` bigint NOT NULL AUTO_INCREMENT,
  50. `create_time` datetime DEFAULT NULL,
  51. `update_time` datetime DEFAULT NULL,
  52. `creator_id` bigint DEFAULT NULL,
  53. `updater_id` bigint DEFAULT NULL,
  54. `course_id` bigint NOT NULL,
  55. `exam_id` bigint NOT NULL,
  56. `group_finish` bit(1) DEFAULT NULL,
  57. `group_info` text COLLATE utf8_bin,
  58. `objective_score` double DEFAULT NULL,
  59. `paper_type` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  60. `school_id` bigint NOT NULL,
  61. `struct_info` text COLLATE utf8_bin,
  62. `subjective_score` double DEFAULT NULL,
  63. `total_score` double DEFAULT NULL,
  64. PRIMARY KEY (`id`),
  65. UNIQUE KEY `IDX_PAPER_01` (`school_id`,`exam_id`,`course_id`)
  66. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  67. -- ----------------------------
  68. -- Table structure for mps_paper_detail
  69. -- ----------------------------
  70. DROP TABLE IF EXISTS `mps_paper_detail`;
  71. CREATE TABLE `mps_paper_detail` (
  72. `id` bigint NOT NULL AUTO_INCREMENT,
  73. `create_time` datetime DEFAULT NULL,
  74. `update_time` datetime DEFAULT NULL,
  75. `creator_id` bigint DEFAULT NULL,
  76. `updater_id` bigint DEFAULT NULL,
  77. `name` varchar(255) COLLATE utf8_bin NOT NULL,
  78. `number` int NOT NULL,
  79. `paper_id` bigint NOT NULL,
  80. PRIMARY KEY (`id`),
  81. UNIQUE KEY `IDX_PAPER_DETAIL_01` (`paper_id`,`number`)
  82. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  83. -- ----------------------------
  84. -- Table structure for mps_paper_detail_unit
  85. -- ----------------------------
  86. DROP TABLE IF EXISTS `mps_paper_detail_unit`;
  87. CREATE TABLE `mps_paper_detail_unit` (
  88. `id` bigint NOT NULL AUTO_INCREMENT,
  89. `create_time` datetime DEFAULT NULL,
  90. `update_time` datetime DEFAULT NULL,
  91. `creator_id` bigint DEFAULT NULL,
  92. `updater_id` bigint DEFAULT NULL,
  93. `detail_id` bigint NOT NULL,
  94. `detail_number` int NOT NULL,
  95. `number` int NOT NULL,
  96. `paper_id` bigint NOT NULL,
  97. `score` double NOT NULL,
  98. `score_step` double NOT NULL,
  99. PRIMARY KEY (`id`),
  100. UNIQUE KEY `IDX_PAPER_DETAIL_UNIT_01` (`paper_id`,`detail_id`,`number`)
  101. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  102. -- ----------------------------
  103. -- Table structure for mps_paper_group
  104. -- ----------------------------
  105. DROP TABLE IF EXISTS `mps_paper_group`;
  106. CREATE TABLE `mps_paper_group` (
  107. `id` bigint NOT NULL AUTO_INCREMENT,
  108. `create_time` datetime DEFAULT NULL,
  109. `update_time` datetime DEFAULT NULL,
  110. `creator_id` bigint DEFAULT NULL,
  111. `updater_id` bigint DEFAULT NULL,
  112. `number` int NOT NULL,
  113. `paper_id` bigint NOT NULL,
  114. PRIMARY KEY (`id`),
  115. UNIQUE KEY `IDX_PAPER_GROUP_01` (`paper_id`,`number`)
  116. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  117. -- ----------------------------
  118. -- Table structure for mps_paper_group_unit
  119. -- ----------------------------
  120. DROP TABLE IF EXISTS `mps_paper_group_unit`;
  121. CREATE TABLE `mps_paper_group_unit` (
  122. `id` bigint NOT NULL AUTO_INCREMENT,
  123. `create_time` datetime DEFAULT NULL,
  124. `update_time` datetime DEFAULT NULL,
  125. `creator_id` bigint DEFAULT NULL,
  126. `updater_id` bigint DEFAULT NULL,
  127. `group_id` bigint NOT NULL,
  128. `paper_id` bigint NOT NULL,
  129. `unit_id` bigint NOT NULL,
  130. PRIMARY KEY (`id`),
  131. UNIQUE KEY `IDX_PAPER_GROUP_UNIT_01` (`paper_id`,`group_id`,`unit_id`),
  132. UNIQUE KEY `IDX_PAPER_GROUP_UNIT_02` (`unit_id`)
  133. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  134. -- ----------------------------
  135. -- Table structure for mps_privilege
  136. -- ----------------------------
  137. DROP TABLE IF EXISTS `mps_privilege`;
  138. CREATE TABLE `mps_privilege` (
  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. `code` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  145. `description` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  146. `ext1` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  147. `ext2` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  148. `ext3` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  149. `ext4` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  150. `ext5` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  151. `name` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  152. `parent_id` bigint DEFAULT NULL,
  153. `seq` int DEFAULT NULL,
  154. PRIMARY KEY (`id`),
  155. UNIQUE KEY `IDX_PRIVILEGE_01` (`code`)
  156. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  157. -- ----------------------------
  158. -- Table structure for mps_role
  159. -- ----------------------------
  160. DROP TABLE IF EXISTS `mps_role`;
  161. CREATE TABLE `mps_role` (
  162. `id` bigint NOT NULL AUTO_INCREMENT,
  163. `create_time` datetime DEFAULT NULL,
  164. `update_time` datetime DEFAULT NULL,
  165. `creator_id` bigint DEFAULT NULL,
  166. `updater_id` bigint DEFAULT NULL,
  167. `code` varchar(255) COLLATE utf8_bin NOT NULL,
  168. `name` varchar(255) COLLATE utf8_bin NOT NULL,
  169. `school_id` bigint NOT NULL,
  170. PRIMARY KEY (`id`),
  171. UNIQUE KEY `IDX_ROLE_01` (`school_id`,`code`)
  172. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  173. -- ----------------------------
  174. -- Table structure for mps_role_privilege_relation
  175. -- ----------------------------
  176. DROP TABLE IF EXISTS `mps_role_privilege_relation`;
  177. CREATE TABLE `mps_role_privilege_relation` (
  178. `school_id` bigint NOT NULL,
  179. `role_id` bigint NOT NULL,
  180. `privilege_id` bigint NOT NULL,
  181. `create_time` datetime DEFAULT NULL,
  182. `update_time` datetime DEFAULT NULL,
  183. `creator_id` bigint DEFAULT NULL,
  184. `updater_id` bigint DEFAULT NULL,
  185. PRIMARY KEY (`school_id`,`role_id`,`privilege_id`)
  186. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  187. -- ----------------------------
  188. -- Table structure for mps_school
  189. -- ----------------------------
  190. DROP TABLE IF EXISTS `mps_school`;
  191. CREATE TABLE `mps_school` (
  192. `id` bigint NOT NULL AUTO_INCREMENT,
  193. `create_time` datetime DEFAULT NULL,
  194. `update_time` datetime DEFAULT NULL,
  195. `creator_id` bigint DEFAULT NULL,
  196. `updater_id` bigint DEFAULT NULL,
  197. `contacts` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  198. `enable` bit(1) NOT NULL,
  199. `name` varchar(255) COLLATE utf8_bin NOT NULL,
  200. `region` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  201. `telephone` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  202. PRIMARY KEY (`id`),
  203. UNIQUE KEY `IDX_SCHOOL_01` (`name`)
  204. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  205. -- ----------------------------
  206. -- Table structure for mps_user
  207. -- ----------------------------
  208. DROP TABLE IF EXISTS `mps_user`;
  209. CREATE TABLE `mps_user` (
  210. `id` bigint NOT NULL AUTO_INCREMENT,
  211. `create_time` datetime DEFAULT NULL,
  212. `update_time` datetime DEFAULT NULL,
  213. `creator_id` bigint DEFAULT NULL,
  214. `updater_id` bigint DEFAULT NULL,
  215. `enable` bit(1) NOT NULL,
  216. `login_name` varchar(255) COLLATE utf8_bin NOT NULL,
  217. `name` varchar(255) COLLATE utf8_bin NOT NULL,
  218. `password` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  219. `role_id` bigint NOT NULL,
  220. `school_id` bigint NOT NULL,
  221. PRIMARY KEY (`id`),
  222. UNIQUE KEY `IDX_USER_01` (`login_name`)
  223. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  224. -- ----------------------------
  225. -- Table structure for mps_user_course_relation
  226. -- ----------------------------
  227. DROP TABLE IF EXISTS `mps_user_course_relation`;
  228. CREATE TABLE `mps_user_course_relation` (
  229. `user_id` bigint NOT NULL,
  230. `course_id` bigint NOT NULL,
  231. `create_time` datetime DEFAULT NULL,
  232. `update_time` datetime DEFAULT NULL,
  233. `creator_id` bigint DEFAULT NULL,
  234. `updater_id` bigint DEFAULT NULL,
  235. PRIMARY KEY (`user_id`,`course_id`)
  236. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  237. INSERT INTO `mps_wxapp_access_token` (`id`) VALUES (1);
  238. INSERT INTO `mps_school` (`id`, `create_time`, `update_time`, `enable`, `name`) VALUES (1, now(), now(), 1, '启明泰和');
  239. 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);
  240. 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);
  241. 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);
  242. 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);
  243. 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);
  244. INSERT INTO `mps_role` (`id`, `create_time`, `update_time`, `code`, `name`, `school_id`) VALUES (1, now(), now(), 'SUPER_ADMIN', '超级管理员', -1);
  245. INSERT INTO `mps_role` (`id`, `create_time`, `update_time`, `code`, `name`, `school_id`) VALUES (2, now(), now(), 'SCHOOL_ADMIN', '机构管理员', -1);
  246. INSERT INTO `mps_role` (`id`, `create_time`, `update_time`, `code`, `name`, `school_id`) VALUES (3, now(), now(), 'SECTION_LEADER', '科组长', -1);
  247. INSERT INTO `mps_role_privilege_relation` (`privilege_id`, `role_id`, `school_id`, `create_time`, `update_time`) VALUES (1, 2, -1, now(), now());
  248. INSERT INTO `mps_role_privilege_relation` (`privilege_id`, `role_id`, `school_id`, `create_time`, `update_time`) VALUES (2, 2, -1, now(), now());
  249. INSERT INTO `mps_role_privilege_relation` (`privilege_id`, `role_id`, `school_id`, `create_time`, `update_time`) VALUES (3, 2, -1, now(), now());
  250. INSERT INTO `mps_role_privilege_relation` (`privilege_id`, `role_id`, `school_id`, `create_time`, `update_time`) VALUES (4, 2, -1, now(), now());
  251. INSERT INTO `mps_role_privilege_relation` (`privilege_id`, `role_id`, `school_id`, `create_time`, `update_time`) VALUES (5, 2, -1, now(), now());
  252. 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('autumn123',256)), 1, 1);
  253. 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('autumn123',256)), 1, 1);
  254. 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('autumn123',256)), 1, 1);
  255. 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('autumn123',256)), 1, 1);
  256. 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('autumn123',256)), 1, 1);