exam_reserve_db.sql 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. create table gk_user
  2. (
  3. id bigint not null auto_increment,
  4. create_time bigint not null comment '创建时间',
  5. update_time bigint not null comment '更新时间',
  6. enable bit(1) not null comment '是否启用',
  7. role varchar(20) not null comment '角色类型:学校管理员;教学点管理员',
  8. name varchar(50) not null comment '姓名',
  9. login_name varchar(50) not null comment '登录名',
  10. password varchar(32) not null comment '密码',
  11. mobile varchar(20) comment '联系方式',
  12. category_id bigint comment '所属教学点ID,角色为教学点管理员,必填',
  13. org_id bigint comment '所属租户机构ID(预留字段)',
  14. PRIMARY KEY (id)
  15. ) comment '用户表';
  16. create table gk_student
  17. (
  18. id bigint not null auto_increment,
  19. create_time bigint not null comment '创建时间',
  20. update_time bigint not null comment '更新时间',
  21. name varchar(50) not null comment '考生姓名',
  22. identity_number varchar(20) not null comment '证件号',
  23. student_code varchar(20) not null comment '学号',
  24. photo_path varchar(100) comment '头像相对路径',
  25. gender varchar(10) comment '性别',
  26. open_id varchar(50) comment '微信OID',
  27. uid varchar(50) comment '微信UID',
  28. apply_task_id bigint not null comment '所属预约任务ID',
  29. category_id bigint not null comment '所属教学点ID',
  30. apply_number int not null comment '允许预约时段数量',
  31. apply_finished bit(1) not null comment '预约时段是否全部完成',
  32. org_id bigint comment '所属租户机构ID(预留字段)',
  33. PRIMARY KEY (id)
  34. ) comment '考生表';
  35. create table gk_category
  36. (
  37. id bigint not null auto_increment,
  38. create_time bigint not null comment '创建时间',
  39. update_time bigint not null comment '更新时间',
  40. enable bit(1) not null comment '是否启用',
  41. parent_id bigint not null default 0 comment '父级ID,顶级值为0',
  42. code varchar(20) not null comment '分类代码',
  43. name varchar(50) not null comment '分类名称',
  44. level int not null comment '层级,第一级值为1',
  45. capacity int null default 0 comment '容量',
  46. PRIMARY KEY (id)
  47. ) comment '数据分类表';
  48. create table gk_exam_site
  49. (
  50. id bigint not null auto_increment,
  51. create_time bigint not null comment '创建时间',
  52. update_time bigint not null comment '更新时间',
  53. enable bit(1) not null comment '是否启用',
  54. code varchar(20) not null comment '考点代码',
  55. name varchar(100) not null comment '考点名称',
  56. category_id bigint not null comment '所属教学点ID',
  57. capacity int comment '机房容量',
  58. address varchar(200) comment '考点地址',
  59. guide longtext comment '考点指引',
  60. PRIMARY KEY (id)
  61. ) comment '考点表';
  62. create table gk_exam_room
  63. (
  64. id bigint not null auto_increment,
  65. create_time bigint not null comment '创建时间',
  66. update_time bigint not null comment '更新时间',
  67. enable bit(1) not null comment '是否启用',
  68. code varchar(20) not null comment '考场代码',
  69. name varchar(100) not null comment '考场名称',
  70. exam_site_id bigint not null comment '所属考点ID',
  71. address varchar(200) comment '考场地址',
  72. capacity int comment '机房容量',
  73. PRIMARY KEY (id)
  74. ) comment '考场表';
  75. create table gk_apply_task
  76. (
  77. id bigint not null auto_increment,
  78. create_time bigint not null comment '创建时间',
  79. update_time bigint not null comment '更新时间',
  80. enable bit(1) not null comment '是否启用',
  81. name varchar(50) not null comment '任务名称',
  82. allow_apply_days int not null comment '考前多少天,禁止考生自主预约',
  83. allow_apply_cancel_days int not null comment '考前多少天,禁止考生自主取消预约',
  84. self_apply_start_time bigint not null comment '自主预约起始时间,只能预约本教学点下的考点',
  85. self_apply_end_time bigint not null comment '自主预约截止时间,只能预约本教学点下的考点',
  86. open_apply_start_time bigint not null comment '开放式预约起始时间,可以在不同教学点间预约',
  87. open_apply_end_time bigint not null comment '开放式预约截止时间,可以在不同教学点间预约',
  88. notice longtext comment '考试说明',
  89. PRIMARY KEY (id)
  90. ) comment '预约任务表';
  91. create table gk_time_period
  92. (
  93. id bigint not null auto_increment,
  94. create_time bigint not null comment '创建时间',
  95. update_time bigint not null comment '更新时间',
  96. apply_task_id bigint not null comment '所属预约任务ID',
  97. start_time bigint not null comment '预约起始时间',
  98. end_time bigint not null comment '预约截止时间',
  99. PRIMARY KEY (id)
  100. ) comment '预约任务的时段表';
  101. create table gk_student_apply
  102. (
  103. id bigint not null auto_increment,
  104. create_time bigint not null comment '创建时间',
  105. update_time bigint not null comment '更新时间',
  106. student_id bigint not null comment '考生ID',
  107. exam_site_id bigint not null comment '预约的考点ID',
  108. exam_room_id bigint not null comment '预约的考场ID',
  109. time_period_id varchar(50) not null comment '预约时段ID',
  110. cancel bit(1) not null comment '是否取消预约',
  111. ticketNumber varchar(50) comment '准考证号',
  112. seatNumber varchar(20) comment '座位号',
  113. PRIMARY KEY (id)
  114. ) comment '考生预约记录表';
  115. create table gk_student_import_task
  116. (
  117. id bigint not null auto_increment,
  118. create_time bigint not null comment '创建时间',
  119. update_time bigint not null comment '更新时间',
  120. operate_id bigint not null comment '操作人ID',
  121. type varchar(20) not null comment '导入类型',
  122. status varchar(20) not null comment '执行状态',
  123. file_path varchar(200) not null comment '导入文件相对路径',
  124. message text comment '执行结果信息',
  125. PRIMARY KEY (id)
  126. ) comment '考生导入任务表';
  127. create table gk_operate_log
  128. (
  129. id bigint not null auto_increment,
  130. create_time bigint not null comment '创建时间',
  131. update_time bigint not null comment '更新时间',
  132. operate_id bigint not null comment '操作人ID',
  133. event_type varchar(20) not null comment '事件类型,如:考生取消预约、用户登录等',
  134. content text comment '操作内容(JSON)',
  135. PRIMARY KEY (id)
  136. ) comment '操作日志表';
  137. create table gk_system_property
  138. (
  139. id bigint not null auto_increment,
  140. create_time bigint not null comment '创建时间',
  141. update_time bigint not null comment '更新时间',
  142. `key` varchar(50) not null comment '属性键',
  143. value varchar(500) not null comment '属性值',
  144. PRIMARY KEY (id)
  145. ) comment '系统属性表';
  146. insert into gk_system_property(`key`, value, create_time, update_time)
  147. values ('ORG_TITLE', '广东开发大学', now(), now());
  148. insert into gk_system_property(`key`, value, create_time, update_time)
  149. values ('CATEGORY_LEVEL', '[{"level":1,"title":"城市"},{"level":2,"title":"教学点"}]', now(), now());
  150. insert into gk_user (role, name, login_name, password, mobile, category_id, org_id, enable, create_time, update_time)
  151. values ('ADMIN', '学校管理员', 'admin', UPPER(SHA2('123456', 256)), null, null, 1, 1, now(), now());