soc.sql 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. DELIMITER ??
  2. DROP PROCEDURE IF
  3. EXISTS schema_change ?? CREATE PROCEDURE schema_change () BEGIN
  4. IF
  5. NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE () AND TABLE_NAME = 'sys_org' AND COLUMN_NAME = 'breviary' ) THEN
  6. ALTER TABLE `sys_org` ADD COLUMN `breviary` VARCHAR ( 255 ) NULL COMMENT '机构缩略词';
  7. END IF;
  8. IF
  9. NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE () AND TABLE_NAME = 'core_safety_task' AND COLUMN_NAME = 'solid_id' ) THEN
  10. ALTER TABLE `core_safety_task`
  11. ADD COLUMN `solid_id` bigint NULL COMMENT '固定的id,用于识别多个副本是否属于同一个计划' AFTER `plan_id`;
  12. END IF;
  13. IF
  14. NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE () AND TABLE_NAME = 'core_safecheck_plan' AND COLUMN_NAME = 'publish_time' ) THEN
  15. ALTER TABLE `core_safecheck_plan`
  16. MODIFY COLUMN `parent_id` bigint NULL DEFAULT -1 COMMENT '下发父计划id' AFTER `id`,
  17. ADD COLUMN `solid_id` bigint NULL COMMENT '固定的id,用于识别多个副本是否属于同一个计划' AFTER `parent_id`,
  18. ADD COLUMN `parent_solid_id` bigint NULL COMMENT '固定的parentid,用于识别多个副本是否属于同一个计划' AFTER `solid_id`,
  19. ADD COLUMN `task_has_completed` int DEFAULT NULL COMMENT '1:表示有已完成的任务',
  20. ADD COLUMN `publish_time` datetime NULL COMMENT '最后一次下发时间' AFTER `task_has_completed`,
  21. ADD COLUMN `withdraw_time` datetime NULL COMMENT '最后一次撤回时间' AFTER `publish_time`,
  22. ADD COLUMN `effective_time` datetime NULL COMMENT '计划生效时间' AFTER `withdraw_time`;
  23. update core_safecheck_plan set publish_time =create_time WHERE publish_time is null and plan_status=1;
  24. update core_safecheck_plan set withdraw_time =create_time WHERE withdraw_time is null and plan_status=2;
  25. update core_safecheck_plan set effective_time =create_time WHERE effective_time is null and (plan_status=1 or plan_status=2);
  26. END IF;
  27. -- -- 预案演练表增加字段:最后一次下发时间/最后一次撤回时间/计划生效日期
  28. IF NOT EXISTS(SELECT *
  29. FROM information_schema.columns
  30. WHERE table_schema = DATABASE()
  31. AND table_name = 'core_drill_plan'
  32. AND column_name = 'publish_time') THEN
  33. ALTER TABLE core_drill_plan
  34. ADD COLUMN `publish_time` datetime NULL COMMENT '最后一次下发时间' AFTER `parent_id`,
  35. ADD COLUMN `withdraw_time` datetime NULL COMMENT '最后一次撤回时间' AFTER `publish_time`,
  36. ADD COLUMN `effective_time` datetime NULL COMMENT '计划生效日期' AFTER `withdraw_time`;
  37. update core_drill_plan set publish_time =update_time WHERE publish_time is null and plan_status=1;
  38. update core_drill_plan set withdraw_time =update_time WHERE withdraw_time is null and plan_status=2;
  39. update core_drill_plan set effective_time =update_time WHERE effective_time is null and (plan_status=1 or plan_status=2);
  40. END IF;
  41. --
  42. -- -- 预案演练表增加字段:最后一次下发时间/最后一次撤回时间/计划生效日期
  43. IF NOT EXISTS(SELECT *
  44. FROM information_schema.columns
  45. WHERE table_schema = DATABASE()
  46. AND table_name = 'core_edu_training_plan'
  47. AND column_name = 'publish_time') THEN
  48. ALTER TABLE core_edu_training_plan
  49. ADD COLUMN `publish_time` datetime NULL COMMENT '最后一次下发时间' AFTER `parent_id`,
  50. ADD COLUMN `withdraw_time` datetime NULL COMMENT '最后一次撤回时间' AFTER `publish_time`,
  51. ADD COLUMN `effective_time` datetime NULL COMMENT '计划生效日期' AFTER `withdraw_time`;
  52. update core_edu_training_plan set publish_time =update_time WHERE publish_time is null and plan_status=1;
  53. update core_edu_training_plan set withdraw_time =update_time WHERE withdraw_time is null and plan_status=2;
  54. update core_edu_training_plan set effective_time =update_time WHERE effective_time is null and (plan_status=1 or plan_status=2);
  55. END IF;
  56. IF
  57. NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE () AND TABLE_NAME = 'core_resumption_plan' AND COLUMN_NAME = 'solid_id' ) THEN
  58. ALTER TABLE `core_resumption_plan`
  59. MODIFY COLUMN `parent_id` bigint NULL DEFAULT -1 COMMENT '下发父计划id' AFTER `id`,
  60. ADD COLUMN `solid_id` bigint NULL COMMENT '固定的id,用于识别多个副本是否属于同一个计划' AFTER `parent_id`,
  61. ADD COLUMN `parent_solid_id` bigint NULL COMMENT '固定的parentid,用于识别多个副本是否属于同一个计划' AFTER `solid_id`;
  62. END IF;
  63. IF
  64. NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE () AND TABLE_NAME = 'core_resumption' AND COLUMN_NAME = 'solid_id' ) THEN
  65. ALTER TABLE `core_resumption`
  66. ADD COLUMN `solid_id` bigint NULL COMMENT '固定的id,用于识别多个副本是否属于同一个计划' AFTER `plan_id`,
  67. ADD COLUMN `parent_solid_id` bigint NULL COMMENT '固定的parentid,用于识别多个副本是否属于同一个计划' AFTER `solid_id`;
  68. END IF;
  69. IF
  70. EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE () AND TABLE_NAME = 'core_resumption_plan_to_point' AND COLUMN_NAME = 'effective_date' ) THEN
  71. ALTER TABLE `core_resumption_plan_to_point`
  72. DROP COLUMN `effective_date`;
  73. END IF;
  74. IF
  75. NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE () AND TABLE_NAME = 'core_resumption_plan' AND COLUMN_NAME = 'publish_time' ) THEN
  76. ALTER TABLE `core_resumption_plan`
  77. ADD COLUMN `publish_time` datetime NULL COMMENT '最后一次下发时间' AFTER `task_has_completed`,
  78. ADD COLUMN `withdraw_time` datetime NULL COMMENT '最后一次撤回时间' AFTER `publish_time`,
  79. ADD COLUMN `effective_time` datetime NULL COMMENT '计划生效时间' AFTER `withdraw_time`;
  80. update core_resumption_plan set publish_time =update_time WHERE publish_time is null and plan_status=1;
  81. update core_resumption_plan set withdraw_time =update_time WHERE withdraw_time is null and plan_status=2;
  82. update core_resumption_plan set effective_time =update_time WHERE effective_time is null and plan_status=1;
  83. END IF;
  84. END ??
  85. DELIMITER;
  86. CALL schema_change ();
  87. update sys_menu set component='safetycheck/plan/index' WHERE menu_name='检查任务下发' and menu_type='C' and platform_type='1';
  88. delete from sys_menu where id=1734903034555719682;
  89. INSERT INTO sys_menu (id, menu_name, parent_id, order_num, path, component, query, is_frame, is_cache, menu_type, visible, status, perms, platform_type, icon, image_path, create_by, create_time, update_by, update_time, remark)
  90. VALUES (1734903034555719682, '导出安全保卫工作情况统计', 103, 8, '', null, null, 1, 0, 'F', '0', '0', 'system:dept:exportConstructionDetails', '1', null, null, null, now(), '', null, '');
  91. delete from sys_role_menu where menu_id =1734903034555719682;
  92. INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (114, 1734903034555719682);
  93. INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (115, 1734903034555719682);
  94. INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (116, 1734903034555719682);
  95. INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (117, 1734903034555719682);
  96. INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (118, 1734903034555719682);
  97. INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (119, 1734903034555719682);
  98. INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (120, 1734903034555719682);
  99. delete from sys_role_menu where menu_id in (select id from sys_menu where perms='core:eduTask:report' and menu_name='报表查看');
  100. delete from sys_menu where perms='core:eduTask:report' and menu_name='报表查看';
  101. delete from sys_dict_type where dict_type='monitor_org';
  102. INSERT INTO sys_dict_type (dict_name, dict_type, status, create_by, create_time, update_by, update_time, remark)
  103. VALUES ('调阅机构类型', 'monitor_org', '0', null, now(), null, now(), null);
  104. delete from sys_dict_data where dict_type='monitor_org';
  105. INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark)
  106. VALUES (3, '行社', '3', 'monitor_org', null, 'default', 'N', '0', null, now(), null, now(), null);
  107. INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark)
  108. VALUES (2, '营业网点', '4', 'monitor_org', null, 'default', 'N', '0', null, now(), null, now(), null);
  109. INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark)
  110. VALUES (5, '离行式自助银行', '5', 'monitor_org', null, 'default', 'N', '0', null, now(), null, now(), null);
  111. INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark)
  112. VALUES (6, '中心业务库', '6', 'monitor_org', null, 'default', 'N', '0', null, now(), null, now(), null);
  113. INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark)
  114. VALUES (10, '监控中心', '10', 'monitor_org', null, 'default', 'N', '0', null, now(), null, now(), null);
  115. delete from `sys_menu` where id=01719892877586239490;
  116. INSERT INTO `sys_menu` (`id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `platform_type`, `icon`, `image_path`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`)
  117. VALUES (01719892877586239490, '外包履职评价统计表', 1719287834364436482, 2, 'evaluateTable', 'evaluateTable/index', NULL, 1, 1, 'C', '0', '0', 'core:evaluateTask:statistics', '1', 'chart', NULL, '超级管理员', '2023-09-21 10:37:52', '超级管理员', '2023-09-22 09:42:43', '');
  118. UPDATE sys_menu set menu_type='C',perms='appquestion:list' WHERE platform_type=0 and menu_name='隐患问题清单';
  119. delete from sys_dict_data where dict_type='register_book_type' and dict_value='28';
  120. INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark)
  121. VALUES (28, '监控调阅登记簿', '28', 'register_book_type', null, 'default', 'N', '0', null, now(), null, now(), null);
  122. DELETE from `sys_dict_type` WHERE `dict_type`='app_question_status';
  123. DELETE from `sys_dict_data` WHERE `dict_type`='app_question_status';
  124. INSERT INTO `sys_dict_type` ( `dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 'APP隐患问题状态', 'app_question_status', '0', '超级管理员', '2023-12-19 15:40:55', '', NULL, NULL);
  125. INSERT INTO `sys_dict_data` ( `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 0, '待确认', '0', 'app_question_status', NULL, 'default', 'N', '0', '超级管理员', '2023-12-19 15:42:47', '', NULL, NULL);
  126. INSERT INTO `sys_dict_data` ( `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 1, '提出异议', '1', 'app_question_status', NULL, 'default', 'N', '0', '超级管理员', '2023-12-19 15:42:59', '', NULL, NULL);
  127. INSERT INTO `sys_dict_data` ( `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 3, '已关闭', '3', 'app_question_status', NULL, 'default', 'N', '0', '超级管理员', '2023-12-19 15:43:23', '超级管理员', '2023-12-19 15:43:30', NULL);
  128. INSERT INTO `sys_dict_data` ( `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 10, '待整改', '10', 'app_question_status', NULL, 'default', 'N', '0', '超级管理员', '2023-12-19 15:43:55', '', NULL, NULL);
  129. INSERT INTO `sys_dict_data` ( `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 11, '已整改', '11', 'app_question_status', NULL, 'default', 'N', '0', '超级管理员', '2023-12-19 15:44:07', '超级管理员', '2023-12-19 15:44:31', NULL);
  130. INSERT INTO `sys_dict_data` ( `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 12, '已逾期', '12', 'app_question_status', NULL, 'default', 'N', '0', '超级管理员', '2023-12-19 15:44:18', '', NULL, NULL);
  131. -- 新增安全责任书签署层级字典
  132. DELETE from sys_dict_data where dict_type='sign_level' and dict_label='其他' limit 1;
  133. INSERT INTO `sys_dict_data`( `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (0, '其他', '3', 'sign_level', NULL, 'default', 'N', '0', null, NOW(), null
  134. , NOW(), NULL);