init.sql 13 KB

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