20240125_sql.sql 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. -- ------------------------------------------------------------------毕业--------------------------------------------------------------------
  2. -- ----------------------------
  3. -- 学生毕业管理
  4. -- ----------------------------
  5. DROP TABLE IF EXISTS base_student_graduate;
  6. CREATE TABLE base_student_graduate
  7. (
  8. id BIGINT NOT NULL COMMENT '主键编号',
  9. `create_user_id` BIGINT NULL DEFAULT NULL COMMENT '创建人',
  10. `create_date` DATETIME NULL DEFAULT NULL COMMENT '创建时间',
  11. `modify_user_id` BIGINT NULL DEFAULT NULL COMMENT '修改人',
  12. `modify_date` DATETIME NULL DEFAULT NULL COMMENT '修改时间',
  13. `delete_mark` INT NOT NULL COMMENT '删除标记',
  14. `enabled_mark` INT NOT NULL COMMENT '有效标志',
  15. `sort_code` INT NULL DEFAULT NULL COMMENT '序号',
  16. `user_id` BIGINT NULL DEFAULT NULL COMMENT '学生(xjr_user)',
  17. `certificate_number` VARCHAR(50) NULL DEFAULT NULL COMMENT '证书编号',
  18. `certificate_date` DATE NULL DEFAULT NULL COMMENT '发证日期',
  19. `leaving_bed_date` DATE NULL DEFAULT NULL COMMENT '离寝日期',
  20. `appendix_id` BIGINT NULL DEFAULT NULL COMMENT '附件id',
  21. `status` INT NOT NULL DEFAULT 0 COMMENT '证书发放状态(0:未发放 1:已发放)',
  22. PRIMARY KEY (`id`)
  23. ) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT '学生毕业管理';
  24. ALTER TABLE `course_table`
  25. ADD COLUMN `jianyue_id` VARCHAR(40) NULL COMMENT '简约课表的id' AFTER `modify_date`;
  26. ALTER TABLE `wf_subscription`
  27. ADD COLUMN `folder_id` BIGINT NULL COMMENT '附件夹主键' AFTER `total_amount`;
  28. ALTER TABLE `base_student_assessment_inspection`
  29. CHANGE `reason` `reason` VARCHAR(1000) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '备注',
  30. ADD COLUMN `student_user_ids` VARCHAR(4000) NULL COMMENT '学生ids(多选)' AFTER `status`;
  31. ALTER TABLE `base_student_assessment_inspection`
  32. ADD COLUMN `dept_id` BIGINT NULL COMMENT '专业部id' AFTER `student_user_ids`;
  33. ALTER TABLE `base_student_assessment_inspection`
  34. ADD COLUMN `assessment_type` VARCHAR(50) NULL COMMENT '考核对象(class:班级 personal:个人)';
  35. -- -------------------------------
  36. -- 调课顶课申请
  37. -- -------------------------------
  38. DROP TABLE IF EXISTS wf_course_adjust;
  39. CREATE TABLE wf_course_adjust
  40. (
  41. id BIGINT NOT NULL COMMENT '主键编号',
  42. `create_user_id` BIGINT NULL DEFAULT NULL COMMENT '创建人',
  43. `create_date` DATETIME NULL DEFAULT NULL COMMENT '创建时间',
  44. `modify_user_id` BIGINT NULL DEFAULT NULL COMMENT '修改人',
  45. `modify_date` DATETIME NULL DEFAULT NULL COMMENT '修改时间',
  46. `delete_mark` INT NOT NULL COMMENT '删除标记',
  47. `enabled_mark` INT NOT NULL COMMENT '有效标志',
  48. `sort_code` INT NULL DEFAULT NULL COMMENT '序号',
  49. `user_id` BIGINT NULL DEFAULT NULL COMMENT '申请人id',
  50. `dept_id` BIGINT NULL DEFAULT NULL COMMENT '专业部id',
  51. `adjust_type` VARCHAR(50) NULL DEFAULT NULL COMMENT '调课类型',
  52. `reason` VARCHAR(100) NULL DEFAULT NULL COMMENT '原因',
  53. `adjust_date` DATE NULL DEFAULT NULL COMMENT '调整日期',
  54. `remark` VARCHAR(300) NULL DEFAULT NULL COMMENT '备注',
  55. `course_id` BIGINT NULL DEFAULT NULL COMMENT '课程id(base_course_subject)',
  56. `exchange_date` DATE NULL DEFAULT NULL COMMENT '对调日期',
  57. `exchange_teacher_id` BIGINT NULL DEFAULT NULL COMMENT '替班教师id(xjr_user)',
  58. `exchange_course_id` BIGINT NULL DEFAULT NULL COMMENT '对调课程id(base_course_subject)',
  59. `status` INT NOT NULL DEFAULT 0 COMMENT '状态(0:未通过 1:已通过)',
  60. PRIMARY KEY (`id`)
  61. ) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT '调课顶课申请';
  62. -- -------------------------------
  63. -- 课表发布消息接收
  64. -- -------------------------------
  65. DROP TABLE IF EXISTS course_receive_msg;
  66. CREATE TABLE course_receive_msg
  67. (
  68. id BIGINT NOT NULL COMMENT '主键编号',
  69. `create_date` DATETIME NULL DEFAULT NULL COMMENT '创建时间',
  70. `delete_mark` INT NOT NULL COMMENT '删除标记',
  71. `enabled_mark` INT NOT NULL COMMENT '有效标志',
  72. `sort_code` INT NULL DEFAULT NULL COMMENT '序号',
  73. `school_id` VARCHAR(50) NULL DEFAULT NULL COMMENT '学校id',
  74. `edu_year_serial_no` VARCHAR(50) NULL DEFAULT NULL COMMENT '年级id',
  75. `start_date` VARCHAR(50) NULL DEFAULT NULL COMMENT '开始时间',
  76. `end_date` VARCHAR(50) NULL DEFAULT NULL COMMENT '结束时间',
  77. `is_callback` INT NULL DEFAULT NULL COMMENT '是否已回调',
  78. PRIMARY KEY (`id`)
  79. ) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT '课表发布消息接收';
  80. DROP PROCEDURE IF EXISTS createCom;
  81. DELIMITER $$
  82. CREATE
  83. PROCEDURE createCom()
  84. BEGIN
  85. IF NOT EXISTS(SELECT 1 FROM information_schema.columns WHERE table_name='course_table' AND COLUMN_NAME = 'schedule_date') THEN
  86. ALTER TABLE `course_table`
  87. ADD COLUMN `schedule_date` DATE NULL DEFAULT NULL COMMENT '上课日期';
  88. END IF;
  89. END$$
  90. DELIMITER ;
  91. CALL createCom;
  92. DROP PROCEDURE createCom;
  93. DROP PROCEDURE IF EXISTS createCom;
  94. DELIMITER $$
  95. CREATE
  96. PROCEDURE createCom()
  97. BEGIN
  98. IF NOT EXISTS(SELECT 1 FROM information_schema.columns WHERE table_name='course_table' AND COLUMN_NAME = 'teacher_serial_no') THEN
  99. ALTER TABLE `course_table`
  100. ADD COLUMN `teacher_serial_no` VARCHAR(40) NULL DEFAULT NULL COMMENT '教师SerialNo';
  101. END IF;
  102. END$$
  103. DELIMITER ;
  104. CALL createCom;
  105. DROP PROCEDURE createCom;
  106. -- ------------------
  107. -- 课表,字段长度调整
  108. -- ---------------------
  109. ALTER TABLE course_table
  110. CHANGE `site_id` `site_id` BIGINT DEFAULT 0 NOT NULL COMMENT '场地编号(site)',
  111. ADD COLUMN `source_data` TEXT NULL COMMENT '源数据' AFTER `jianyue_id`;
  112. DROP PROCEDURE IF EXISTS createCom;
  113. DELIMITER $$
  114. CREATE
  115. PROCEDURE createCom()
  116. BEGIN
  117. IF NOT EXISTS(SELECT 1 FROM information_schema.columns WHERE table_name='base_course_subject' AND COLUMN_NAME = 'org_id') THEN
  118. ALTER TABLE `base_course_subject`
  119. ADD COLUMN `org_id` BIGINT NULL COMMENT '开课机构id' AFTER `remark`;
  120. END IF;
  121. END$$
  122. DELIMITER ;
  123. CALL createCom;
  124. DROP PROCEDURE createCom;
  125. DROP PROCEDURE IF EXISTS createCom;
  126. DELIMITER $$
  127. CREATE
  128. PROCEDURE createCom()
  129. BEGIN
  130. IF NOT EXISTS(SELECT 1 FROM information_schema.columns WHERE table_name='evaluate_manage' AND COLUMN_NAME = 'source_id') THEN
  131. ALTER TABLE `evaluate_manage`
  132. ADD COLUMN `source_id` BIGINT NULL COMMENT '来源id';
  133. END IF;
  134. END$$
  135. DELIMITER ;
  136. CALL createCom;
  137. DROP PROCEDURE createCom;
  138. DROP PROCEDURE IF EXISTS createCom;
  139. DELIMITER $$
  140. CREATE
  141. PROCEDURE createCom()
  142. BEGIN
  143. IF NOT EXISTS(SELECT 1 FROM information_schema.columns WHERE table_name='base_grade' AND COLUMN_NAME = 'status') THEN
  144. ALTER TABLE `base_grade`
  145. ADD COLUMN `status` INT NULL DEFAULT 1 COMMENT '在读状态(1:在读 0:毕业)' AFTER `title`;
  146. END IF;
  147. END$$
  148. DELIMITER ;
  149. CALL createCom;
  150. DROP PROCEDURE createCom;
  151. --
  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='base_student_assessment_inspection' AND COLUMN_NAME = 'teacher_id') THEN
  158. ALTER TABLE `base_student_assessment_inspection`
  159. ADD COLUMN `teacher_id` BIGINT NULL COMMENT '班主任id';
  160. END IF;
  161. END$$
  162. DELIMITER ;
  163. CALL createCom;
  164. DROP PROCEDURE createCom;
  165. -- ------------------------------------------------------------------毕业--------------------------------------------------------------------
  166. -- -------------------------------------------------------------------评价管理-----------------------------------------------------------------
  167. DROP PROCEDURE IF EXISTS createCom;
  168. DELIMITER $$
  169. CREATE
  170. PROCEDURE createCom()
  171. BEGIN
  172. IF NOT EXISTS(SELECT 1 FROM information_schema.columns WHERE table_name='evaluate_manage' AND COLUMN_NAME = 'is_auto_create') THEN
  173. ALTER TABLE `evaluate_manage`
  174. ADD COLUMN `is_auto_create` INT NULL COMMENT '是否自动生成(0:否,1:是)' AFTER `status`,
  175. ADD COLUMN `create_frequency` VARCHAR(50) NULL COMMENT '生成频率(xjr_dictionary_detail[create_frequency])' AFTER `is_auto_create`;
  176. END IF;
  177. END$$
  178. DELIMITER ;
  179. CALL createCom;
  180. DROP PROCEDURE createCom;
  181. -- -------------------------------------------------------------------评价管理-----------------------------------------------------------------
  182. -- -------------------------------------------------------------------考核-----------------------------------------------------------------
  183. -- -------------------------------
  184. -- 指标公式规则管理
  185. -- -------------------------------
  186. DROP TABLE IF EXISTS quota_formula_rule;
  187. CREATE TABLE quota_formula_rule
  188. (
  189. id BIGINT NOT NULL COMMENT '主键编号',
  190. `create_user_id` BIGINT NULL DEFAULT NULL COMMENT '创建人',
  191. `create_date` DATETIME NULL DEFAULT NULL COMMENT '创建时间',
  192. `modify_user_id` BIGINT NULL DEFAULT NULL COMMENT '修改人',
  193. `modify_date` DATETIME NULL DEFAULT NULL COMMENT '修改时间',
  194. `delete_mark` INT NOT NULL COMMENT '删除标记',
  195. `enabled_mark` INT NOT NULL COMMENT '有效标志',
  196. `sort_code` INT NULL DEFAULT NULL COMMENT '序号',
  197. `name` VARCHAR(255) NULL DEFAULT NULL COMMENT '规则名称',
  198. `formula` VARCHAR(1000) NULL DEFAULT NULL COMMENT '规则公式',
  199. `bind_quota` VARCHAR(2000) NULL DEFAULT NULL COMMENT '指标',
  200. `remark` VARCHAR(500) NULL DEFAULT NULL COMMENT '备注',
  201. PRIMARY KEY (`id`)
  202. ) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT '指标公式规则管理';
  203. -- -------------------------------
  204. -- 考核基数
  205. -- -------------------------------
  206. DROP TABLE IF EXISTS quota_formula_rule_constant;
  207. CREATE TABLE quota_formula_rule_constant
  208. (
  209. id BIGINT NOT NULL COMMENT '主键编号',
  210. `create_user_id` BIGINT NULL DEFAULT NULL COMMENT '创建人',
  211. `create_date` DATETIME NULL DEFAULT NULL COMMENT '创建时间',
  212. `modify_user_id` BIGINT NULL DEFAULT NULL COMMENT '修改人',
  213. `modify_date` DATETIME NULL DEFAULT NULL COMMENT '修改时间',
  214. `delete_mark` INT NOT NULL COMMENT '删除标记',
  215. `enabled_mark` INT NOT NULL COMMENT '有效标志',
  216. `sort_code` INT NULL DEFAULT NULL COMMENT '序号',
  217. `name` VARCHAR(255) NULL DEFAULT NULL COMMENT '基数名称',
  218. `formula` VARCHAR(1000) NULL DEFAULT NULL COMMENT '规则公式',
  219. `bind_quota` VARCHAR(50) NULL DEFAULT NULL COMMENT '指标',
  220. `remark` VARCHAR(500) NULL DEFAULT NULL COMMENT '备注',
  221. PRIMARY KEY (`id`)
  222. ) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT '考核基数';
  223. -- -------------------------------
  224. -- 考核表单属性
  225. -- -------------------------------
  226. DROP TABLE IF EXISTS quota_formula_rule_attribute;
  227. CREATE TABLE quota_formula_rule_attribute
  228. (
  229. id BIGINT NOT NULL COMMENT '主键编号',
  230. `create_user_id` BIGINT NULL DEFAULT NULL COMMENT '创建人',
  231. `create_date` DATETIME NULL DEFAULT NULL COMMENT '创建时间',
  232. `modify_user_id` BIGINT NULL DEFAULT NULL COMMENT '修改人',
  233. `modify_date` DATETIME NULL DEFAULT NULL COMMENT '修改时间',
  234. `delete_mark` INT NOT NULL COMMENT '删除标记',
  235. `enabled_mark` INT NOT NULL COMMENT '有效标志',
  236. `sort_code` INT NULL DEFAULT NULL COMMENT '序号',
  237. `name` VARCHAR(255) NULL DEFAULT NULL COMMENT '属性名称',
  238. `formula` VARCHAR(1000) NULL DEFAULT NULL COMMENT '属性值',
  239. `remark` VARCHAR(500) NULL DEFAULT NULL COMMENT '备注',
  240. PRIMARY KEY (`id`)
  241. ) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT '考核表单属性';
  242. -- -------------------------------------------------------------------考核-----------------------------------------------------------------
  243. -- -------------------------------------------------------------------评价-----------------------------------------------------------------
  244. -- -------------------------------
  245. -- 参评人提交记录表
  246. -- -------------------------------
  247. CREATE TABLE `evaluate_submit_record`(
  248. `id` BIGINT NOT NULL,
  249. `evaluate_manage_id` BIGINT COMMENT '评价管理编号',
  250. `evaluate_executer_id` BIGINT COMMENT '参评人编号',
  251. `create_date` DATETIME COMMENT '提交时间',
  252. `evaluated_object` VARCHAR(30) COMMENT '被评对象(teacher:老师,class:班级,student:学生)',
  253. `evaluated_object_id` BIGINT COMMENT '被评对象编号',
  254. PRIMARY KEY (`id`)
  255. ) ENGINE=INNODB CHARSET=utf8mb4
  256. COMMENT='参评人提交记录表';
  257. DROP PROCEDURE IF EXISTS createCom;
  258. DELIMITER $$
  259. CREATE
  260. PROCEDURE createCom()
  261. BEGIN
  262. IF NOT EXISTS(SELECT 1 FROM information_schema.columns WHERE table_name='evaluate_result' AND COLUMN_NAME = 'submit_record_id') THEN
  263. ALTER TABLE `evaluate_result`
  264. ADD COLUMN `submit_record_id` BIGINT NULL COMMENT '提交记录主键编号(evaluate_submit_record)' AFTER `opinion`;
  265. END IF;
  266. END$$
  267. DELIMITER ;
  268. CALL createCom;
  269. DROP PROCEDURE createCom;
  270. DROP PROCEDURE IF EXISTS createCom;
  271. DELIMITER $$
  272. CREATE
  273. PROCEDURE createCom()
  274. BEGIN
  275. IF NOT EXISTS(SELECT 1 FROM information_schema.columns WHERE table_name='evaluate_submit_record' AND COLUMN_NAME = 'status') THEN
  276. ALTER TABLE `evaluate_submit_record`
  277. ADD COLUMN `status` INT(0) NULL COMMENT '状态(1:已评分,0:未评分)';
  278. END IF;
  279. END$$
  280. DELIMITER ;
  281. CALL createCom;
  282. DROP PROCEDURE createCom;
  283. ALTER TABLE evaluate_result MODIFY submit_record_id varchar(64);
  284. ALTER TABLE evaluate_submit_record MODIFY id varchar(64);
  285. -- -------------------------------------------------------------------评价-----------------------------------------------------------------
  286. ALTER TABLE `jianyue_data`
  287. CHANGE `jianyue_id` `jianyue_id` VARCHAR(40) NULL COMMENT '对应的简约系统的id';
  288. -- ------------------------------------
  289. -- 标签表
  290. -- ------------------------------------
  291. DROP TABLE IF EXISTS base_label;
  292. CREATE TABLE base_label
  293. (
  294. id BIGINT NOT NULL COMMENT '主键编号',
  295. `create_user_id` BIGINT NULL DEFAULT NULL COMMENT '创建人',
  296. `create_date` DATETIME NULL DEFAULT NULL COMMENT '创建时间',
  297. `modify_user_id` BIGINT NULL DEFAULT NULL COMMENT '修改人',
  298. `modify_date` DATETIME NULL DEFAULT NULL COMMENT '修改时间',
  299. `delete_mark` INT NOT NULL COMMENT '删除标记',
  300. `enabled_mark` INT NOT NULL COMMENT '有效标志',
  301. `sort_code` INT NULL DEFAULT NULL COMMENT '序号',
  302. `name` VARCHAR(255) NULL DEFAULT NULL COMMENT '标签名称',
  303. `category` VARCHAR(50) NULL DEFAULT NULL COMMENT '标签分类',
  304. `remark` VARCHAR(500) NULL DEFAULT NULL COMMENT '备注',
  305. PRIMARY KEY (`id`)
  306. ) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT '基础标签表';
  307. ALTER TABLE `base_course_subject`
  308. CHANGE `org_id` `base_label_id` BIGINT NULL COMMENT '标签id(base_label)';