init.sql 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  1. -- ----------------------------
  2. -- Table structure for sc_answer_card
  3. -- ----------------------------
  4. DROP TABLE IF EXISTS `sc_answer_card`;
  5. CREATE TABLE `sc_answer_card`
  6. (
  7. `exam_id` bigint NOT NULL,
  8. `number` int NOT NULL,
  9. `subject_code` varchar(64) DEFAULT NULL,
  10. `subject_name` varchar(64) DEFAULT NULL,
  11. `paper_count` int NOT NULL,
  12. `path` varchar(255) NOT NULL,
  13. `md5` varchar(32) NOT NULL,
  14. `source` varchar(16) NOT NULL,
  15. `need_adapte` bit(1) NOT NULL,
  16. `single_page` bit(1) NOT NULL,
  17. `parameter` text DEFAULT NULL,
  18. `remark` varchar(255) DEFAULT NULL,
  19. `creator_id` bigint DEFAULT NULL,
  20. `updater_id` bigint DEFAULT NULL,
  21. `create_time` bigint DEFAULT NULL,
  22. `update_time` bigint DEFAULT NULL,
  23. PRIMARY KEY (`exam_id`, `number`)
  24. ) ENGINE = InnoDB
  25. DEFAULT CHARSET = utf8mb4;
  26. -- ----------------------------
  27. -- Table structure for sc_exam
  28. -- ----------------------------
  29. DROP TABLE IF EXISTS `sc_exam`;
  30. CREATE TABLE `sc_exam`
  31. (
  32. `id` bigint NOT NULL AUTO_INCREMENT,
  33. `school_id` bigint NOT NULL,
  34. `school_name` varchar(64) NOT NULL,
  35. `name` varchar(128) NOT NULL,
  36. `enable` bit(1) NOT NULL,
  37. `mode` varchar(16) NOT NULL,
  38. `scan_by_package` bit(1) NOT NULL,
  39. `allow_unexist_paper` bit(1) NOT NULL,
  40. `answer_front_card_type` int NOT NULL,
  41. `enable_single_page_answer` bit(1) NOT NULL,
  42. `answer_paper_number_figure` int NOT NULL,
  43. `enable_upload` bit(1) NOT NULL,
  44. `enable_sync_verify` bit(1) NOT NULL,
  45. `paper_type_barcode_content` text DEFAULT NULL,
  46. `absent_barcode_content` varchar(16) DEFAULT NULL,
  47. `creator_id` bigint DEFAULT NULL,
  48. `updater_id` bigint DEFAULT NULL,
  49. `create_time` bigint DEFAULT NULL,
  50. `update_time` bigint DEFAULT NULL,
  51. PRIMARY KEY (`id`),
  52. INDEX `school_enable` (`enable`, `school_id`)
  53. ) ENGINE = InnoDB
  54. DEFAULT CHARSET = utf8mb4;
  55. -- ----------------------------
  56. -- Table structure for sc_omr_task
  57. -- ----------------------------
  58. DROP TABLE IF EXISTS `sc_omr_task`;
  59. CREATE TABLE `sc_omr_task`
  60. (
  61. `id` bigint NOT NULL AUTO_INCREMENT,
  62. `exam_id` bigint NOT NULL,
  63. `group_id` bigint NOT NULL,
  64. `student_id` bigint NOT NULL,
  65. `paper_number` int NOT NULL,
  66. `paper_id` int NOT NULL,
  67. `card_number` int NOT NULL,
  68. `status` varchar(16) NOT NULL,
  69. `device` varchar(64) DEFAULT NULL,
  70. `pages` text NOT NULL,
  71. `creator_id` bigint DEFAULT NULL,
  72. `updater_id` bigint DEFAULT NULL,
  73. `create_time` bigint DEFAULT NULL,
  74. `update_time` bigint DEFAULT NULL,
  75. PRIMARY KEY (`id`),
  76. UNIQUE KEY `group_paper` (`group_id`, `paper_id`),
  77. KEY `exam_status` (`exam_id`, `status`, `student_id`)
  78. ) ENGINE = InnoDB
  79. DEFAULT CHARSET = utf8mb4;
  80. -- ----------------------------
  81. -- Table structure for sc_package_card
  82. -- ----------------------------
  83. DROP TABLE IF EXISTS `sc_package_card`;
  84. CREATE TABLE `sc_package_card`
  85. (
  86. `id` bigint NOT NULL AUTO_INCREMENT,
  87. `exam_id` bigint NOT NULL,
  88. `path` varchar(255) NOT NULL,
  89. `md5` varchar(32) NOT NULL,
  90. `source` varchar(16) NOT NULL,
  91. `creator_id` bigint DEFAULT NULL,
  92. `updater_id` bigint DEFAULT NULL,
  93. `create_time` bigint DEFAULT NULL,
  94. `update_time` bigint DEFAULT NULL,
  95. PRIMARY KEY (`id`),
  96. KEY `exam` (`exam_id`)
  97. ) ENGINE = InnoDB
  98. DEFAULT CHARSET = utf8mb4;
  99. -- ----------------------------
  100. -- Table structure for sc_package_task
  101. -- ----------------------------
  102. DROP TABLE IF EXISTS `sc_package_task`;
  103. CREATE TABLE `sc_package_task`
  104. (
  105. `id` bigint NOT NULL AUTO_INCREMENT,
  106. `exam_id` bigint NOT NULL,
  107. `package_code` varchar(64) NOT NULL,
  108. `status` varchar(16) NOT NULL,
  109. `device` varchar(64) NOT NULL,
  110. `creator_id` bigint DEFAULT NULL,
  111. `updater_id` bigint DEFAULT NULL,
  112. `create_time` bigint DEFAULT NULL,
  113. `update_time` bigint DEFAULT NULL,
  114. PRIMARY KEY (`id`),
  115. KEY `exam_package` (`exam_id`, `package_code`)
  116. ) ENGINE = InnoDB
  117. DEFAULT CHARSET = utf8mb4;
  118. -- ----------------------------
  119. -- Table structure for sc_scanner
  120. -- ----------------------------
  121. DROP TABLE IF EXISTS `sc_scanner`;
  122. CREATE TABLE `sc_scanner`
  123. (
  124. `device` varchar(64) NOT NULL,
  125. `last_login_time` bigint DEFAULT NULL,
  126. `create_time` bigint DEFAULT NULL,
  127. `update_time` bigint DEFAULT NULL,
  128. PRIMARY KEY (`device`)
  129. ) ENGINE = InnoDB
  130. DEFAULT CHARSET = utf8mb4;
  131. -- ----------------------------
  132. -- Table structure for ss_system_config
  133. -- ----------------------------
  134. DROP TABLE IF EXISTS `sc_system_config`;
  135. CREATE TABLE `sc_system_config`
  136. (
  137. `id` bigint NOT NULL AUTO_INCREMENT,
  138. `scanner_enable_login` bit(1) DEFAULT NULL,
  139. `scanner_password` varchar(16) DEFAULT NULL,
  140. `image_transfer_mode` varchar(16) DEFAULT NULL,
  141. `system_mode` varchar(16) NOT NULL,
  142. `client_version` varchar(16) DEFAULT NULL,
  143. `client_uri` varchar(255) DEFAULT NULL,
  144. `client_md5` varchar(32) DEFAULT NULL,
  145. `client_update_time` bigint DEFAULT NULL,
  146. `creator_id` bigint DEFAULT NULL,
  147. `updater_id` bigint DEFAULT NULL,
  148. `create_time` bigint DEFAULT NULL,
  149. `update_time` bigint DEFAULT NULL,
  150. PRIMARY KEY (`id`)
  151. ) ENGINE = InnoDB
  152. DEFAULT CHARSET = utf8mb4;
  153. DROP TABLE IF EXISTS `sc_package_result`;
  154. CREATE TABLE `sc_package_result`
  155. (
  156. `exam_id` bigint NOT NULL,
  157. `package_code` varchar(64) NOT NULL,
  158. `device` varchar(64) NOT NULL,
  159. `path` text NOT NULL,
  160. `assigned` bit(1) NOT NULL,
  161. `creator_id` bigint DEFAULT NULL,
  162. `updater_id` bigint DEFAULT NULL,
  163. `create_time` bigint DEFAULT NULL,
  164. `update_time` bigint DEFAULT NULL,
  165. `upload_time` bigint DEFAULT NULL,
  166. PRIMARY KEY (`exam_id`, `package_code`)
  167. ) ENGINE = InnoDB
  168. DEFAULT CHARSET = utf8mb4;
  169. DROP TABLE IF EXISTS `sc_scanner_card`;
  170. CREATE TABLE `sc_scanner_card`
  171. (
  172. `exam_id` bigint NOT NULL,
  173. `device` varchar(64) NOT NULL,
  174. `card_number` int NOT NULL,
  175. `creator_id` bigint DEFAULT NULL,
  176. `updater_id` bigint DEFAULT NULL,
  177. `create_time` bigint DEFAULT NULL,
  178. `update_time` bigint DEFAULT NULL,
  179. PRIMARY KEY (`exam_id`, `device`)
  180. ) ENGINE = InnoDB
  181. DEFAULT CHARSET = utf8mb4;
  182. DROP TABLE IF EXISTS `sc_batch`;
  183. CREATE TABLE `sc_batch`
  184. (
  185. `id` bigint NOT NULL AUTO_INCREMENT,
  186. `exam_id` bigint NOT NULL,
  187. `device` varchar(64) NOT NULL,
  188. `package_code` varchar(64) DEFAULT NULL,
  189. `scan_count` int NOT NULL,
  190. `assigned_count` int NOT NULL,
  191. `status` varchar(16) NOT NULL,
  192. `verify_status` varchar(16) DEFAULT NULL,
  193. `creator_id` bigint DEFAULT NULL,
  194. `updater_id` bigint DEFAULT NULL,
  195. `create_time` bigint DEFAULT NULL,
  196. `update_time` bigint DEFAULT NULL,
  197. PRIMARY KEY (`id`)
  198. ) ENGINE = InnoDB
  199. DEFAULT CHARSET = utf8mb4;
  200. DROP TABLE IF EXISTS `sc_paper`;
  201. CREATE TABLE `sc_paper`
  202. (
  203. `id` bigint NOT NULL AUTO_INCREMENT,
  204. `exam_id` bigint NOT NULL,
  205. `student_id` bigint NOT NULL,
  206. `batch_id` bigint NOT NULL,
  207. `card_number` int NOT NULL,
  208. `exam_number` varchar(128) NOT NULL,
  209. `number` int NOT NULL,
  210. `page_count` int NOT NULL,
  211. `mismatch` bit(1) NOT NULL,
  212. `assigned` bit(1) NOT NULL,
  213. `question_filled` bit(1) NOT NULL,
  214. `creator_id` bigint DEFAULT NULL,
  215. `updater_id` bigint DEFAULT NULL,
  216. `create_time` bigint DEFAULT NULL,
  217. `update_time` bigint DEFAULT NULL,
  218. PRIMARY KEY (`id`),
  219. UNIQUE KEY `batch_student_number` (`batch_id`, `student_id`, `number`)
  220. ) ENGINE = InnoDB
  221. DEFAULT CHARSET = utf8mb4;
  222. DROP TABLE IF EXISTS `sc_paper_page`;
  223. CREATE TABLE `sc_paper_page`
  224. (
  225. `paper_id` bigint NOT NULL,
  226. `page_index` int NOT NULL,
  227. `batch_id` bigint NOT NULL,
  228. `student_id` bigint NOT NULL,
  229. `exam_id` bigint NOT NULL,
  230. `absent` text DEFAULT NULL,
  231. `breach` text DEFAULT NULL,
  232. `paper_type` text DEFAULT NULL,
  233. `question` text DEFAULT NULL,
  234. `selective` text DEFAULT NULL,
  235. `sheet_path` varchar(255) NOT NULL,
  236. `slice_path` text DEFAULT NULL,
  237. `recog_data` longtext DEFAULT NULL,
  238. `create_time` bigint DEFAULT NULL,
  239. `update_time` bigint DEFAULT NULL,
  240. `creator_id` bigint DEFAULT NULL,
  241. `updater_id` bigint DEFAULT NULL,
  242. PRIMARY KEY (`paper_id`, `page_index`)
  243. ) ENGINE = InnoDB
  244. DEFAULT CHARSET = utf8mb4;
  245. DROP TABLE IF EXISTS `sc_paper_structure`;
  246. CREATE TABLE `sc_paper_structure`
  247. (
  248. `id` bigint NOT NULL AUTO_INCREMENT,
  249. `exam_id` bigint NOT NULL,
  250. `card_number` int NOT NULL,
  251. `paper_number` int NOT NULL,
  252. `page_index` int NOT NULL,
  253. `field` varchar(16) NOT NULL,
  254. `question_number` int NOT NULL,
  255. `single` bit(1) NOT NULL,
  256. `creator_id` bigint DEFAULT NULL,
  257. `updater_id` bigint DEFAULT NULL,
  258. `create_time` bigint DEFAULT NULL,
  259. `update_time` bigint DEFAULT NULL,
  260. PRIMARY KEY (`id`),
  261. UNIQUE KEY `IDX_PAPER_STRUCTURE_001` (`exam_id`, `card_number`, `paper_number`, `page_index`, `field`,
  262. `question_number`)
  263. ) ENGINE = InnoDB
  264. DEFAULT CHARSET = utf8mb4;
  265. DROP TABLE IF EXISTS `sc_omr_group`;
  266. CREATE TABLE `sc_omr_group`
  267. (
  268. `id` bigint NOT NULL AUTO_INCREMENT,
  269. `exam_id` bigint NOT NULL,
  270. `fixed` bit(1) NOT NULL,
  271. `stage` varchar(16) NOT NULL,
  272. `conditions` text NOT NULL,
  273. `total_count` int NOT NULL,
  274. `creator_id` bigint DEFAULT NULL,
  275. `updater_id` bigint DEFAULT NULL,
  276. `create_time` bigint DEFAULT NULL,
  277. `update_time` bigint DEFAULT NULL,
  278. PRIMARY KEY (`id`),
  279. KEY `exam_fixed` (`exam_id`, `fixed`)
  280. ) ENGINE = InnoDB
  281. DEFAULT CHARSET = utf8mb4;
  282. DROP TABLE IF EXISTS `sc_refix_batch`;
  283. CREATE TABLE `sc_refix_batch`
  284. (
  285. `id` bigint NOT NULL AUTO_INCREMENT,
  286. `exam_id` bigint NOT NULL,
  287. `card_number` int NOT NULL,
  288. `conditions` text NOT NULL,
  289. `update_slice` bit(1) NOT NULL,
  290. `total_count` int NOT NULL,
  291. `sucess_count` int NOT NULL,
  292. `finished` bit(1) NOT NULL,
  293. `creator_id` bigint DEFAULT NULL,
  294. `updater_id` bigint DEFAULT NULL,
  295. `create_time` bigint DEFAULT NULL,
  296. `update_time` bigint DEFAULT NULL,
  297. PRIMARY KEY (`id`)
  298. ) ENGINE = InnoDB
  299. DEFAULT CHARSET = utf8mb4;
  300. DROP TABLE IF EXISTS `sc_student`;
  301. CREATE TABLE `sc_student`
  302. (
  303. `id` bigint NOT NULL AUTO_INCREMENT,
  304. `exam_id` bigint NOT NULL,
  305. `exam_number` varchar(64) NOT NULL,
  306. `student_code` varchar(64) NOT NULL,
  307. `name` varchar(64) NOT NULL,
  308. `subject_code` varchar(64) NOT NULL,
  309. `package_code` varchar(64) DEFAULT NULL,
  310. `exam_site` varchar(64) DEFAULT NULL,
  311. `exam_room` varchar(64) DEFAULT NULL,
  312. `seat_number` varchar(16) DEFAULT NULL,
  313. `campus_name` varchar(64) DEFAULT NULL,
  314. `status` varchar(16) NOT NULL,
  315. `omr_absent` bit(1) NOT NULL,
  316. `question_filled` bit(1) NOT NULL,
  317. `assigned` bit(1) NOT NULL,
  318. `absent_suspect` bit(1) NOT NULL,
  319. `incomplete` bit(1) NOT NULL,
  320. `card_number` int DEFAULT NULL,
  321. `paper_type` varchar(16) NOT NULL,
  322. `file_upload_status` varchar(16) DEFAULT NULL,
  323. `data_upload_status` varchar(16) DEFAULT NULL,
  324. `creator_id` bigint DEFAULT NULL,
  325. `updater_id` bigint DEFAULT NULL,
  326. `create_time` bigint DEFAULT NULL,
  327. `update_time` bigint DEFAULT NULL,
  328. PRIMARY KEY (`id`),
  329. UNIQUE KEY `exam_number` (`exam_id`, `exam_number`),
  330. UNIQUE KEY `exam_student_subject` (`exam_id`, `student_code`, `subject_code`)
  331. ) ENGINE = InnoDB
  332. DEFAULT CHARSET = utf8mb4;
  333. DROP TABLE IF EXISTS `sc_student_paper`;
  334. CREATE TABLE `sc_student_paper`
  335. (
  336. `student_id` bigint NOT NULL,
  337. `paper_number` int NOT NULL,
  338. `paper_id` bigint NOT NULL,
  339. `creator_id` bigint DEFAULT NULL,
  340. `updater_id` bigint DEFAULT NULL,
  341. `create_time` bigint DEFAULT NULL,
  342. `update_time` bigint DEFAULT NULL,
  343. PRIMARY KEY (`student_id`, `paper_number`),
  344. UNIQUE KEY `paper_id` (`paper_id`)
  345. ) ENGINE = InnoDB
  346. DEFAULT CHARSET = utf8mb4;
  347. DROP TABLE IF EXISTS `sc_subject`;
  348. CREATE TABLE `sc_subject`
  349. (
  350. `exam_id` bigint NOT NULL,
  351. `code` varchar(64) NOT NULL,
  352. `name` varchar(64) NOT NULL,
  353. `creator_id` bigint DEFAULT NULL,
  354. `updater_id` bigint DEFAULT NULL,
  355. `create_time` bigint DEFAULT NULL,
  356. `update_time` bigint DEFAULT NULL,
  357. PRIMARY KEY (`exam_id`, `code`)
  358. ) ENGINE = InnoDB
  359. DEFAULT CHARSET = utf8mb4;
  360. DROP TABLE IF EXISTS `sc_file_property`;
  361. CREATE TABLE `sc_file_property`
  362. (
  363. `path` varchar(255) NOT NULL,
  364. `md5` varchar(32) NOT NULL,
  365. `exam_id` bigint NOT NULL,
  366. `create_time` bigint DEFAULT NULL,
  367. `update_time` bigint DEFAULT NULL,
  368. PRIMARY KEY (`path`)
  369. ) ENGINE = InnoDB
  370. DEFAULT CHARSET = utf8mb4;
  371. DROP TABLE IF EXISTS `sc_user`;
  372. CREATE TABLE `sc_user`
  373. (
  374. `id` int(11) NOT NULL AUTO_INCREMENT,
  375. `login_name` varchar(64) NOT NULL,
  376. `name` varchar(64) NOT NULL,
  377. `password` varchar(64) NOT NULL,
  378. `role` varchar(16) NOT NULL,
  379. `enable` tinyint(1) NOT NULL,
  380. `school_id` bigint NOT NULL,
  381. `creator_id` bigint DEFAULT NULL,
  382. `updater_id` bigint DEFAULT NULL,
  383. `create_time` bigint DEFAULT NULL,
  384. `update_time` bigint DEFAULT NULL,
  385. PRIMARY KEY (`id`),
  386. UNIQUE KEY `login_name` (`login_name`)
  387. ) ENGINE = InnoDB
  388. DEFAULT CHARSET = utf8mb4;