考试模块建表_mysql.txt 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. create table test_question_libary
  2. (
  3. test_question_libary_id varchar(36) not null comment '主键',
  4. name varchar(300) comment '题库名称',
  5. note varchar(500) comment '备注',
  6. parent_id varchar(36) comment '父级题库',
  7. is_vaild int comment '是否有效',
  8. createTime datetime,
  9. createUserId varchar(36),
  10. createUserName varchar(300),
  11. updateTime datetime,
  12. updateUserId varchar(36),
  13. updateUserName varchar(300),
  14. isPublic int,
  15. orderby int not null comment '排序',
  16. primary key (test_question_libary_id)
  17. );
  18. create table test_paper_libary
  19. (
  20. test_paper_libary_id varchar(36) not null comment '主键',
  21. test_paper_id varchar(36) comment '关联试卷',
  22. test_question_libary_id varchar(36) comment '关联题库',
  23. primary key (test_paper_libary_id)
  24. );
  25. alter table test_paper_libary add constraint FK_Reference_10 foreign key (test_question_libary_id)
  26. references test_question_libary (test_question_libary_id) on delete restrict on update restrict;
  27. alter table test_paper_libary add constraint FK_Reference_11 foreign key (test_paper_id)
  28. references test_paper (test_paper_id) on delete restrict on update restrict;
  29. create table test_base_question_type
  30. (
  31. base_question_type_id int not null auto_increment comment '主键',
  32. name varchar(300) comment '类型名',
  33. diplay_order int comment '排序',
  34. score int comment '分数',
  35. objective_type int comment '1、主观题
  36. 2、客观题',
  37. primary key (base_question_type_id)
  38. );
  39. alter table test_base_question_type comment '试题类型';
  40. create table test_question
  41. (
  42. test_question_Id varchar(36) not null comment '主键',
  43. base_question_type_id int comment '试题类型',
  44. content varchar(1000) comment '题干',
  45. note varchar(300) comment '备注',
  46. is_vaild int comment '是否有效',
  47. createTime datetime,
  48. createUserId varchar(36),
  49. createUserName varchar(300),
  50. updateTime datetime,
  51. updateUserId varchar(36),
  52. updateUserName varchar(300),
  53. difficulty int comment '试题难度字典(QuestionDifficulty)',
  54. primary key (test_question_Id)
  55. );
  56. alter table test_question comment '试题表';
  57. alter table test_question add constraint fk_testquestions2questiontype foreign key (base_question_type_id)
  58. references test_base_question_type (base_question_type_id) on delete restrict on update restrict;
  59. create table test_question_libary_question
  60. (
  61. libary_question_id varchar(36) not null comment '主键',
  62. test_question_Id varchar(36) comment '关联题目',
  63. test_question_libary_id varchar(36) comment '关联题库',
  64. primary key (libary_question_id)
  65. );
  66. alter table test_question_libary_question add constraint fk_question_libary_2question foreign key (test_question_Id)
  67. references test_question (test_question_Id) on delete restrict on update restrict;
  68. alter table test_question_libary_question add constraint fk_question_libary_question_2quetionlibary foreign key (test_question_libary_id)
  69. references test_question_libary (test_question_libary_id) on delete restrict on update restrict;
  70. create table test_question_provid_answer
  71. (
  72. provid_answer_id varchar(36) not null comment '主键',
  73. answer_name varchar(4000) comment '答案内容',
  74. orderby int comment '排序',
  75. test_question_Id varchar(36) comment '试题',
  76. isright int comment '是否正确答案',
  77. primary key (provid_answer_id)
  78. );
  79. alter table test_question_provid_answer comment '试题答案';
  80. alter table test_question_provid_answer add constraint FK_TEST_QUE_REFERENCE_TEST_QUE foreign key (test_question_Id)
  81. references test_question (test_question_Id) on delete restrict on update restrict;
  82. create table test_paper
  83. (
  84. test_paper_id varchar(36) not null comment '主键',
  85. PaperName varchar(200) comment '试卷名称',
  86. note varchar(500) comment '备注',
  87. is_vaild int comment '是否有效',
  88. paper_score decimal(8,2) comment '试卷分数',
  89. createTime datetime,
  90. createUserId varchar(36),
  91. createUserName varchar(300),
  92. updateTime datetime,
  93. updateUserId varchar(36),
  94. updateUserName varchar(300),
  95. paperType int comment '试卷类型:1、常规考试 2、新入职考试',
  96. limited_minutes int comment '考试时长',
  97. partyCode varchar(36) comment '所在组织',
  98. partyName varchar(300) comment '所在组织名称',
  99. primary key (test_paper_id)
  100. );
  101. create table test_paper_basetype
  102. (
  103. test_paper_basetype_id varchar(36) not null comment '主键',
  104. test_paper_id varchar(36) comment '试卷',
  105. paperType int comment '试卷类型:1、常规考试 2、新任专职党支部书记3、新任组织助理员4、新任宣传助理员',
  106. primary key (test_paper_basetype_id)
  107. );
  108. alter table test_paper_basetype comment '试卷类型';
  109. alter table test_paper_basetype add constraint FK_test_paper_basetype_ref_paper foreign key (test_paper_id)
  110. references test_paper (test_paper_id) on delete restrict on update restrict;
  111. create table test_paper_question_set
  112. (
  113. test_paper_question_set_id varchar(36) not null comment '主键',
  114. test_paper_id varchar(36) comment '试卷',
  115. test_question_Id varchar(36) comment '试题',
  116. score numeric(8,2) comment '分数',
  117. orderby int comment '排序',
  118. primary key (test_paper_question_set_id)
  119. );
  120. alter table test_paper_question_set add constraint fk_paperquestion2question foreign key (test_question_Id)
  121. references test_question (test_question_Id) on delete restrict on update restrict;
  122. alter table test_paper_question_set add constraint fk_paperquestion_2Paper foreign key (test_paper_id)
  123. references test_paper (test_paper_id) on delete restrict on update restrict;
  124. create table test_paper_type
  125. (
  126. test_paper_type_id varchar(36) not null comment '主键',
  127. test_paper_id varchar(36) comment '关联试卷',
  128. base_question_type_id int comment '试题类型',
  129. question_num int comment '取题数',
  130. primary key (test_paper_type_id)
  131. );
  132. alter table test_paper_type comment '试卷题型设置';
  133. alter table test_paper_type add constraint FK_Reference_12 foreign key (test_paper_id)
  134. references test_paper (test_paper_id) on delete restrict on update restrict;
  135. alter table test_paper_type add constraint FK_test_paper_type_ref_question_type foreign key (base_question_type_id)
  136. references test_base_question_type (base_question_type_id) on delete restrict on update restrict;
  137. create table test_onlinetest
  138. (
  139. onlinetest_id varchar(36) not null comment '主键',
  140. test_paper_id varchar(36) comment '试卷',
  141. test_name varchar(500) comment '考试名称',
  142. test_begin_date datetime comment '考试开始时间',
  143. test_end_date datetime comment '考试结束时间',
  144. limited_minutes int comment '考试时长',
  145. passingscore numeric(8,2) comment '及格分数',
  146. examiner varchar(36) comment '阅卷人',
  147. recordStatus numeric(2,0) comment '状态0:已删除',
  148. createTime datetime,
  149. createUserId varchar(36),
  150. createUserName varchar(300),
  151. updateTime datetime,
  152. updateUserId varchar(36),
  153. updateUserName varchar(300),
  154. publicParty varchar(300) comment '组织单位',
  155. note varchar(2000) comment '备注',
  156. partyCode varchar(36) comment '所在组织',
  157. partyName varchar(300) comment '所在组织名称',
  158. primary key (onlinetest_id)
  159. );
  160. alter table test_onlinetest comment '考试设置';
  161. alter table test_onlinetest add constraint FK_onlinetest_ref_test_paper foreign key (test_paper_id)
  162. references test_paper (test_paper_id) on delete restrict on update restrict;
  163. create table test_onlinetest_man
  164. (
  165. online_testman_id varchar(36) not null,
  166. onlinetest_id varchar(36) comment '考试',
  167. userId varchar(36) comment '参试人',
  168. userName varchar(36),
  169. score numeric(8,2) comment '分数',
  170. modified_score numeric(8,2) comment '修改后分数',
  171. test_begin_date datetime comment '考试开始时间',
  172. test_end_date datetime comment '考试结束时间',
  173. ranking numeric(3,0) comment '排名',
  174. recordStatus numeric(3,0) comment '1、待考试
  175. 2、考试中
  176. 3、已交卷
  177. 4、缺考
  178. 5、已公布成绩',
  179. primary key (online_testman_id)
  180. );
  181. alter table test_onlinetest_man comment '考生信息';
  182. alter table test_onlinetest_man add constraint FK_test_onlinetest_man_ref_onlinetest foreign key (onlinetest_id)
  183. references test_onlinetest (onlinetest_id) on delete restrict on update restrict;
  184. create table test_paper_difficulty
  185. (
  186. paper_difficulty_id varchar(36) not null,
  187. test_paper_id varchar(36) comment '关联试卷',
  188. difficulty int comment '试题难度(QuestionDifficulty)',
  189. primary key (paper_difficulty_id)
  190. );
  191. alter table test_paper_difficulty comment '试卷试题难度设置';
  192. alter table test_paper_difficulty add constraint FK_test_paper_difficulty_ref_test_paper foreign key (test_paper_id)
  193. references test_paper (test_paper_id) on delete restrict on update restrict;
  194. create table test_user_testinstance
  195. (
  196. user_test_instance_id varchar(36) not null comment '主键',
  197. online_testman_id varchar(36) comment '考生',
  198. test_question_Id varchar(36) not null comment '试题',
  199. score numeric(8,2) comment '分数',
  200. modified_score numeric(8,2) comment '修改后分数',
  201. primary key (user_test_instance_id)
  202. );
  203. alter table test_user_testinstance comment '题目得分';
  204. alter table test_user_testinstance add constraint FK_testinstance_ref_online_testman foreign key (online_testman_id)
  205. references test_onlinetest_man (online_testman_id) on delete restrict on update restrict;
  206. create table test_user_testinstance_answer
  207. (
  208. user_testinstance_answer_id varchar(36) not null comment '主键',
  209. user_test_instance_id varchar(36) comment '关联题目得分表',
  210. answers varchar(4000) comment '答案',
  211. ordber_by numeric(8,0) not null comment '排序',
  212. primary key (user_testinstance_answer_id)
  213. );
  214. alter table test_user_testinstance_answer comment '考生题目答案';
  215. alter table test_user_testinstance_answer add constraint FK_testinstance_answer_ref_test_instanc foreign key (user_test_instance_id)
  216. references test_user_testinstance (user_test_instance_id) on delete restrict on update restrict;