init.sql 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  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. PRIMARY KEY (`id`),
  128. UNIQUE KEY `IDX_PAPER_GROUP_01` (`paper_id`,`number`)
  129. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  130. -- ----------------------------
  131. -- Table structure for mps_paper_group_unit
  132. -- ----------------------------
  133. DROP TABLE IF EXISTS `mps_paper_group_unit`;
  134. CREATE TABLE `mps_paper_group_unit` (
  135. `id` bigint NOT NULL AUTO_INCREMENT,
  136. `create_time` datetime DEFAULT NULL,
  137. `update_time` datetime DEFAULT NULL,
  138. `creator_id` bigint DEFAULT NULL,
  139. `updater_id` bigint DEFAULT NULL,
  140. `group_id` bigint NOT NULL,
  141. `paper_id` bigint NOT NULL,
  142. `detail_number` int NOT NULL,
  143. `detail_unit_number` int NOT NULL,
  144. PRIMARY KEY (`id`),
  145. UNIQUE KEY `IDX_PAPER_GROUP_UNIT_01` (`paper_id`,`detail_number`,`detail_unit_number`),
  146. KEY `IDX_PAPER_GROUP_UNIT_02` (`group_id`)
  147. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  148. -- ----------------------------
  149. -- Table structure for mps_privilege
  150. -- ----------------------------
  151. DROP TABLE IF EXISTS `mps_privilege`;
  152. CREATE TABLE `mps_privilege` (
  153. `id` bigint NOT NULL AUTO_INCREMENT,
  154. `create_time` datetime DEFAULT NULL,
  155. `update_time` datetime DEFAULT NULL,
  156. `creator_id` bigint DEFAULT NULL,
  157. `updater_id` bigint DEFAULT NULL,
  158. `code` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  159. `description` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  160. `ext1` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  161. `ext2` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  162. `ext3` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  163. `ext4` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  164. `ext5` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  165. `name` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  166. `parent_id` bigint DEFAULT NULL,
  167. `seq` int DEFAULT NULL,
  168. PRIMARY KEY (`id`),
  169. UNIQUE KEY `IDX_PRIVILEGE_01` (`code`)
  170. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  171. -- ----------------------------
  172. -- Table structure for mps_role
  173. -- ----------------------------
  174. DROP TABLE IF EXISTS `mps_role`;
  175. CREATE TABLE `mps_role` (
  176. `id` bigint NOT NULL AUTO_INCREMENT,
  177. `create_time` datetime DEFAULT NULL,
  178. `update_time` datetime DEFAULT NULL,
  179. `creator_id` bigint DEFAULT NULL,
  180. `updater_id` bigint DEFAULT NULL,
  181. `code` varchar(255) COLLATE utf8_bin NOT NULL,
  182. `name` varchar(255) COLLATE utf8_bin NOT NULL,
  183. `school_id` bigint NOT NULL,
  184. PRIMARY KEY (`id`),
  185. UNIQUE KEY `IDX_ROLE_01` (`school_id`,`code`)
  186. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  187. -- ----------------------------
  188. -- Table structure for mps_role_privilege_relation
  189. -- ----------------------------
  190. DROP TABLE IF EXISTS `mps_role_privilege_relation`;
  191. CREATE TABLE `mps_role_privilege_relation` (
  192. `school_id` bigint NOT NULL,
  193. `role_id` bigint NOT NULL,
  194. `privilege_id` bigint NOT NULL,
  195. `create_time` datetime DEFAULT NULL,
  196. `update_time` datetime DEFAULT NULL,
  197. `creator_id` bigint DEFAULT NULL,
  198. `updater_id` bigint DEFAULT NULL,
  199. PRIMARY KEY (`school_id`,`role_id`,`privilege_id`)
  200. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  201. -- ----------------------------
  202. -- Table structure for mps_school
  203. -- ----------------------------
  204. DROP TABLE IF EXISTS `mps_school`;
  205. CREATE TABLE `mps_school` (
  206. `id` bigint NOT NULL AUTO_INCREMENT,
  207. `create_time` datetime DEFAULT NULL,
  208. `update_time` datetime DEFAULT NULL,
  209. `creator_id` bigint DEFAULT NULL,
  210. `updater_id` bigint DEFAULT NULL,
  211. `contacts` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  212. `enable` bit(1) NOT NULL,
  213. `name` varchar(255) COLLATE utf8_bin NOT NULL,
  214. `code` varchar(255) COLLATE utf8_bin NOT NULL,
  215. `access_key` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  216. `access_secret` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  217. `region` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  218. `telephone` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  219. PRIMARY KEY (`id`),
  220. UNIQUE KEY `IDX_SCHOOL_01` (`code`)
  221. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  222. -- ----------------------------
  223. -- Table structure for mps_user
  224. -- ----------------------------
  225. DROP TABLE IF EXISTS `mps_user`;
  226. CREATE TABLE `mps_user` (
  227. `id` bigint NOT NULL AUTO_INCREMENT,
  228. `create_time` datetime DEFAULT NULL,
  229. `update_time` datetime DEFAULT NULL,
  230. `creator_id` bigint DEFAULT NULL,
  231. `updater_id` bigint DEFAULT NULL,
  232. `enable` bit(1) NOT NULL,
  233. `login_name` varchar(255) COLLATE utf8_bin NOT NULL,
  234. `name` varchar(255) COLLATE utf8_bin NOT NULL,
  235. `password` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  236. `role_id` bigint NOT NULL,
  237. `school_id` bigint NOT NULL,
  238. PRIMARY KEY (`id`),
  239. UNIQUE KEY `IDX_USER_01` (`login_name`)
  240. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  241. -- ----------------------------
  242. -- Table structure for mps_user_course_relation
  243. -- ----------------------------
  244. DROP TABLE IF EXISTS `mps_user_course_relation`;
  245. CREATE TABLE `mps_user_course_relation` (
  246. `user_id` bigint NOT NULL,
  247. `course_id` bigint NOT NULL,
  248. `create_time` datetime DEFAULT NULL,
  249. `update_time` datetime DEFAULT NULL,
  250. `creator_id` bigint DEFAULT NULL,
  251. `updater_id` bigint DEFAULT NULL,
  252. PRIMARY KEY (`user_id`,`course_id`)
  253. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  254. INSERT INTO `mps_wxapp_access_token` (`id`) VALUES (1);
  255. INSERT INTO `mps_school` (`id`,`code`, `create_time`, `update_time`, `enable`, `name`) VALUES (1,'qmth', now(), now(), 1, '启明泰和');
  256. 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);
  257. 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);
  258. 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);
  259. 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);
  260. 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);
  261. INSERT INTO `mps_role` (`id`, `create_time`, `update_time`, `code`, `name`, `school_id`) VALUES (1, now(), now(), 'SUPER_ADMIN', '超级管理员', -1);
  262. INSERT INTO `mps_role` (`id`, `create_time`, `update_time`, `code`, `name`, `school_id`) VALUES (2, now(), now(), 'SCHOOL_ADMIN', '机构管理员', -1);
  263. INSERT INTO `mps_role` (`id`, `create_time`, `update_time`, `code`, `name`, `school_id`) VALUES (3, now(), now(), 'SECTION_LEADER', '科组长', -1);
  264. INSERT INTO `mps_role_privilege_relation` (`privilege_id`, `role_id`, `school_id`, `create_time`, `update_time`) VALUES (1, 2, -1, now(), now());
  265. INSERT INTO `mps_role_privilege_relation` (`privilege_id`, `role_id`, `school_id`, `create_time`, `update_time`) VALUES (2, 2, -1, now(), now());
  266. INSERT INTO `mps_role_privilege_relation` (`privilege_id`, `role_id`, `school_id`, `create_time`, `update_time`) VALUES (3, 2, -1, now(), now());
  267. INSERT INTO `mps_role_privilege_relation` (`privilege_id`, `role_id`, `school_id`, `create_time`, `update_time`) VALUES (4, 2, -1, now(), now());
  268. INSERT INTO `mps_role_privilege_relation` (`privilege_id`, `role_id`, `school_id`, `create_time`, `update_time`) VALUES (5, 2, -1, now(), now());
  269. 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);
  270. 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);
  271. 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);
  272. 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);
  273. 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);