20240415_sql.sql 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. -- ------------------------------------------------
  2. -- 系统消息
  3. -- ------------------------------------------------
  4. DROP TABLE IF EXISTS system_update_message;
  5. CREATE TABLE `system_update_message` (
  6. `id` BIGINT NOT NULL,
  7. `create_user_id` BIGINT DEFAULT NULL,
  8. `create_date` DATETIME(3) DEFAULT NULL,
  9. `modify_user_id` BIGINT DEFAULT NULL,
  10. `modify_date` DATETIME(3) DEFAULT NULL,
  11. `delete_mark` INT DEFAULT NULL,
  12. `enabled_mark` INT DEFAULT NULL,
  13. `send_range` INT DEFAULT NULL COMMENT '发送范围(1:全体师生,2:全体教职工)',
  14. `title` VARCHAR(200) DEFAULT NULL COMMENT '消息标题',
  15. `title_color` VARCHAR(30) DEFAULT NULL COMMENT '标题颜色',
  16. `content` VARCHAR(1000) DEFAULT NULL COMMENT '消息内容',
  17. `status` INT DEFAULT 0 COMMENT '状态(0:未发布 1:已发布)',
  18. PRIMARY KEY (`id`) USING BTREE
  19. ) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='系统消息';
  20. -- ------------------------------------------------
  21. -- 系统消息
  22. -- ------------------------------------------------
  23. DROP TABLE IF EXISTS system_update_message_notice;
  24. CREATE TABLE `system_update_message_notice` (
  25. `id` BIGINT NOT NULL,
  26. `create_user_id` BIGINT DEFAULT NULL,
  27. `create_date` DATETIME(3) DEFAULT NULL,
  28. `modify_user_id` BIGINT DEFAULT NULL,
  29. `modify_date` DATETIME(3) DEFAULT NULL,
  30. `delete_mark` INT DEFAULT NULL,
  31. `enabled_mark` INT DEFAULT NULL,
  32. `system_update_message_id` BIGINT DEFAULT NULL COMMENT '系统消息(system_update_message)',
  33. `user_id` VARCHAR(200) DEFAULT NULL COMMENT '用户id(xjr_user)',
  34. `status` INT DEFAULT 0 COMMENT '状态(0:未读,1:已读)',
  35. PRIMARY KEY (`id`) USING BTREE
  36. ) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='系统消息通知表';
  37. -- ------------------------------------------------
  38. -- 学生插班
  39. -- ------------------------------------------------
  40. DROP TABLE IF EXISTS student_transfer;
  41. CREATE TABLE `student_transfer` (
  42. `id` BIGINT NOT NULL COMMENT '主键',
  43. `create_user_id` BIGINT DEFAULT NULL COMMENT '创建人',
  44. `create_date` DATETIME(3) DEFAULT NULL COMMENT '创建时间',
  45. `modify_user_id` BIGINT DEFAULT NULL COMMENT '修改人id',
  46. `modify_date` DATETIME(3) DEFAULT NULL COMMENT '修改日期',
  47. `delete_mark` INT DEFAULT NULL COMMENT '删除标记',
  48. `enabled_mark` INT DEFAULT NULL COMMENT '有效标记',
  49. `student_user_id` BIGINT DEFAULT NULL COMMENT '学生用户id',
  50. `gender` VARCHAR(20) DEFAULT NULL COMMENT '性别',
  51. `I_D_number` VARCHAR(100) DEFAULT NULL COMMENT '身份证号',
  52. `study_status` VARCHAR(20) DEFAULT NULL COMMENT '就读方式(xjr_dictionary_item[stduy_status])',
  53. `textbook_fees` VARCHAR(50) DEFAULT NULL COMMENT '教材费缴费情况',
  54. `homestay` VARCHAR(50) DEFAULT NULL COMMENT '住宿费缴费情况',
  55. `class_id` BIGINT DEFAULT NULL COMMENT '班级id',
  56. `teacher_id` BIGINT DEFAULT NULL COMMENT '班主任id',
  57. `status` INT DEFAULT '0' COMMENT '状态(0:未结束 1:结束)',
  58. PRIMARY KEY (`id`) USING BTREE
  59. ) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='学生插班';
  60. -- ------------------------------------------------
  61. -- 退学申请
  62. -- ------------------------------------------------
  63. DROP TABLE IF EXISTS student_drop_out;
  64. CREATE TABLE `student_drop_out` (
  65. `id` BIGINT NOT NULL COMMENT '主键',
  66. `create_user_id` BIGINT DEFAULT NULL COMMENT '创建人',
  67. `create_date` DATETIME(3) DEFAULT NULL COMMENT '创建时间',
  68. `modify_user_id` BIGINT DEFAULT NULL COMMENT '修改人id',
  69. `modify_date` DATETIME(3) DEFAULT NULL COMMENT '修改日期',
  70. `delete_mark` INT DEFAULT NULL COMMENT '删除标记',
  71. `enabled_mark` INT DEFAULT NULL COMMENT '有效标记',
  72. `student_user_id` BIGINT DEFAULT NULL COMMENT '学生用户id',
  73. `grade_id` BIGINT DEFAULT NULL COMMENT '年级id',
  74. `class_id` BIGINT DEFAULT NULL COMMENT '班级id',
  75. `I_D_number` VARCHAR(100) DEFAULT NULL COMMENT '身份证号',
  76. `drop_date` DATETIME DEFAULT NULL COMMENT '退学日期',
  77. `reason` VARCHAR(400) DEFAULT NULL COMMENT '请假原因',
  78. `folder_id` BIGINT DEFAULT NULL COMMENT '附件',
  79. `teacher_id` BIGINT DEFAULT NULL COMMENT '班主任id',
  80. `status` INT DEFAULT '0' COMMENT '状态(0:未结束 1:结束)',
  81. PRIMARY KEY (`id`) USING BTREE
  82. ) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='退学申请';
  83. -- ------------------------------------------------
  84. -- 学生请假
  85. -- ------------------------------------------------
  86. DROP TABLE IF EXISTS student_leave;
  87. CREATE TABLE `student_leave` (
  88. `id` BIGINT NOT NULL COMMENT '主键',
  89. `create_user_id` BIGINT DEFAULT NULL COMMENT '创建人',
  90. `create_date` DATETIME(3) DEFAULT NULL COMMENT '创建时间',
  91. `modify_user_id` BIGINT DEFAULT NULL COMMENT '修改人id',
  92. `modify_date` DATETIME(3) DEFAULT NULL COMMENT '修改日期',
  93. `delete_mark` INT DEFAULT NULL COMMENT '删除标记',
  94. `enabled_mark` INT DEFAULT NULL COMMENT '有效标记',
  95. `student_user_id` BIGINT DEFAULT NULL COMMENT '学生用户id',
  96. `class_id` BIGINT DEFAULT NULL COMMENT '班级id',
  97. `start_date` DATETIME DEFAULT NULL COMMENT '开始时间',
  98. `end_date` DATETIME DEFAULT NULL COMMENT '结束时间',
  99. `day_duration` FLOAT DEFAULT NULL COMMENT '时长(天)',
  100. `leave_type` VARCHAR(50) DEFAULT '' COMMENT '请假类型',
  101. `reason` VARCHAR(400) DEFAULT NULL COMMENT '请假原因',
  102. `folder_id` BIGINT DEFAULT NULL COMMENT '附件',
  103. `teacher_id` BIGINT DEFAULT NULL COMMENT '班主任id',
  104. `status` INT DEFAULT '0' COMMENT '状态(0:未结束 1:结束)',
  105. PRIMARY KEY (`id`) USING BTREE
  106. ) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='学生请假';
  107. -- ------------------------------------------------
  108. -- 学生转班
  109. -- ------------------------------------------------
  110. DROP TABLE IF EXISTS student_change_class;
  111. CREATE TABLE `student_change_class` (
  112. `id` BIGINT NOT NULL COMMENT '主键',
  113. `create_user_id` BIGINT DEFAULT NULL COMMENT '创建人',
  114. `create_date` DATETIME(3) DEFAULT NULL COMMENT '创建时间',
  115. `modify_user_id` BIGINT DEFAULT NULL COMMENT '修改人id',
  116. `modify_date` DATETIME(3) DEFAULT NULL COMMENT '修改日期',
  117. `delete_mark` INT DEFAULT NULL COMMENT '删除标记',
  118. `enabled_mark` INT DEFAULT NULL COMMENT '有效标记',
  119. `before_class_id` BIGINT DEFAULT NULL COMMENT '转出班级id',
  120. `student_user_id` BIGINT DEFAULT NULL COMMENT '学生用户id',
  121. `gender` VARCHAR(20) DEFAULT NULL COMMENT '性别',
  122. `I_D_number` VARCHAR(100) DEFAULT NULL COMMENT '身份证号',
  123. `textbook_fees` VARCHAR(20) DEFAULT NULL COMMENT '教材费缴费情况',
  124. `homestay` VARCHAR(20) DEFAULT NULL COMMENT '住宿费缴费情况',
  125. `after_class_id` BIGINT DEFAULT NULL COMMENT '转入班级id',
  126. `teacher_id` BIGINT DEFAULT NULL COMMENT '班主任id',
  127. `status` INT DEFAULT '0' COMMENT '状态(0:未结束 1:结束)',
  128. PRIMARY KEY (`id`) USING BTREE
  129. ) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='学生转班';
  130. ALTER TABLE `base_student_school_roll`
  131. CHANGE `roll_number` `roll_number` VARCHAR(30) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '学籍号',
  132. CHANGE `archives_number` `archives_number` VARCHAR(30) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '学生档案编号',
  133. CHANGE `study_year` `study_year` DECIMAL(6,1) NULL COMMENT '学制(base_major_set)';
  134. -- ------------------------------------------------
  135. -- 常用功能设置
  136. -- ------------------------------------------------
  137. DROP TABLE IF EXISTS system_menu_commonly_used;
  138. CREATE TABLE `system_menu_commonly_used` (
  139. `id` BIGINT NOT NULL,
  140. `create_user_id` BIGINT DEFAULT NULL,
  141. `create_date` DATETIME(3) DEFAULT NULL,
  142. `modify_user_id` BIGINT DEFAULT NULL,
  143. `modify_date` DATETIME(3) DEFAULT NULL,
  144. `delete_mark` INT DEFAULT NULL,
  145. `enabled_mark` INT DEFAULT NULL,
  146. `menu_id` BIGINT DEFAULT NULL COMMENT '菜单id',
  147. `seq` INT DEFAULT NULL COMMENT '序号',
  148. PRIMARY KEY (`id`) USING BTREE
  149. ) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='常用功能设置';
  150. ALTER TABLE `base_course_subject`
  151. CHANGE `code` `code` VARCHAR(30) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '课程学科代码';
  152. DROP PROCEDURE IF EXISTS createCom;
  153. DELIMITER $$
  154. CREATE
  155. PROCEDURE createCom()
  156. BEGIN
  157. IF NOT EXISTS(SELECT 1 FROM information_schema.columns WHERE table_name='xjr_user' AND COLUMN_NAME = 'sign_folder_id') THEN
  158. ALTER TABLE `xjr_user`
  159. ADD COLUMN `sign_folder_id` BIGINT NULL COMMENT '签名文件' AFTER `is_change_password`;
  160. END IF;
  161. END$$
  162. DELIMITER ;
  163. CALL createCom;
  164. DROP PROCEDURE createCom;
  165. DROP PROCEDURE IF EXISTS createCom;
  166. DELIMITER $$
  167. CREATE
  168. PROCEDURE createCom()
  169. BEGIN
  170. IF NOT EXISTS(SELECT 1 FROM information_schema.columns WHERE table_name='xjr_user' AND COLUMN_NAME = 'sign_password') THEN
  171. ALTER TABLE `xjr_user`
  172. ADD COLUMN `sign_password` VARCHAR(100) NULL COMMENT '签名密码' AFTER `is_change_password`;
  173. END IF;
  174. END$$
  175. DELIMITER ;
  176. CALL createCom;
  177. DROP PROCEDURE createCom;
  178. -- ------------------------------------------------
  179. -- 数据导出-数据源设置
  180. -- ------------------------------------------------
  181. DROP TABLE IF EXISTS data_expert_source;
  182. CREATE TABLE `data_expert_source` (
  183. `id` BIGINT NOT NULL,
  184. `create_user_id` BIGINT DEFAULT NULL,
  185. `create_date` DATETIME(3) DEFAULT NULL,
  186. `modify_user_id` BIGINT DEFAULT NULL,
  187. `modify_date` DATETIME(3) DEFAULT NULL,
  188. `delete_mark` INT DEFAULT NULL,
  189. `enabled_mark` INT DEFAULT NULL,
  190. `sort_code` INT DEFAULT NULL,
  191. `name` VARCHAR(100) DEFAULT NULL COMMENT '数据源名称',
  192. `source_type` VARCHAR(50) DEFAULT NULL COMMENT '数据源类型',
  193. `api_url` VARCHAR(50) DEFAULT NULL COMMENT 'magicapi地址',
  194. `field_json` LONGTEXT DEFAULT NULL COMMENT '字段配置',
  195. PRIMARY KEY (`id`) USING BTREE
  196. ) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='数据导出-数据源设置';
  197. -- ------------------------------------------------
  198. -- 数据导出-数据模板
  199. -- ------------------------------------------------
  200. DROP TABLE IF EXISTS data_expert_template;
  201. CREATE TABLE `data_expert_template` (
  202. `id` BIGINT NOT NULL,
  203. `create_user_id` BIGINT DEFAULT NULL,
  204. `create_date` DATETIME(3) DEFAULT NULL,
  205. `modify_user_id` BIGINT DEFAULT NULL,
  206. `modify_date` DATETIME(3) DEFAULT NULL,
  207. `delete_mark` INT DEFAULT NULL,
  208. `enabled_mark` INT DEFAULT NULL,
  209. `sort_code` INT DEFAULT NULL,
  210. `name` VARCHAR(100) DEFAULT NULL COMMENT '模板名称',
  211. `data_expert_source_id` BIGINT DEFAULT NULL COMMENT '数据源(data_expert_source)',
  212. `field_json` LONGTEXT DEFAULT NULL COMMENT '字段配置',
  213. PRIMARY KEY (`id`) USING BTREE
  214. ) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='数据导出-数据模板';
  215. -- ------------------------------------------------
  216. -- 寝室申请
  217. -- ------------------------------------------------
  218. DROP TABLE IF EXISTS wf_room_applicant;
  219. CREATE TABLE `wf_room_applicant` (
  220. `id` BIGINT NOT NULL COMMENT '主键编号',
  221. `create_user_id` BIGINT DEFAULT NULL COMMENT '创建人',
  222. `create_date` DATETIME DEFAULT NULL COMMENT '创建时间',
  223. `modify_user_id` BIGINT DEFAULT NULL COMMENT '修改人',
  224. `modify_date` DATETIME DEFAULT NULL COMMENT '修改时间',
  225. `delete_mark` INT NOT NULL COMMENT '删除标记',
  226. `enabled_mark` INT NOT NULL COMMENT '有效标志',
  227. `sort_code` INT DEFAULT NULL COMMENT '序号',
  228. `applicant_user_id` BIGINT DEFAULT NULL COMMENT '申请人',
  229. `head_teacher_id` BIGINT DEFAULT NULL COMMENT '班主任用户编号',
  230. `recede_type` VARCHAR(20) DEFAULT NULL COMMENT '寝室申请类型(xjr_dictionary_item[room_applicant_type])',
  231. `class_name` VARCHAR(200) DEFAULT NULL COMMENT '班级名称',
  232. `room_bed_number` VARCHAR(200) DEFAULT NULL COMMENT '寝室+床位名称',
  233. `start_time` DATE DEFAULT NULL COMMENT '开始时间',
  234. `nos_reason` VARCHAR(20) DEFAULT NULL COMMENT '离宿事由(xjr_dictionary_item[nos_reason])',
  235. `remark` VARCHAR(1000) DEFAULT NULL COMMENT '备注',
  236. `status` INT NOT NULL DEFAULT '0' COMMENT '状态(1:结束 0:未结束)',
  237. `grade` BIGINT DEFAULT NULL,
  238. `I_D_number` VARCHAR(100) DEFAULT NULL,
  239. PRIMARY KEY (`id`)
  240. ) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='寝室申请';