20240219_sql.sql 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. DROP PROCEDURE IF EXISTS createCom;
  2. DELIMITER $$
  3. CREATE
  4. PROCEDURE createCom()
  5. BEGIN
  6. IF NOT EXISTS(SELECT 1 FROM information_schema.columns WHERE table_name='textbook_subscription_record' AND COLUMN_NAME = 'wf_textbook_subscription_item_id') THEN
  7. ALTER TABLE `textbook_subscription_record`
  8. ADD COLUMN `wf_textbook_subscription_item_id` BIGINT NULL COMMENT '教材教辅征订项编号' AFTER `wf_textbook_subscription_id`;
  9. END IF;
  10. END$$
  11. DELIMITER ;
  12. CALL createCom;
  13. DROP PROCEDURE createCom;
  14. DROP PROCEDURE IF EXISTS createCom;
  15. DELIMITER $$
  16. CREATE
  17. PROCEDURE createCom()
  18. BEGIN
  19. IF NOT EXISTS(SELECT 1 FROM information_schema.columns WHERE table_name='wf_subscription' AND COLUMN_NAME = 'number') THEN
  20. ALTER TABLE `wf_subscription`
  21. ADD COLUMN `number` VARCHAR(20) NULL COMMENT '编号' AFTER `folder_id`;
  22. END IF;
  23. END$$
  24. DELIMITER ;
  25. CALL createCom;
  26. DROP PROCEDURE createCom;
  27. -- 学生考核表调整
  28. DROP PROCEDURE IF EXISTS createCom;
  29. DELIMITER $$
  30. CREATE
  31. PROCEDURE createCom()
  32. BEGIN
  33. IF NOT EXISTS(SELECT 1 FROM information_schema.columns WHERE table_name='base_student_assessment_inspection' AND COLUMN_NAME = 'personal_student_user_ids') THEN
  34. ALTER TABLE `base_student_assessment_inspection`
  35. CHANGE `student_user_ids` `class_student_user_ids` VARCHAR(4000) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '班级考核学生对象',
  36. ADD COLUMN `personal_student_user_ids` VARCHAR(4000) NULL COMMENT '个人考核学生对象' AFTER `teacher_id`;
  37. END IF;
  38. END$$
  39. DELIMITER ;
  40. CALL createCom;
  41. DROP PROCEDURE createCom;
  42. -- 学生学籍表增加学籍形式
  43. DROP PROCEDURE IF EXISTS createCom;
  44. DELIMITER $$
  45. CREATE
  46. PROCEDURE createCom()
  47. BEGIN
  48. IF NOT EXISTS(SELECT 1 FROM information_schema.columns WHERE table_name='base_student_school_roll' AND COLUMN_NAME = 'roll_modality') THEN
  49. ALTER TABLE `base_student_school_roll`
  50. ADD COLUMN `roll_modality` VARCHAR(50) NULL COMMENT '学籍形式' AFTER `remark`;
  51. END IF;
  52. END$$
  53. DELIMITER ;
  54. CALL createCom;
  55. DROP PROCEDURE createCom;
  56. -- 机构名称字段长度加长
  57. ALTER TABLE `xjr_department`
  58. CHANGE `name` `name` VARCHAR(100) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '机构名称';
  59. -- 物品申购台账审核状态
  60. DROP PROCEDURE IF EXISTS createCom;
  61. DELIMITER $$
  62. CREATE
  63. PROCEDURE createCom()
  64. BEGIN
  65. IF NOT EXISTS(SELECT 1 FROM information_schema.columns WHERE table_name='wf_subscription' AND COLUMN_NAME = 'status') THEN
  66. ALTER TABLE `wf_subscription`
  67. ADD COLUMN `status` INT DEFAULT 0 NULL COMMENT '状态(0:未审核 1:审核)' AFTER `number`,
  68. ADD COLUMN `create_user_id` BIGINT NULL AFTER `status`,
  69. ADD COLUMN `create_date` DATETIME NULL AFTER `create_user_id`,
  70. ADD COLUMN `modify_user_id` BIGINT NULL AFTER `create_date`,
  71. ADD COLUMN `modify_date` DATETIME NULL AFTER `modify_user_id`,
  72. ADD COLUMN `delete_mark` INT NULL AFTER `modify_date`,
  73. ADD COLUMN `enabled_mark` INT NULL AFTER `delete_mark`;
  74. END IF;
  75. END$$
  76. DELIMITER ;
  77. CALL createCom;
  78. DROP PROCEDURE createCom;
  79. -- ------------------------------------------------
  80. -- 工作流操作记录表
  81. -- ------------------------------------------------
  82. DROP TABLE IF EXISTS xjr_workflow_operate_record;
  83. CREATE TABLE `xjr_workflow_operate_record` (
  84. `id` BIGINT NOT NULL,
  85. `node_id` VARCHAR(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '节点id',
  86. `node_type` VARCHAR(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '节点类型',
  87. `node_name` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '节点名称',
  88. `node_multi_type` INT DEFAULT NULL COMMENT '节点多实例类型(节点审批类型)',
  89. `schema_id` BIGINT DEFAULT NULL COMMENT '模板id',
  90. `process_id` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '流程id',
  91. `operate_info` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '审批操作信息',
  92. `record_time` DATETIME(3) DEFAULT NULL COMMENT '记录时间',
  93. `circulate_message` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '传阅信息',
  94. `create_user_id` BIGINT DEFAULT NULL COMMENT '操作人id',
  95. PRIMARY KEY (`id`) USING BTREE
  96. ) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='工作流操作记录表';
  97. ALTER TABLE `tl`.`xjr_user`
  98. CHANGE `gender` `gender` VARCHAR(20) NULL COMMENT '性别';
  99. -- ------------------------------------------------
  100. -- 教师自评
  101. -- ------------------------------------------------
  102. DROP TABLE IF EXISTS wf_teacher_self_evaluation;
  103. CREATE TABLE `wf_teacher_self_evaluation` (
  104. `id` BIGINT NOT NULL,
  105. `create_user_id` BIGINT DEFAULT NULL,
  106. `create_date` DATETIME(3) DEFAULT NULL,
  107. `modify_user_id` BIGINT DEFAULT NULL,
  108. `modify_date` DATETIME(3) DEFAULT NULL,
  109. `delete_mark` INT DEFAULT NULL,
  110. `enabled_mark` INT DEFAULT NULL,
  111. `base_semester_id` BIGINT DEFAULT NULL COMMENT '学期',
  112. `folder_id` BIGINT DEFAULT NULL COMMENT 'f附件',
  113. `status` INT DEFAULT '0' COMMENT '流程状态(1:结束 0:未结束)',
  114. `all_total_score` INT DEFAULT NULL COMMENT '总分',
  115. PRIMARY KEY (`id`)
  116. ) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='教师自评';
  117. -- ------------------------------------------------
  118. -- 教师自评子表
  119. -- ------------------------------------------------
  120. DROP TABLE IF EXISTS wf_teacher_self_evaluation_item;
  121. CREATE TABLE `wf_teacher_self_evaluation_item` (
  122. `id` BIGINT NOT NULL,
  123. `create_user_id` BIGINT DEFAULT NULL,
  124. `create_date` DATETIME(3) DEFAULT NULL,
  125. `modify_user_id` BIGINT DEFAULT NULL,
  126. `modify_date` DATETIME(3) DEFAULT NULL,
  127. `delete_mark` INT DEFAULT NULL,
  128. `enabled_mark` INT DEFAULT NULL,
  129. `wf_teacher_self_evaluation_id` BIGINT DEFAULT NULL,
  130. `category` VARCHAR(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '获奖或表彰',
  131. `wf_teacher_self_evaluation_category_id` BIGINT DEFAULT NULL COMMENT '奖项类别id(wf_teacher_self_evaluation_category)',
  132. `wf_teacher_self_evaluation_project_id` BIGINT DEFAULT NULL COMMENT '自评具体项目id(wf_teacher_self_evaluation_project)',
  133. `score` INT DEFAULT NULL COMMENT '项目分数',
  134. `number` INT DEFAULT NULL COMMENT '获奖次数',
  135. `total_score` INT DEFAULT NULL COMMENT '合计分数',
  136. PRIMARY KEY (`id`)
  137. ) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='教师自评子表';
  138. -- ------------------------------------------------
  139. -- 教师自评类别
  140. -- ------------------------------------------------
  141. DROP TABLE IF EXISTS wf_teacher_self_evaluation_category;
  142. CREATE TABLE `wf_teacher_self_evaluation_category` (
  143. `id` BIGINT NOT NULL,
  144. `create_user_id` BIGINT DEFAULT NULL,
  145. `create_date` DATETIME(3) DEFAULT NULL,
  146. `modify_user_id` BIGINT DEFAULT NULL,
  147. `modify_date` DATETIME(3) DEFAULT NULL,
  148. `delete_mark` INT DEFAULT NULL,
  149. `enabled_mark` INT DEFAULT NULL,
  150. `name` VARCHAR(200) DEFAULT NULL,
  151. `category` VARCHAR(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '获奖或表彰',
  152. PRIMARY KEY (`id`)
  153. ) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='教师自评类别';
  154. -- ------------------------------------------------
  155. -- 教师自评项目
  156. -- ------------------------------------------------
  157. DROP TABLE IF EXISTS wf_teacher_self_evaluation_project;
  158. CREATE TABLE `wf_teacher_self_evaluation_project` (
  159. `id` BIGINT NOT NULL,
  160. `create_user_id` BIGINT DEFAULT NULL,
  161. `create_date` DATETIME(3) DEFAULT NULL,
  162. `modify_user_id` BIGINT DEFAULT NULL,
  163. `modify_date` DATETIME(3) DEFAULT NULL,
  164. `delete_mark` INT DEFAULT NULL,
  165. `enabled_mark` INT DEFAULT NULL,
  166. `wf_teacher_self_evaluation_category_id` VARCHAR(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  167. `name` VARCHAR(200) DEFAULT NULL,
  168. `score` INT DEFAULT NULL COMMENT '分数',
  169. PRIMARY KEY (`id`)
  170. ) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='教师自评项目';
  171. -- 学生异动信息增加状态
  172. DROP PROCEDURE IF EXISTS createCom;
  173. DELIMITER $$
  174. CREATE
  175. PROCEDURE createCom()
  176. BEGIN
  177. IF NOT EXISTS(SELECT 1 FROM information_schema.columns WHERE table_name='school_roll_student' AND COLUMN_NAME = 'before_archives_status') THEN
  178. ALTER TABLE `school_roll_student`
  179. ADD COLUMN `before_archives_status` VARCHAR(20) NULL COMMENT '异动前学籍状态(xjr_dictionary_item[archives_status])' AFTER `status`,
  180. ADD COLUMN `after_archives_status` VARCHAR(20) NULL COMMENT '异动后学籍状态(xjr_dictionary_item[archives_status])' AFTER `before_archives_status`;
  181. END IF;
  182. END$$
  183. DELIMITER ;
  184. CALL createCom;
  185. DROP PROCEDURE createCom;
  186. -- 该记录的应用场景
  187. DROP PROCEDURE IF EXISTS createCom;
  188. DELIMITER $$
  189. CREATE
  190. PROCEDURE createCom()
  191. BEGIN
  192. IF NOT EXISTS(SELECT 1 FROM information_schema.columns WHERE table_name='xjr_workflow_operate_record' AND COLUMN_NAME = 'usage_scenario') THEN
  193. ALTER TABLE `xjr_workflow_operate_record`
  194. ADD COLUMN `usage_scenario` INT DEFAULT 1 COMMENT '该记录的应用场景' AFTER create_user_id;
  195. END IF;
  196. END$$
  197. DELIMITER ;
  198. CALL createCom;
  199. DROP PROCEDURE createCom;
  200. -- wf_overtime表需添加一个加班人用户id(多选)字段
  201. DROP PROCEDURE IF EXISTS createCom;
  202. DELIMITER $$
  203. CREATE
  204. PROCEDURE createCom()
  205. BEGIN
  206. IF NOT EXISTS(SELECT 1 FROM information_schema.columns WHERE table_name='overtime_workeruser_ids' AND COLUMN_NAME = 'wf_overtime') THEN
  207. ALTER TABLE `wf_overtime`
  208. ADD COLUMN `overtime_workeruser_ids` VARCHAR(3000) NULL COMMENT '加班人id' AFTER `supporting_materials`;
  209. END IF;
  210. END$$
  211. DELIMITER ;
  212. CALL createCom;
  213. DROP PROCEDURE createCom;