03-logistics-module.sql 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. /*
  2. 后勤管理模块数据库结构
  3. 业务域:后勤管理相关表
  4. 包含表:hq_hall_info, hq_hall_reservation, hq_sat_answer, hq_sat_category,
  5. hq_sat_detail, hq_sat_option, hq_sat_question, hq_sat_record,
  6. hq_sat_survey, hq_sat_survey_question
  7. 模块说明:
  8. - 报告厅预约管理:hq_hall_info, hq_hall_reservation
  9. - 满意度调查系统:hq_sat_* 相关表
  10. 创建时间:2025-01-08
  11. 维护人员:项目开发团队
  12. */
  13. SET NAMES utf8mb4;
  14. SET FOREIGN_KEY_CHECKS = 0;
  15. -- ----------------------------
  16. -- Table structure for hq_hall_info
  17. -- ----------------------------
  18. DROP TABLE IF EXISTS `hq_hall_info`;
  19. CREATE TABLE `hq_hall_info` (
  20. `id` bigint(20) NOT NULL COMMENT '主键ID',
  21. `tenant_id` varchar(20) NOT NULL DEFAULT '000000' COMMENT '租户编号',
  22. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  23. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  24. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  25. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  26. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  27. `deleted` tinyint(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  28. `hall_name` varchar(100) NOT NULL COMMENT '报告厅名称',
  29. `hall_image` text COMMENT '报告厅图片url',
  30. `hall_status` char(1) NOT NULL DEFAULT '1' COMMENT '报告厅状态:0-不可用,1-正常',
  31. `hall_description` text COMMENT '报告厅描述',
  32. PRIMARY KEY (`id`),
  33. KEY `idx_tenant_id` (`tenant_id`),
  34. KEY `idx_hall_status` (`hall_status`),
  35. KEY `idx_deleted` (`deleted`),
  36. KEY `idx_create_time` (`create_time`)
  37. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='报告厅信息表';
  38. -- ----------------------------
  39. -- Table structure for hq_hall_reservation
  40. -- ----------------------------
  41. DROP TABLE IF EXISTS `hq_hall_reservation`;
  42. CREATE TABLE `hq_hall_reservation` (
  43. `id` bigint(20) NOT NULL COMMENT '主键ID',
  44. `tenant_id` varchar(20) NOT NULL DEFAULT '000000' COMMENT '租户编号',
  45. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  46. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  47. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  48. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  49. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  50. `deleted` tinyint(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  51. `hall_id` bigint(20) NOT NULL COMMENT '报告厅ID,关联hq_hall_info.id',
  52. `hall_name` varchar(100) NOT NULL COMMENT '报告厅名称',
  53. `start_time` datetime NOT NULL COMMENT '开始时间',
  54. `end_time` datetime NOT NULL COMMENT '结束时间',
  55. `reservation_purpose` varchar(200) NOT NULL COMMENT '预约用途',
  56. `applicant_id` bigint(20) NOT NULL COMMENT '申请人id,关联sys_user.id',
  57. `applicant_name` varchar(50) NOT NULL COMMENT '申请人姓名',
  58. `applicant_phone` varchar(20) DEFAULT NULL COMMENT '申请人电话',
  59. `status` char(1) NOT NULL DEFAULT '0' COMMENT '预约状态:0-待审核,1-预约成功,2-预约失败',
  60. `audit_by` bigint(20) DEFAULT NULL COMMENT '审核人id,关联sys_user.id',
  61. `audit_name` varchar(50) DEFAULT NULL COMMENT '审核人姓名',
  62. `audit_time` datetime DEFAULT NULL COMMENT '审核时间',
  63. `audit_remark` varchar(500) DEFAULT NULL COMMENT '审核备注',
  64. PRIMARY KEY (`id`),
  65. KEY `idx_tenant_id` (`tenant_id`),
  66. KEY `idx_hall_id` (`hall_id`),
  67. KEY `idx_status` (`status`),
  68. KEY `idx_applicant_id` (`applicant_id`),
  69. KEY `idx_time_range` (`start_time`,`end_time`),
  70. KEY `idx_deleted` (`deleted`),
  71. KEY `idx_create_time` (`create_time`)
  72. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='报告厅预约表';
  73. -- ----------------------------
  74. -- Table structure for hq_sat_answer
  75. -- ----------------------------
  76. DROP TABLE IF EXISTS `hq_sat_answer`;
  77. CREATE TABLE `hq_sat_answer` (
  78. `id` bigint(20) NOT NULL COMMENT '主键ID',
  79. `tenant_id` varchar(20) NOT NULL DEFAULT '000000' COMMENT '租户编号',
  80. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  81. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  82. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  83. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  84. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  85. `deleted` tinyint(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  86. `record_id` bigint(20) NOT NULL COMMENT '答题记录ID,关联hq_sat_record.id',
  87. `question_id` bigint(20) NOT NULL COMMENT '题目ID,关联hq_sat_question.id',
  88. `question_type` char(1) NOT NULL COMMENT '题目类型(1单选题 2多选题 3问答题)',
  89. `option_id` bigint(20) DEFAULT NULL COMMENT '选项ID,关联hq_sat_option.id(单选题、多选题用,问答题为NULL)',
  90. `option_value` varchar(50) DEFAULT NULL COMMENT '选项值(A、B、C、D等)',
  91. `option_text` varchar(500) DEFAULT NULL COMMENT '选项文本内容',
  92. `answer_value` text COMMENT '答案值(单选题存选项值,多选题存逗号分隔选项值,问答题存文本内容)',
  93. `answer_score` int(11) DEFAULT '0' COMMENT '该答案得分',
  94. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  95. PRIMARY KEY (`id`),
  96. KEY `idx_tenant_id` (`tenant_id`),
  97. KEY `idx_record_id` (`record_id`),
  98. KEY `idx_question_id` (`question_id`),
  99. KEY `idx_question_type` (`question_type`),
  100. KEY `idx_option_id` (`option_id`),
  101. KEY `idx_record_question` (`record_id`,`question_id`),
  102. KEY `idx_deleted` (`deleted`),
  103. KEY `idx_create_time` (`create_time`)
  104. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='答题答案表';
  105. -- ----------------------------
  106. -- Table structure for hq_sat_category
  107. -- ----------------------------
  108. DROP TABLE IF EXISTS `hq_sat_category`;
  109. CREATE TABLE `hq_sat_category` (
  110. `id` bigint(20) NOT NULL COMMENT '主键ID',
  111. `tenant_id` varchar(20) NOT NULL DEFAULT '000000' COMMENT '租户编号',
  112. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  113. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  114. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  115. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  116. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  117. `deleted` tinyint(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  118. `category_code` varchar(50) NOT NULL COMMENT '分类编码',
  119. `category_name` varchar(100) NOT NULL COMMENT '分类名称',
  120. `category_desc` varchar(500) DEFAULT NULL COMMENT '分类描述',
  121. `sort_order` int(11) DEFAULT '0' COMMENT '排序',
  122. `status` char(1) DEFAULT '0' COMMENT '状态(0正常 1停用)',
  123. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  124. PRIMARY KEY (`id`),
  125. UNIQUE KEY `uk_category_code` (`category_code`,`tenant_id`,`deleted`),
  126. KEY `idx_tenant_id` (`tenant_id`),
  127. KEY `idx_status` (`status`),
  128. KEY `idx_sort_order` (`sort_order`),
  129. KEY `idx_deleted` (`deleted`),
  130. KEY `idx_create_time` (`create_time`)
  131. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='题目分类表';
  132. -- ----------------------------
  133. -- Table structure for hq_sat_detail
  134. -- ----------------------------
  135. DROP TABLE IF EXISTS `hq_sat_detail`;
  136. CREATE TABLE `hq_sat_detail` (
  137. `id` bigint(20) NOT NULL COMMENT '主键ID',
  138. `tenant_id` varchar(20) NOT NULL DEFAULT '000000' COMMENT '租户编号',
  139. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  140. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  141. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  142. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  143. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  144. `deleted` tinyint(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  145. `record_id` bigint(20) NOT NULL COMMENT '答题记录ID,关联hq_sat_record.id',
  146. `question_id` bigint(20) NOT NULL COMMENT '题目ID,关联hq_sat_question.id',
  147. `answer_score` int(11) DEFAULT '0' COMMENT '答案分数',
  148. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  149. PRIMARY KEY (`id`),
  150. UNIQUE KEY `uk_record_question` (`record_id`,`question_id`,`deleted`),
  151. KEY `idx_tenant_id` (`tenant_id`),
  152. KEY `idx_record_id` (`record_id`),
  153. KEY `idx_question_id` (`question_id`),
  154. KEY `idx_answer_score` (`answer_score`),
  155. KEY `idx_deleted` (`deleted`),
  156. KEY `idx_create_time` (`create_time`)
  157. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='答题详情表';
  158. -- ----------------------------
  159. -- Table structure for hq_sat_option
  160. -- ----------------------------
  161. DROP TABLE IF EXISTS `hq_sat_option`;
  162. CREATE TABLE `hq_sat_option` (
  163. `id` bigint(20) NOT NULL COMMENT '主键ID',
  164. `tenant_id` varchar(20) NOT NULL DEFAULT '000000' COMMENT '租户编号',
  165. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  166. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  167. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  168. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  169. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  170. `deleted` tinyint(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  171. `option_text` varchar(50) NOT NULL COMMENT '选项文本',
  172. `option_value` int(11) NOT NULL COMMENT '选项分值',
  173. `sort_order` int(11) DEFAULT '0' COMMENT '排序',
  174. `status` char(1) DEFAULT '0' COMMENT '状态(0正常 1停用)',
  175. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  176. PRIMARY KEY (`id`),
  177. KEY `idx_tenant_id` (`tenant_id`),
  178. KEY `idx_status` (`status`),
  179. KEY `idx_sort_order` (`sort_order`),
  180. KEY `idx_deleted` (`deleted`),
  181. KEY `idx_create_time` (`create_time`)
  182. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='评分选项表';
  183. -- ----------------------------
  184. -- Table structure for hq_sat_question
  185. -- ----------------------------
  186. DROP TABLE IF EXISTS `hq_sat_question`;
  187. CREATE TABLE `hq_sat_question` (
  188. `id` bigint(20) NOT NULL COMMENT '主键ID',
  189. `tenant_id` varchar(20) NOT NULL DEFAULT '000000' COMMENT '租户编号',
  190. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  191. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  192. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  193. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  194. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  195. `deleted` tinyint(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  196. `question_title` varchar(200) NOT NULL COMMENT '题目标题',
  197. `question_content` text COMMENT '题目内容(支持富文本)',
  198. `category_id` bigint(20) NOT NULL COMMENT '所属分类ID,关联hq_sat_category.id',
  199. `question_type` char(1) DEFAULT '1' COMMENT '题目类型(1单选题 2多选题 3问答题)',
  200. `is_required` tinyint(1) DEFAULT '1' COMMENT '是否必填(0否 1是)',
  201. `sort_order` int(11) DEFAULT '0' COMMENT '排序',
  202. `status` char(1) DEFAULT '0' COMMENT '状态(0正常 1停用)',
  203. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  204. PRIMARY KEY (`id`),
  205. KEY `idx_tenant_id` (`tenant_id`),
  206. KEY `idx_category_id` (`category_id`),
  207. KEY `idx_status` (`status`),
  208. KEY `idx_question_type` (`question_type`),
  209. KEY `idx_sort_order` (`sort_order`),
  210. KEY `idx_deleted` (`deleted`),
  211. KEY `idx_create_time` (`create_time`)
  212. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='题库表';
  213. -- ----------------------------
  214. -- Table structure for hq_sat_record
  215. -- ----------------------------
  216. DROP TABLE IF EXISTS `hq_sat_record`;
  217. CREATE TABLE `hq_sat_record` (
  218. `id` bigint(20) NOT NULL COMMENT '主键ID',
  219. `tenant_id` varchar(20) NOT NULL DEFAULT '000000' COMMENT '租户编号',
  220. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  221. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  222. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  223. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  224. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  225. `deleted` tinyint(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  226. `survey_id` bigint(20) NOT NULL COMMENT '问卷ID,关联hq_sat_survey.id',
  227. `user_id` bigint(20) DEFAULT NULL COMMENT '答题用户ID,关联sys_user.id(匿名时为NULL)',
  228. `user_type` char(1) NOT NULL COMMENT '用户类型(1学生 2教职工 3超级管理员)',
  229. `user_dept` varchar(100) DEFAULT NULL COMMENT '用户部门(匿名时为NULL)',
  230. `submit_time` datetime NOT NULL COMMENT '提交时间',
  231. `total_score` decimal(10,2) DEFAULT '0.00' COMMENT '总分',
  232. `avg_score` decimal(5,2) DEFAULT '0.00' COMMENT '平均分',
  233. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  234. PRIMARY KEY (`id`),
  235. KEY `idx_tenant_id` (`tenant_id`),
  236. KEY `idx_survey_id` (`survey_id`),
  237. KEY `idx_user_id` (`user_id`),
  238. KEY `idx_user_type` (`user_type`),
  239. KEY `idx_submit_time` (`submit_time`),
  240. KEY `idx_deleted` (`deleted`),
  241. KEY `idx_create_time` (`create_time`)
  242. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='答题记录表';
  243. -- ----------------------------
  244. -- Table structure for hq_sat_survey
  245. -- ----------------------------
  246. DROP TABLE IF EXISTS `hq_sat_survey`;
  247. CREATE TABLE `hq_sat_survey` (
  248. `id` bigint(20) NOT NULL COMMENT '主键ID',
  249. `tenant_id` varchar(20) NOT NULL DEFAULT '000000' COMMENT '租户编号',
  250. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  251. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  252. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  253. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  254. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  255. `deleted` tinyint(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  256. `survey_code` varchar(50) NOT NULL COMMENT '问卷编号',
  257. `survey_title` varchar(200) NOT NULL COMMENT '问卷标题',
  258. `survey_desc` varchar(1000) DEFAULT NULL COMMENT '问卷描述',
  259. `survey_instruction` text COMMENT '填写说明',
  260. `target_group` varchar(100) NOT NULL COMMENT '目标群体(1学生 2教职工 3全体)',
  261. `start_time` datetime NOT NULL COMMENT '开始时间',
  262. `end_time` datetime NOT NULL COMMENT '结束时间',
  263. `max_submit_times` int(11) DEFAULT '1' COMMENT '最大提交次数(0不限制)',
  264. `is_anonymous` tinyint(1) DEFAULT '0' COMMENT '是否匿名(0否 1是)',
  265. `is_published` tinyint(1) DEFAULT '0' COMMENT '是否发布(0否 1是)',
  266. `status` char(1) DEFAULT '0' COMMENT '状态(0草稿 1进行中 2已结束)',
  267. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  268. PRIMARY KEY (`id`),
  269. UNIQUE KEY `uk_survey_code` (`survey_code`,`tenant_id`,`deleted`),
  270. KEY `idx_tenant_id` (`tenant_id`),
  271. KEY `idx_target_group` (`target_group`),
  272. KEY `idx_time_range` (`start_time`,`end_time`),
  273. KEY `idx_status` (`status`),
  274. KEY `idx_deleted` (`deleted`),
  275. KEY `idx_create_time` (`create_time`)
  276. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='问卷表';
  277. -- ----------------------------
  278. -- Table structure for hq_sat_survey_question
  279. -- ----------------------------
  280. DROP TABLE IF EXISTS `hq_sat_survey_question`;
  281. CREATE TABLE `hq_sat_survey_question` (
  282. `id` bigint(20) NOT NULL COMMENT '主键ID',
  283. `tenant_id` varchar(20) NOT NULL DEFAULT '000000' COMMENT '租户编号',
  284. `create_dept` bigint(20) DEFAULT NULL COMMENT '创建部门',
  285. `create_by` bigint(20) DEFAULT NULL COMMENT '创建者',
  286. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  287. `update_by` bigint(20) DEFAULT NULL COMMENT '更新者',
  288. `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  289. `deleted` tinyint(1) DEFAULT '0' COMMENT '删除标志(0代表存在 1代表删除)',
  290. `survey_id` bigint(20) NOT NULL COMMENT '问卷ID,关联hq_sat_survey.id',
  291. `question_id` bigint(20) NOT NULL COMMENT '题目ID,关联hq_sat_question.id',
  292. `sort_order` int(11) DEFAULT '0' COMMENT '题目顺序',
  293. `weight` decimal(5,2) DEFAULT '1.00' COMMENT '题目权重',
  294. `is_required` tinyint(1) DEFAULT '1' COMMENT '是否必填(0否 1是)',
  295. `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  296. PRIMARY KEY (`id`),
  297. UNIQUE KEY `uk_survey_question` (`survey_id`,`question_id`,`deleted`),
  298. KEY `idx_tenant_id` (`tenant_id`),
  299. KEY `idx_survey_id` (`survey_id`),
  300. KEY `idx_question_id` (`question_id`),
  301. KEY `idx_sort_order` (`sort_order`),
  302. KEY `idx_deleted` (`deleted`),
  303. KEY `idx_create_time` (`create_time`)
  304. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='问卷题目关联表';
  305. SET FOREIGN_KEY_CHECKS = 1;