init.sql 13 KB

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