soc.sql 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. create table if not exists core_reminder_configuration
  2. (
  3. config_id bigint not null comment '配置ID'
  4. primary key,
  5. reminder_type int not null comment '提醒类型(0:逾期提醒、1:临期提醒)',
  6. send_module varchar(50) not null comment '发送模块(五大计划之一)',
  7. plan_id bigint default 1 not null comment '计划id',
  8. plan_name varchar(125) default '' not null comment '计划名称',
  9. compare_time_type int null comment '对比时间类型,0:计划开始时间,1:计划结束时间',
  10. time_unit varchar(25) null comment '时间单位',
  11. reminder_time int null comment '提醒时间',
  12. enabled tinyint(1) default 1 not null comment '是否启用该提醒配置'
  13. )
  14. comment '短信提醒配置表';
  15. -- auto-generated definition
  16. create table if not exists core_reminder_configuration_role(
  17. config_id bigint not null,
  18. target_role_id bigint not null,
  19. target_role_name bigint not null,
  20. primary key (config_id, target_role_id)
  21. )
  22. comment '短信提醒配置角色关联表';
  23. create table if not exists core_reminder_configuration_org(
  24. config_id bigint not null comment '配置id',
  25. target_org_id bigint not null comment '发送目标机构id',
  26. target_org_name varchar(125) not null comment '发送目标机构名称',
  27. target_org_type int not null comment '发送目标机构类型',
  28. target_org_path varchar(125) not null comment '发送目标机构路径',
  29. primary key (config_id, target_org_id)
  30. )
  31. comment '短信提醒配置机构关联表';
  32. -- auto-generated definition
  33. create table if not exists core_reminder_log(
  34. log_id bigint not null comment '日志ID'
  35. primary key,
  36. schedule_id bigint not null comment '关联的提醒任务ID',
  37. recipient_id bigint not null comment '目标接收者id',
  38. recipient_name varchar(50) not null comment '目标接收者',
  39. message_content text not null comment '实际发送的短信内容',
  40. send_time datetime not null comment '发送时间',
  41. result_code varchar(50) null comment '发送结果代码',
  42. result_description text null comment '发送结果描述'
  43. )
  44. comment '短信提醒事件日志表';
  45. -- auto-generated definition
  46. create table if not exists core_reminder_schedule(
  47. schedule_id bigint not null comment '任务ID'
  48. primary key,
  49. config_id bigint not null comment '关联的提醒配置ID',
  50. recipient varchar(50) not null comment '目标接收者(手机号码或用户ID)',
  51. scheduled_time datetime null comment '计划发送时间',
  52. status varchar(20) not null comment '任务状态(未发送、已发送、发送失败等)',
  53. sent_time datetime null comment '实际发送时间(若已发送)',
  54. retry_count int default 0 null comment '重试次数(用于处理发送失败情况)'
  55. )
  56. comment '短信提醒事件(任务)表';
  57. -- auto-generated definition
  58. create table if not exists core_reminder_template(
  59. template_id bigint not null comment '模板ID'
  60. primary key,
  61. reminder_type int not null comment '提醒类型(与 core_reminder_configuration 关联)',
  62. template_name varchar(100) not null comment '模板名称',
  63. template_content text not null comment '提醒短信具体内容(支持变量替换)',
  64. language varchar(20) not null comment '模板语言'
  65. )
  66. comment '短信提醒内容模板表';
  67. -- 新增短信提醒配置菜单
  68. delete from sys_menu where id = 1778733750137446402;
  69. 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) VALUES (1778733750137446402,'短信提醒配置', 1, 50, 'reminder', 'core/reminder/index', null, 1, 0, 'C', '0', '0', 'system:reminder:list', '1', 'email', null, null, now(), null, now(), null);
  70. DELETE from sys_role_menu WHERE menu_id in (1778733750137446402);
  71. INSERT into sys_role_menu SELECT id ,1778733750137446402 from sys_role WHERE sys_role.org_type in(1,3);
  72. -- 新增提醒类型字典
  73. delete from sys_dict_type where dict_type = 'reminder_type';
  74. delete from sys_dict_data where dict_type = 'reminder_type';
  75. INSERT INTO sys_dict_type (dict_name, dict_type, status, create_by, create_time, update_by, update_time, remark) VALUES ('提醒类型', 'reminder_type', '0', '超级管理员', '2024-04-12 18:02:23', '', null, null);
  76. 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', 'reminder_type', null, 'default', 'N', '0', '超级管理员', now(), null, null, null);
  77. 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, '临期提醒', '1', 'reminder_type', null, 'default', 'N', '0', '超级管理员', now(), null, null, null);
  78. -- 新增提醒业务类型字典
  79. delete from sys_dict_type where dict_type = 'reminder_business_type';
  80. delete from sys_dict_data where dict_type = 'reminder_business_type';
  81. INSERT INTO sys_dict_type (dict_name, dict_type, status, create_by, create_time, update_by, update_time, remark) VALUES ('提醒业务类型', 'reminder_business_type', '0', null, now(), null, null, null);
  82. 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, '安保履职', 'resumption', 'reminder_business_type', null, 'default', 'N', '0', '超级管理员', now(), null, null, null);
  83. 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, '安全检查', 'safetyCheck', 'reminder_business_type', null, 'default', 'N', '0', '超级管理员', now(), null, null, null);
  84. 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 (2, '教育培训', 'eduTraining', 'reminder_business_type', null, 'default', 'N', '0', '超级管理员', now(), null, null, null);
  85. 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, '预案演练', 'drill', 'reminder_business_type', null, 'default', 'N', '0', '超级管理员', now(), null, null, null);
  86. 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 (4, '监控调阅', 'monitoringRetrieval', 'reminder_business_type', null, 'default', 'N', '0', '超级管理员', now(), null, null, null);
  87. DROP TABLE IF EXISTS `core_safety_work_summary`;
  88. CREATE TABLE `core_safety_work_summary` (
  89. `id` bigint NOT NULL,
  90. `title` varchar(4000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '工作主题',
  91. `date` datetime DEFAULT NULL COMMENT '记录日期',
  92. `content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '内容',
  93. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  94. `update_time` datetime DEFAULT NULL COMMENT '修改时间',
  95. `create_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  96. `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  97. `images` varchar(4000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '照片',
  98. `org_id` bigint DEFAULT NULL COMMENT '机构id',
  99. `type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '文件种类',
  100. `year` int DEFAULT NULL COMMENT '工作年度',
  101. `files` varchar(4000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '总结文件',
  102. PRIMARY KEY (`id`) USING BTREE
  103. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='安全保卫部年度工作总结';
  104. DROP TABLE IF EXISTS `sys_user_account_mapper`;
  105. CREATE TABLE `sys_user_account_mapper` (
  106. `master_user_id` bigint NOT NULL COMMENT '主账号用户Id',
  107. `sub_user_id` bigint NOT NULL COMMENT '可切换子账号用户Id',
  108. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  109. `modified_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人名称',
  110. `update_time` datetime DEFAULT NULL COMMENT '修改时间',
  111. `modified_by` bigint DEFAULT NULL COMMENT '修改人id',
  112. PRIMARY KEY (`master_user_id`,`sub_user_id`) USING BTREE
  113. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='主账号与子账号对应关系表';
  114. DELIMITER ??
  115. DROP PROCEDURE IF EXISTS schema_change ??
  116. CREATE PROCEDURE schema_change () BEGIN
  117. END ??
  118. DELIMITER ;
  119. CALL schema_change ();
  120. -- 新增菜单 年度工作总结
  121. DELETE from `sys_menu` where id in(01774689203604049922,01774690857464254465,01774691065061330945,01774691126533050369,01774691223434055681);
  122. 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`) VALUES (01774689203604049922, '年度工作总结', 1711912586825461761, 4, 'worksummary', 'safetyBook/workSummary/index', NULL, 1, 0, 'C', '0', '0', 'core:worksummary:query', '1', 'documentation', NULL, '超级管理员', '2024-04-01 14:44:12', '超级管理员', '2024-04-01 14:51:17', '');
  123. 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`) VALUES (01774690857464254465, '查询', 1774689203604049922, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'core:worksummary:query', '1', NULL, NULL, '超级管理员', '2024-04-01 14:50:47', '', NULL, '');
  124. 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`) VALUES (01774691065061330945, '新增', 1774689203604049922, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'core:worksummary:add', '1', NULL, NULL, '超级管理员', '2024-04-01 14:51:36', '', NULL, '');
  125. 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`) VALUES (01774691126533050369, '编辑', 1774689203604049922, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'core:worksummary:edit', '1', NULL, NULL, '超级管理员', '2024-04-01 14:51:51', '', NULL, '');
  126. 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`) VALUES (01774691223434055681, '删除', 1774689203604049922, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'core:worksummary:delete', '1', NULL, NULL, '超级管理员', '2024-04-01 14:52:14', '', NULL, '');
  127. DELETE from `sys_menu` where id in(01780130457928527874);
  128. 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`) VALUES (01780130457928527874, '关联账号', 100, 124, '', NULL, NULL, 1, 0, 'F', '0', '0', 'system:user:mapperUser', '1', NULL, NULL, '超级管理员', '2024-04-16 15:06:56', '', NULL, '');