textbook_sql.sql 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481
  1. -- ----------------------------
  2. -- 2025-01-20 10:36
  3. -- 需要进行课程管理的班级
  4. -- ----------------------------
  5. drop table if exists base_class_admin_course;
  6. create table `base_class_admin_course`
  7. (
  8. id bigint not null comment '主键编号'
  9. primary key,
  10. create_user_id bigint null comment '创建人',
  11. create_date datetime null comment '创建时间',
  12. modify_user_id bigint null comment '修改人',
  13. modify_date datetime null comment '修改时间',
  14. delete_mark int not null comment '删除标记',
  15. enabled_mark int not null comment '有效标志',
  16. sort_code int null comment '序号',
  17. remark varchar(1000) null comment '备注',
  18. class_id bigint null comment '班级id(base_class)',
  19. base_semester_id bigint null comment '学期id'
  20. ) engine = innodb
  21. default charset = utf8mb4
  22. collate = utf8mb4_0900_ai_ci comment ='需要进行课程管理的班级';
  23. -- ----------------------------
  24. -- 2024-12-13 14:36
  25. -- 教材基础信息表
  26. -- ----------------------------
  27. drop table if exists textbook;
  28. create table `textbook`
  29. (
  30. id bigint not null comment '主键编号'
  31. primary key,
  32. create_user_id bigint null comment '创建人',
  33. create_date datetime null comment '创建时间',
  34. modify_user_id bigint null comment '修改人',
  35. modify_date datetime null comment '修改时间',
  36. delete_mark int not null comment '删除标记',
  37. enabled_mark int not null comment '有效标志',
  38. sort_code int null comment '序号',
  39. subject_group_id bigint not null comment '学科组管理编号(subject_group)',
  40. course_subject_id bigint not null comment '课程编号(base_course_subject)',
  41. use_type int null default 1 comment '使用类型(单位:学期)',
  42. issn varchar(200) not null unique comment '国际标准刊号',
  43. isbn varchar(200) null unique comment '国际标准书号',
  44. book_name varchar(200) not null comment '书名',
  45. publishing_house varchar(200) null default '/' comment '出版社',
  46. editor_in_chief varchar(200) null default '/' comment '主编',
  47. version varchar(100) null default '/' comment '版本',
  48. is_textbook_plan int null default 0 comment '是否为规划教材',
  49. textbook_type varchar(20) null comment '教材分类(xjr_dictionary_item[textbook_type])',
  50. specifications_models varchar(100) null default '/' comment '规格型号',
  51. publishing_date date null comment '出版日期',
  52. is_secd int null default 0 comment '是否校企合作开发教材',
  53. category varchar(50) null default '/' comment '分类号',
  54. plan_batch varchar(50) null default '/' comment '规划批次',
  55. work_total_count int null default 0 comment '编著作总数',
  56. textbook_category varchar(30) null default '/' comment '教材类型',
  57. price decimal(10, 2) null default 0 comment '定价(元)',
  58. discount float null default 10 comment '预估折扣',
  59. discount_price decimal(10, 2) null default 0 comment '预估折扣后价格(元)'
  60. ) engine = innodb
  61. default charset = utf8mb4
  62. collate = utf8mb4_0900_ai_ci comment ='教材基础信息表';
  63. -- ----------------------------
  64. -- 2024-12-13 14:36
  65. -- 教材征订记录表
  66. -- ----------------------------
  67. drop table if exists textbook_subscription;
  68. create table `textbook_subscription`
  69. (
  70. id bigint not null comment '主键编号'
  71. primary key,
  72. create_user_id bigint null comment '创建人',
  73. create_date datetime null comment '创建时间',
  74. modify_user_id bigint null comment '修改人',
  75. modify_date datetime null comment '修改时间',
  76. delete_mark int not null comment '删除标记',
  77. enabled_mark int not null comment '有效标志',
  78. sort_code int null comment '序号',
  79. remark varchar(1000) null comment '备注',
  80. base_semester_id bigint not null comment '学期id(base_semester)',
  81. subscription_method int not null comment '征订方式(1:按班级征订 2:按教材征订)',
  82. base_class_ids varchar(1000) null comment '按班级征订征订的班级主键(base_class)',
  83. sum int null default 0 comment '征订教材总数',
  84. status int null default 0 comment '征订状态(1:结束 0:未结束)'
  85. ) engine = innodb
  86. default charset = utf8mb4
  87. collate = utf8mb4_0900_ai_ci comment ='教材教辅征订记录表';
  88. -- ----------------------------
  89. -- 2024-12-13 14:36
  90. -- 教材征订记录与班级关联表
  91. -- ----------------------------
  92. drop table if exists textbook_subscription_class;
  93. create table `textbook_subscription_class`
  94. (
  95. id bigint not null comment '主键编号'
  96. primary key,
  97. create_user_id bigint null comment '创建人',
  98. create_date datetime null comment '创建时间',
  99. modify_user_id bigint null comment '修改人',
  100. modify_date datetime null comment '修改时间',
  101. delete_mark int not null comment '删除标记',
  102. enabled_mark int not null comment '有效标志',
  103. sort_code int null comment '序号',
  104. remark varchar(1000) null comment '备注',
  105. textbook_subscription_id bigint not null comment '教材征订记录表id(textbook_subscription)',
  106. base_class_id bigint not null comment '按班级征订中征订的班级主键(base_class)'
  107. ) engine = innodb
  108. default charset = utf8mb4
  109. collate = utf8mb4_0900_ai_ci comment ='教材征订记录与班级关联表';
  110. -- ----------------------------
  111. -- 2024-12-13 14:36
  112. -- 教材征订记录详情表
  113. -- ----------------------------
  114. drop table if exists textbook_subscription_item;
  115. create table `textbook_subscription_item`
  116. (
  117. id bigint not null comment '主键编号'
  118. primary key,
  119. create_user_id bigint null comment '创建人',
  120. create_date datetime null comment '创建时间',
  121. modify_user_id bigint null comment '修改人',
  122. modify_date datetime null comment '修改时间',
  123. delete_mark int not null comment '删除标记',
  124. enabled_mark int not null comment '有效标志',
  125. sort_code int null comment '序号',
  126. textbook_subscription_id bigint not null comment '教材教辅增订记录表主键(textbook_subscription)',
  127. textbook_id bigint null comment '教材表主键(textbook)',
  128. student_num int null default 0 comment '学生用书征订数量',
  129. teacher_num int null default 0 comment '教师用书征订数量',
  130. discount float null default 10 comment '实际折扣',
  131. price decimal(10, 2) null default 0 comment '实际价格(元)',
  132. in_stock_num int null default 0 comment '当前征订任务征订项入库数量',
  133. out_stock_num int null default 0 comment '当前征订任务征订项出库数量',
  134. alteration_type int null default 0 comment '变更类型(0:未变更,1:学生用书征订数量,2:教师用书征订数量,3:变更课程,)'
  135. ) engine = innodb
  136. default charset = utf8mb4
  137. collate = utf8mb4_0900_ai_ci comment ='教材征订记录详情表';
  138. -- ----------------------------
  139. -- 2024-12-13 14:36
  140. -- 教材征订记录详情变更记录表
  141. -- ----------------------------
  142. drop table if exists textbook_subscription_item_history;
  143. create table `textbook_subscription_item_history`
  144. (
  145. id bigint not null comment '主键编号'
  146. primary key,
  147. create_user_id bigint null comment '创建人',
  148. create_date datetime null comment '创建时间',
  149. modify_user_id bigint null comment '修改人',
  150. modify_date datetime null comment '修改时间',
  151. delete_mark int not null comment '删除标记',
  152. enabled_mark int not null comment '有效标志',
  153. sort_code int null comment '序号',
  154. textbook_subscription_id bigint not null comment '教材教辅征订编号',
  155. textbook_subscription_item_id bigint not null comment '教材教辅征订项编号',
  156. old_textbook_id bigint null comment '教材表主键(textbook)',
  157. old_student_num int null default 0 comment '学生用书征订数量',
  158. old_teacher_num int null default 0 comment '教师用书征订数量',
  159. old_discount float null default 10 comment '实际折扣',
  160. old_price decimal(10, 2) null default 0 comment '实际价格(元)',
  161. old_in_stock_num int null default 0 comment '当前征订任务征订项入库数量',
  162. old_out_stock_num int null default 0 comment '当前征订任务征订项出库数量',
  163. new_textbook_id bigint null comment '教材表主键(textbook)',
  164. new_student_num int null default 0 comment '学生用书征订数量',
  165. new_teacher_num int null default 0 comment '教师用书征订数量',
  166. new_discount float null default 10 comment '实际折扣',
  167. new_price decimal(10, 2) null default 0 comment '实际价格(元)',
  168. new_in_stock_num int null default 0 comment '当前征订任务征订项入库数量',
  169. new_out_stock_num int null default 0 comment '当前征订任务征订项出库数量',
  170. history_version int default 0 null comment '当前征订项变更历史记录版本',
  171. alteration_type int null default 0 comment '变更类型(0:未变更,1:学生用书征订数量,2:教师用书征订数量,3:变更课程,4:学生用书征订数量和教师用书征订数量)'
  172. ) engine = innodb
  173. default charset = utf8mb4
  174. collate = utf8mb4_0900_ai_ci comment ='教材教辅征订项变更历史';
  175. -- ----------------------------
  176. -- 2024-12-13 14:36
  177. -- 教材入库记录
  178. -- ----------------------------
  179. drop table if exists textbook_warehouse_record;
  180. create table `textbook_warehouse_record`
  181. (
  182. id bigint not null comment '主键编号'
  183. primary key,
  184. create_user_id bigint null comment '创建人',
  185. create_date datetime null comment '创建时间',
  186. modify_user_id bigint null comment '修改人',
  187. modify_date datetime null comment '修改时间',
  188. delete_mark int not null comment '删除标记',
  189. enabled_mark int not null comment '有效标志',
  190. sort_code int null comment '序号',
  191. warehouse_mode varchar(20) null comment '入库方式(xjr_dictionary_item[warehouse_mode])',
  192. data_id bigint null comment '数据编号(根据入库方式,编号来自不同数据表)',
  193. data_item_id bigint null comment '数据项项编号(根据入库方式,编号来自不同数据表)',
  194. textbook_id bigint null comment '教材管理编号',
  195. price decimal(10, 2) null comment '定价(元)',
  196. warehouse_number int null comment '入库数量',
  197. source varchar(200) null comment '来源',
  198. discount float null comment '实际折扣',
  199. subtotal decimal(10, 2) null comment '实际价格(元)',
  200. total_price decimal(10, 2) null comment '总价(元)',
  201. remark varchar(1000) null comment '备注'
  202. ) engine = innodb
  203. default charset = utf8mb4
  204. collate = utf8mb4_0900_ai_ci comment ='教材入库记录';
  205. -- ----------------------------
  206. -- 2024-12-13 14:36
  207. -- 教材申领
  208. -- ----------------------------
  209. drop table if exists wf_textbook_claim;
  210. create table `wf_textbook_claim`
  211. (
  212. id bigint not null comment '主键编号'
  213. primary key,
  214. create_user_id bigint null comment '创建人',
  215. create_date datetime null comment '创建时间',
  216. modify_user_id bigint null comment '修改人',
  217. modify_date datetime null comment '修改时间',
  218. delete_mark int not null comment '删除标记',
  219. enabled_mark int not null comment '有效标志',
  220. sort_code int null comment '序号',
  221. applicant_user_id bigint null comment '申请人',
  222. base_semester_id bigint null comment '学期id(base_semester)',
  223. claim_type varchar(20) null comment '申领类型(xjr_dictionary_item[claim_type])',
  224. -- 班主任帮学生申请领取或者学生自己申请领取
  225. class_id bigint null comment '班级编号',
  226. student_user_id bigint null comment '负责领取学生编号',
  227. claim_address varchar(1000) null comment '领取地点',
  228. receive_user_id varchar(1000) null comment '代领取人',
  229. claim_user_id bigint null comment '实际领取用户编号(申请人帮领取人申请去领取)',
  230. status int default 0 not null comment '状态(1:结束 0:未结束)'
  231. ) engine = innodb
  232. default charset = utf8mb4
  233. collate = utf8mb4_0900_ai_ci comment ='教材申领';
  234. -- ----------------------------
  235. -- 2024-12-13 14:36
  236. -- 教材申领项
  237. -- ----------------------------
  238. drop table if exists wf_textbook_claim_item;
  239. create table `wf_textbook_claim_item`
  240. (
  241. id bigint not null comment '主键编号'
  242. primary key,
  243. create_user_id bigint null comment '创建人',
  244. create_date datetime null comment '创建时间',
  245. modify_user_id bigint null comment '修改人',
  246. modify_date datetime null comment '修改时间',
  247. delete_mark int not null comment '删除标记',
  248. enabled_mark int not null comment '有效标志',
  249. sort_code int null comment '序号',
  250. wf_textbook_claim_id bigint null comment '教材申领编号',
  251. textbook_id bigint null comment '教材管理编号',
  252. applicant_number int default 0 null comment '申请数量',
  253. issue_number int default 0 null comment '已发放数量'
  254. ) engine = innodb
  255. default charset = utf8mb4
  256. collate = utf8mb4_0900_ai_ci comment ='教材申领项';
  257. -- ----------------------------
  258. -- 2024-12-13 14:36
  259. -- 教材领取人员
  260. -- ----------------------------
  261. drop table if exists textbook_claim_user;
  262. create table `textbook_claim_user`
  263. (
  264. id bigint not null comment '主键编号'
  265. primary key,
  266. create_user_id bigint null comment '创建人',
  267. create_date datetime null comment '创建时间',
  268. modify_user_id bigint null comment '修改人',
  269. modify_date datetime null comment '修改时间',
  270. delete_mark int not null comment '删除标记',
  271. enabled_mark int not null comment '有效标志',
  272. sort_code int null comment '序号',
  273. wf_textbook_claim_id bigint null comment '教材申领编号',
  274. user_id bigint null comment '用户编号',
  275. user_type int default 2 null comment '用户类型(1:学生 2=教师)'
  276. ) engine = innodb
  277. default charset = utf8mb4
  278. collate = utf8mb4_0900_ai_ci comment ='教材领取人员';
  279. -- ----------------------------
  280. -- 2024-12-13 14:36
  281. -- 教材出库记录
  282. -- ----------------------------
  283. drop table if exists textbook_issue_record;
  284. create table `textbook_issue_record`
  285. (
  286. id bigint not null comment '主键编号'
  287. primary key,
  288. create_user_id bigint null comment '创建人',
  289. create_date datetime null comment '创建时间',
  290. modify_user_id bigint null comment '修改人',
  291. modify_date datetime null comment '修改时间',
  292. delete_mark int not null comment '删除标记',
  293. enabled_mark int not null comment '有效标志',
  294. sort_code int null comment '序号',
  295. base_semester_id bigint null comment '学期主键id',
  296. order_number varchar(256) not null comment '出库单号(标识+当前时间(YYYYMMDDHHmmss)+三位序号+当前申领项出库次数(-n))',
  297. textbook_warehouse_record_id bigint null comment '关联入库主键',
  298. issue_mode varchar(20) null comment '出库方式(xjr_dictionary_item[issue_mode])',
  299. data_id bigint null comment '数据编号(根据出库方式,编号来自不同数据表)',
  300. data_item_id bigint null comment '数据项项编号(根据出库方式,编号来自不同数据表)',
  301. textbook_id bigint null comment '教材管理编号',
  302. issue_number int null default 0 comment '出库数量',
  303. recede_number int null default 0 comment '领取后退书数量',
  304. actual_issue_number int null default 0 comment '实际出库数量',
  305. actual_total_price decimal(10, 2) null default 0 null comment '实际出库总金额',
  306. receive_user_id bigint null comment '领取用户编号',
  307. issue_user_id bigint null comment '出库用户编号',
  308. remark varchar(1000) null comment '备注'
  309. ) engine = innodb
  310. default charset = utf8mb4
  311. collate = utf8mb4_0900_ai_ci comment ='教材出库记录';
  312. -- ----------------------------
  313. -- 2024-12-13 14:36
  314. -- 学生教材认领记录
  315. -- ----------------------------
  316. drop table if exists textbook_student_claim;
  317. create table `textbook_student_claim`
  318. (
  319. id bigint not null comment '主键编号'
  320. primary key,
  321. create_user_id bigint null comment '创建人',
  322. create_date datetime null comment '创建时间',
  323. modify_user_id bigint null comment '修改人',
  324. modify_date datetime null comment '修改时间',
  325. delete_mark int not null comment '删除标记',
  326. enabled_mark int not null comment '有效标志',
  327. sort_code int null comment '序号',
  328. base_semester_id bigint null comment '学期id(base_semester)',
  329. class_id bigint null comment '班级编号',
  330. student_user_id bigint null comment '学生用户编号',
  331. textbook_id bigint null comment '教材管理编号',
  332. is_claim int default 0 not null comment '是否领取(1:已领取 0:未领取)',
  333. remark varchar(1000) null comment '备注'
  334. ) engine = innodb
  335. default charset = utf8mb4
  336. collate = utf8mb4_0900_ai_ci comment ='学生教材认领记录';
  337. -- ----------------------------
  338. -- 2024-12-13 14:36
  339. -- 退书申请
  340. -- ----------------------------
  341. drop table if exists wf_textbook_recede;
  342. create table `wf_textbook_recede`
  343. (
  344. id bigint not null comment '主键编号'
  345. primary key,
  346. create_user_id bigint null comment '创建人',
  347. create_date datetime null comment '创建时间',
  348. modify_user_id bigint null comment '修改人',
  349. modify_date datetime null comment '修改时间',
  350. delete_mark int not null comment '删除标记',
  351. enabled_mark int not null comment '有效标志',
  352. sort_code int null comment '序号',
  353. applicant_user_id bigint null comment '申请人',
  354. is_stu_flag int null comment '是否是学生',
  355. is_head_tea_flag int null comment '是否是班主任',
  356. is_class_recede_flag int null comment '是否是班主任为班级退书',
  357. recede_type varchar(20) null comment '退书类型(xjr_dictionary_item[recede_type])',
  358. base_semester_id bigint null comment '学期id(base_semester)',
  359. class_id bigint null comment '班级编号',
  360. recede_address varchar(1000) null comment '退还地点',
  361. status int default 0 not null comment '状态(1:结束 0:未结束)'
  362. ) engine = innodb
  363. default charset = utf8mb4
  364. collate = utf8mb4_0900_ai_ci comment ='退书申请';
  365. -- ----------------------------
  366. -- 2024-12-13 14:36
  367. -- 退书申请项
  368. -- ----------------------------
  369. drop table if exists wf_textbook_recede_item;
  370. create table `wf_textbook_recede_item`
  371. (
  372. id bigint not null comment '主键编号'
  373. primary key,
  374. create_user_id bigint null comment '创建人',
  375. create_date datetime null comment '创建时间',
  376. modify_user_id bigint null comment '修改人',
  377. modify_date datetime null comment '修改时间',
  378. delete_mark int not null comment '删除标记',
  379. enabled_mark int not null comment '有效标志',
  380. sort_code int null comment '序号',
  381. wf_textbook_recede_id bigint null comment '退书申请编号',
  382. textbook_issue_record_id bigint null comment '出库记录主键',
  383. textbook_issue_order_number varchar(256) null comment '出库订单号',
  384. textbook_id bigint null comment '教材管理编号',
  385. textbook_name varchar(256) null comment '教材名字',
  386. number int null comment '数量'
  387. ) engine = innodb
  388. default charset = utf8mb4
  389. collate = utf8mb4_0900_ai_ci comment ='退书申请项';
  390. -- ----------------------------
  391. -- 2025-02-17 14:36
  392. -- 教材折扣变更记录
  393. -- ----------------------------
  394. drop table if exists textbook_discount_alter_record;
  395. create table `textbook_discount_alter_record`
  396. (
  397. id bigint not null comment '主键编号'
  398. primary key,
  399. create_user_id bigint null comment '创建人',
  400. create_date datetime null comment '创建时间',
  401. modify_user_id bigint null comment '修改人',
  402. modify_date datetime null comment '修改时间',
  403. delete_mark int not null comment '删除标记',
  404. enabled_mark int not null comment '有效标志',
  405. sort_code int null comment '序号',
  406. textbook_warehouse_record_id bigint null comment '入库编号',
  407. old_discount double null default 10 comment '旧的折扣',
  408. new_discount double null default 10 comment '新的折扣'
  409. ) engine = innodb
  410. default charset = utf8mb4
  411. collate = utf8mb4_0900_ai_ci comment ='教材折扣变更记录';
  412. alter table wf_textbook_recede_item
  413. add textbook_issue_order_number varchar(256) null comment '出库订单号' after textbook_issue_record_id;