UPDATE sys_dict_data set dict_label='停用' WHERE (dict_type='plan_status' and dict_value=1 ) or (dict_type='sys_user_is_lock' and dict_value=1 );

DELETE FROM `sys_dict_type` WHERE dict_type='rule_status';
DELETE FROM `sys_dict_data` WHERE dict_type='rule_status';
INSERT INTO `sys_dict_type` (`dict_id`, `dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (20231113157, '手册状态', 'rule_status', '0', 'jwx', '2023-11-27 14:55:51', '', NULL, NULL);
INSERT INTO `sys_dict_data` (`dict_code`, `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 (20231114641, 0, '启用', '0', 'rule_status', NULL, 'default', 'N', '0', 'jwx', '2023-11-27 14:56:36', '', NULL, NULL);
INSERT INTO `sys_dict_data` (`dict_code`, `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 (20231114643, 1, '停用', '1', 'rule_status', NULL, 'default', 'N', '0', 'jwx', '2023-11-27 14:56:44', '', NULL, NULL);
DELETE FROM `sys_dict_data` WHERE dict_type='current_position';
INSERT INTO `sys_dict_data` (`dict_code`, `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 (416, 1, '安全保卫部负责人', '1', 'current_position', NULL, 'default', 'N', '0', 'jwx', '2023-11-27 14:56:44', '', NULL, NULL);
INSERT INTO `sys_dict_data` (`dict_code`, `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 (417, 2, '监控中心负责人', '2', 'current_position', NULL, 'default', 'N', '0', 'jwx', '2023-11-27 14:56:44', '', NULL, NULL);
INSERT INTO `sys_dict_data` (`dict_code`, `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 (418, 3, '一般管理人员', '3', 'current_position', NULL, 'default', 'N', '0', 'jwx', '2023-11-27 14:56:44', '', NULL, NULL);
INSERT INTO `sys_dict_data` (`dict_code`, `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 (419, 4, '监控中心操作人员', '4', 'current_position', NULL, 'default', 'N', '0', 'jwx', '2023-11-27 14:56:44', '', NULL, NULL);
INSERT INTO `sys_dict_data` (`dict_code`, `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 (420, 5, '监控中心技术维护岗', '5', 'current_position', NULL, 'default', 'N', '0', 'jwx', '2023-11-27 14:56:44', '', NULL, NULL);
-- 字典名称修改: "教育培训资料类型"->"知识库资料类型"
update sys_dict_type set dict_name='知识库资料类型' where dict_type='edu_materials_type' limit 1;

-- 修改教育培训任务状态字典描述
update sys_dict_data set dict_label='待登记' where dict_type='edu_training_do_status' and dict_label='待培训' and dict_value=0 LIMIT 1;
update sys_dict_data set dict_label='登记中' where dict_type='edu_training_do_status' and dict_label='待提交' and dict_value=4 LIMIT 1;
-- 履职状态描述变更
update sys_dict_data set dict_label='履职中' where dict_type='resumption_status' and dict_label='进行中' and dict_value=2 LIMIT 1;

delete from sys_menu where id in (1732284060286410753,1731872300761878529,1731503585113534466,1729308502301728769,1731496383090913282,1731498925506031618,1731499700525330433,1731501484262158338,1731502833360039937);
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 (1732284060286410753, '导出安全保卫工作情况统计', 103, 6, '', null, null, 1, 0, 'F', '0', '0', 'system:dept:exportSecurityWork', '1', null, null, null, now(), '', null, '');

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 (1729308502301728769, '导出全省农信系统物防建设达标情况', 103, 5, '', null, null, 1, 0, 'F', '0', '0', 'system:dept:exportConstruction', '1', null, null, null, now(), '', null, '');
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 (1731496383090913282, '导出', 1720000571298115585, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'core:monitorAccessReport:export', '1', NULL, NULL, '省联社账号', '2023-11-28 15:52:54', '', NULL, '');
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 (1731498925506031618, '导出', 1722523915868221442, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'core:resumptionReport:export', '1', NULL, NULL, '省联社账号', '2023-11-28 15:52:54', '', NULL, '');
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 (1731499700525330433, '导出', 1723993298998222849, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'core:resumptionReport:export', '1', NULL, NULL, '省联社账号', '2023-11-28 15:52:54', '', NULL, '');
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 (1731501484262158338, '导出', 1724355771043504129, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'core:resumptionReport:export', '1', NULL, NULL, '省联社账号', '2023-11-28 15:52:54', '', NULL, '');
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 (1731502833360039937, '导出', 1724607752400044034, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'core:resumptionReport:export', '1', NULL, NULL, '省联社账号', '2023-11-28 15:52:54', '', NULL, '');
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 (1731503585113534466, '导出', 1726904309791121409, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'core:safetyInspectReport:export', '1', NULL, NULL, '省联社账号', '2023-11-28 15:52:54', '', NULL, '');
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 (1731872300761878529, '导出', 1719892877586239490, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'core:evaluateTaskReport:export', '1', NULL, NULL, '省联社账号', '2023-11-28 15:52:54', '', NULL, '');


delete from sys_role_menu where menu_id in (1732284060286410753,1731872300761878529,1731503585113534466,1731502833360039937,1729308502301728769,1731496383090913282,1731498925506031618,1731499700525330433,1731501484262158338);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (115, 1732284060286410753);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (116, 1732284060286410753);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (117, 1732284060286410753);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (118, 1732284060286410753);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (119, 1732284060286410753);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (120, 1732284060286410753);

INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (115, 1731872300761878529);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (116, 1731872300761878529);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (117, 1731872300761878529);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (118, 1731872300761878529);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (119, 1731872300761878529);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (120, 1731872300761878529);

INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (115, 1731503585113534466);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (116, 1731503585113534466);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (117, 1731503585113534466);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (118, 1731503585113534466);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (119, 1731503585113534466);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (120, 1731503585113534466);

INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (115, 1731502833360039937);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (116, 1731502833360039937);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (117, 1731502833360039937);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (118, 1731502833360039937);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (119, 1731502833360039937);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (120, 1731502833360039937);

INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (115, 1731501484262158338);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (116, 1731501484262158338);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (117, 1731501484262158338);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (118, 1731501484262158338);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (119, 1731501484262158338);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (120, 1731501484262158338);

INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (115, 1731499700525330433);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (116, 1731499700525330433);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (117, 1731499700525330433);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (118, 1731499700525330433);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (119, 1731499700525330433);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (120, 1731499700525330433);

INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (115, 1731498925506031618);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (116, 1731498925506031618);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (117, 1731498925506031618);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (118, 1731498925506031618);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (119, 1731498925506031618);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (120, 1731498925506031618);

INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (115, 1731496383090913282);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (116, 1731496383090913282);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (117, 1731496383090913282);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (118, 1731496383090913282);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (119, 1731496383090913282);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (120, 1731496383090913282);

INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (115, 1729308502301728769);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (116, 1729308502301728769);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (117, 1729308502301728769);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (118, 1729308502301728769);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (119, 1729308502301728769);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (120, 1729308502301728769);
delete  from `sys_menu` where  id=01729407886809481218;
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 (01729407886809481218, '导出', 2318, 8, '', NULL, NULL, 1, 0, 'F', '0', '0', 'core:safetycheck:export', '1', NULL, NULL, '省联社账号', '2023-11-28 15:52:54', '', NULL, '');

-- web培训统计报表菜单及权限
delete from sys_menu where id = 1730059329344102401;
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 (01730059329344102401, '培训统计排行', 1719287834364436482, 700, 'core/reportForms/eduTraining', 'core/reportForms/eduTraining', NULL, 1, 0, 'C', '0', '0', NULL, '1', 'chart', NULL, NULL, NOW(),NULL , NOW(), NULL);
delete from sys_role_menu where menu_id=1730059329344102401;
insert into sys_role_menu select  id,1730059329344102401 from sys_role where org_type in (1,2,3);

-- web演练统计报表菜单及权限
delete from sys_menu where id = 01730111975367106562;
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 (01730111975367106562, '演练统计排行', 1719287834364436482, 701, 'core/reportForms/drill', 'core/reportForms/drill', NULL, 1, 0, 'C', '0', '0', NULL, '1', 'chart', NULL, NULL, NOW(),NULL , NOW(), NULL);
delete from sys_role_menu where menu_id=01730111975367106562;
insert into sys_role_menu select  id,01730111975367106562 from sys_role where org_type in (1,2,3);
-- 添加行社高管部署登记主持人字典
DELETE FROM `sys_dict_type` WHERE `dict_type`='hsggbsdj_role';
INSERT INTO `sys_dict_type`(`dict_id`, `dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (20231113159, '行社高管部署登记主持人', 'hsggbsdj_role', '0', '省联社账号', '2023-12-05 14:56:22', '', NULL, NULL);
DELETE FROM `sys_dict_data` WHERE `dict_type`='hsggbsdj_role';
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', 'hsggbsdj_role', NULL, 'default', 'N', '0', '省联社账号', '2023-12-05 14:56:48', '', NULL, NULL);
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, '行长', '2', 'hsggbsdj_role', NULL, 'default', 'N', '0', '省联社账号', '2023-12-05 14:56:55', '', NULL, NULL);




update sys_menu set menu_name='履职手册' WHERE menu_name='履职内容库' and platform_type=1 and menu_type='C' ;
update sys_menu set menu_name='检查手册' WHERE menu_name='检查内容库' and platform_type=1 and menu_type='C' ;
update sys_menu set menu_name='检查手册' WHERE menu_name='检查内容库' and platform_type=1 and menu_type='C' ;

-- 文书档案文件表
CREATE TABLE if not exists `core_safety_book_book_files` (
                                               `id` bigint NOT NULL,
                                               `book_user_id` bigint DEFAULT NULL,
                                               `name` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL,
                                               `url` varchar(2000) COLLATE utf8mb4_general_ci DEFAULT NULL,
                                               `create_by` bigint DEFAULT NULL COMMENT '创建人id',
                                               `create_time` datetime(6) DEFAULT NULL COMMENT '创建时间',
                                               `update_by` bigint DEFAULT NULL COMMENT '修改人id',
                                               `update_time` datetime(6) DEFAULT NULL COMMENT '更新时间',
                                               PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- 新安全责任书表
DROP TABLE
    IF
        EXISTS `core_safety_book_new`;
CREATE TABLE if not exists `core_safety_book_new` (
                                        `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
                                        `year` int NOT NULL COMMENT '所属年份',
                                        `create_by` bigint DEFAULT NULL COMMENT '创建人id',
                                        `create_time` datetime(6) DEFAULT NULL COMMENT '创建时间',
                                        `update_by` bigint DEFAULT NULL COMMENT '修改人id',
                                        `update_time` datetime(6) DEFAULT NULL COMMENT '更新时间',
                                        `deleted` int DEFAULT '0' COMMENT '是否删除',
                                        `type` int DEFAULT NULL COMMENT '签署责任书类型',
                                        `time` datetime DEFAULT NULL COMMENT '签署时间',
                                        `party_a` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '甲方',
                                        `party_b` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '乙方',
                                        `party_a_org` bigint DEFAULT NULL COMMENT '甲方机构',
                                        `party_b_org` bigint DEFAULT NULL COMMENT '乙方机构',
                                        `sign_level` int DEFAULT NULL COMMENT '签署层级',
                                        `party_a_org_name` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '甲方机构名称',
                                        `party_b_org_name` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '乙方机构名称',
                                        PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- 添加新安全责任书菜单
DELETE FROM `sys_menu` WHERE id IN (1732224068700721153,1732225804865753089,1732225877351714817,1732225942820605954,1732226010889965570);
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 (1732224068700721153, '新安全责任书', 1711912586825461761, 4, 'safetyBookNew', 'safetyBook/newBook/index', NULL, 1, 0, 'C', '0', '0', 'safetyBookNew', '1', 'documentation', NULL, '省联社账号', '2023-12-06 10:23:25', '', NULL, '');
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 (1732225804865753089, '列表', 1732224068700721153, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'core:safetyBooknew:list', '1', NULL, NULL, '超级管理员', '2023-12-06 10:30:18', '', NULL, '');
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 (1732225877351714817, '详情', 1732224068700721153, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'core:safetyBooknew:query', '1', NULL, NULL, '超级管理员', '2023-12-06 10:30:36', '', NULL, '');
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 (1732225942820605954, '新增', 1732224068700721153, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'core:safetyBooknew:add', '1', NULL, NULL, '超级管理员', '2023-12-06 10:30:51', '', NULL, '');
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 (1732226010889965570, '删除', 1732224068700721153, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'core:safetyBooknew:remove', '1', NULL, NULL, '超级管理员', '2023-12-06 10:31:08', '', NULL, '');
-- 添加新安全责任书字典
DELETE FROM `sys_dict_type` WHERE `dict_type`='sign_level';
INSERT INTO `sys_dict_type`( `dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( '签署层级', 'sign_level', '0', '省联社账号', '2023-12-06 14:37:33', '', NULL, NULL);
DELETE FROM `sys_dict_data` WHERE `dict_type`='sign_level';
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', 'sign_level', NULL, 'default', 'N', '0', '省联社账号', '2023-12-06 14:39:30', '超级管理员', '2023-12-06 14:41:49', NULL);
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, '各职能部门、营业网点与各员工', '2', 'sign_level', NULL, 'default', 'N', '0', '省联社账号', '2023-12-06 14:40:09', '超级管理员', '2023-12-06 14:41:56', NULL);

delete  from sys_config where  config_key='is_display_password';
INSERT INTO sys_config ( config_name, config_key, config_value, config_type, create_by, create_time, update_by, update_time, remark )
VALUES
    ( '是否显示修改资料和修改密码', 'is_display_password', 'Y', 'Y', 'jwx', now(), 'jwx', now(), 'Y不显示，N显示' );
DELETE FROM `sys_menu` WHERE id IN(1714247486990786561,2126,01717081639428923393,01717081756911378434);
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 (1714247486990786561, '撤回计划', 2052, 9, '', null, null, 1, 0, 'F', '0', '0', 'core:accessPlan:withdraw', '1', null, null, null, now(), '', null, '');
INSERT INTO `sys_menu` VALUES (2126, '下发任务', 2052, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'core:accessPlan:release', '1', '#', NULL, '超级管理员', '2023-09-04 17:54:35', '', NULL, '');
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 (01717081639428923393, '下发', 1717076927401005058, 7, NULL, NULL, NULL, 1, 0, 'F', '0', '0', 'core:evaluatePlan:distribute', '1', NULL, NULL, '超级管理员', '2023-09-21 10:37:52', '超级管理员', '2023-09-22 09:42:43', '');
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 (01717081756911378434, '撤回', 1717076927401005058, 8, NULL, NULL, NULL, 1, 0, 'F', '0', '0', 'core:evaluatePlan:withdraw', '1', NULL, NULL, '超级管理员', '2023-09-21 10:37:52', '超级管理员', '2023-09-22 09:42:43', '');
-- 修改菜单排序
UPDATE `sys_menu` SET `order_num` = 2 WHERE `menu_name` = '驾驶舱';
UPDATE `sys_menu` SET `order_num` = 4 WHERE `menu_name` = '日常履职';
UPDATE `sys_menu` SET `order_num` = 6 WHERE `menu_name` = '监控调阅';
UPDATE `sys_menu` SET `order_num` = 8 WHERE `menu_name` = '教育培训';
UPDATE `sys_menu` SET `order_num` = 10 WHERE `menu_name` = '预案演练';
UPDATE `sys_menu` SET `order_num` = 12 WHERE `menu_name` = '安全检查';
UPDATE `sys_menu` SET `order_num` = 14 WHERE `menu_name` = '隐患管理';
UPDATE `sys_menu` SET `order_num` = 16 WHERE `menu_name` = '来访管理';
UPDATE `sys_menu` SET `order_num` = 18 WHERE `menu_name` = '综合考核';
UPDATE `sys_menu` SET `order_num` = 20 WHERE `menu_name` = '基础信息';
UPDATE `sys_menu` SET `order_num` = 22 WHERE `menu_name` = '统计报表';
UPDATE `sys_menu` SET `order_num` = 24 WHERE `menu_name` = '信息中心';
UPDATE `sys_menu` SET `menu_name` = '档案管理' WHERE `menu_name` = '文书档案';
UPDATE `sys_menu` SET `order_num` = 26 WHERE `menu_name` = '档案管理';
UPDATE `sys_menu` SET `order_num` = 28 WHERE `menu_name` = '系统管理';
UPDATE `sys_menu` SET `menu_name` = '系统运维' WHERE `menu_name` = '系统监控';
UPDATE `sys_menu` SET `order_num` = 30 WHERE `menu_name` = '系统运维';
UPDATE `sys_menu` SET `order_num` = 999 WHERE `menu_name` = '登记簿批量导出' limit 1;

update sys_menu set menu_name='履职手册管理' WHERE menu_name='履职手册' and menu_type='C';
update sys_menu set menu_name='检查手册管理' WHERE menu_name='检查手册' and menu_type='C';

DELIMITER ??
DROP PROCEDURE
    IF
        EXISTS schema_change ?? CREATE PROCEDURE schema_change () BEGIN
    -- 安全责任书增加甲方乙方
    IF
        NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE () AND TABLE_NAME = 'core_safety_book_user' AND COLUMN_NAME = 'party_a' ) THEN
        ALTER TABLE `core_safety_book_user` ADD COLUMN `party_a` VARCHAR ( 255 ) NULL COMMENT '甲方';

    END IF;
    IF
        NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE () AND TABLE_NAME = 'core_safety_book_user' AND COLUMN_NAME = 'party_b' ) THEN
        ALTER TABLE `core_safety_book_user` ADD COLUMN `party_b` VARCHAR ( 255 ) NULL COMMENT '乙方';

    END IF;
    IF
        NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE () AND TABLE_NAME = 'core_safety_book_user' AND COLUMN_NAME = 'party_a_org' ) THEN
        ALTER TABLE `core_safety_book_user` ADD COLUMN `party_a_org` VARCHAR ( 255 ) NULL COMMENT '甲方机构';

    END IF;
    IF
        NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE () AND TABLE_NAME = 'core_safety_book_user' AND COLUMN_NAME = 'party_b_org' ) THEN
        ALTER TABLE `core_safety_book_user` ADD COLUMN `party_b_org` VARCHAR ( 255 ) NULL COMMENT '乙方机构';

    END IF;
    -- 行社高管部署登记修改主持人
    IF
        NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE () AND TABLE_NAME = 'core_safety_book_hsggbsdj' AND COLUMN_NAME = 'role_id' ) THEN
        ALTER TABLE `core_safety_book_hsggbsdj` ADD COLUMN `role_id` bigint NULL COMMENT '主持人';

    END IF;

    IF
NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE () AND TABLE_NAME = 'sys_device' AND COLUMN_NAME = 'definition' ) THEN
ALTER TABLE `sys_device` ADD COLUMN `definition` VARCHAR ( 2 ) NULL COMMENT '是否高清';

END IF;

    IF
NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE () AND TABLE_NAME = 'sys_user_information' AND COLUMN_NAME = 'alone_dept' ) THEN
ALTER TABLE `sys_user_information` ADD COLUMN `alone_dept` VARCHAR ( 2 ) NULL COMMENT '是否独立机构';

END IF;
    -- 处理记录增加登记簿url字段
    IF NOT EXISTS(SELECT *
                  FROM information_schema.columns
                  WHERE table_schema = DATABASE()
                    AND table_name = 'core_out_in_record'
                    AND column_name = 'pdf_url') THEN
        ALTER TABLE  `core_out_in_record`
            ADD COLUMN `pdf_url` varchar(255) NULL COMMENT '登记簿url' AFTER `check_image`;
    END IF;


	IF
        NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE () AND TABLE_NAME = 'core_resumption_plan' AND COLUMN_NAME = 'solid_id' ) THEN
        ALTER TABLE  `core_resumption_plan` 
			MODIFY COLUMN `parent_id` bigint NULL DEFAULT -1 COMMENT '下发父计划id' AFTER `id`,
			ADD COLUMN `solid_id` bigint NULL COMMENT '固定的id,用于识别多个副本是否属于同一个计划' AFTER `parent_id`,
			ADD COLUMN `parent_solid_id` bigint NULL COMMENT '固定的parentid,用于识别多个副本是否属于同一个计划' AFTER `solid_id`;
    END IF;
	IF
        NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE () AND TABLE_NAME = 'core_resumption' AND COLUMN_NAME = 'solid_id' ) THEN
        ALTER TABLE  `core_resumption` 
			ADD COLUMN `solid_id` bigint NULL COMMENT '固定的id,用于识别多个副本是否属于同一个计划' AFTER `plan_id`,
			ADD COLUMN `parent_solid_id` bigint NULL COMMENT '固定的parentid,用于识别多个副本是否属于同一个计划' AFTER `solid_id`;
    END IF;
	IF
        EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE () AND TABLE_NAME = 'core_resumption_plan_to_point' AND COLUMN_NAME = 'effective_date' ) THEN
        ALTER TABLE `core_resumption_plan_to_point` 
			DROP COLUMN `effective_date`;
    END IF;
	
	IF
       NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE () AND TABLE_NAME = 'core_resumption_plan' AND COLUMN_NAME = 'publish_time' ) THEN
        	ALTER TABLE `core_resumption_plan` 
				ADD COLUMN `publish_time` datetime NULL COMMENT '最后一次下发时间' AFTER `task_has_completed`,
				ADD COLUMN `withdraw_time` datetime NULL COMMENT '最后一次撤回时间' AFTER `publish_time`,
				ADD COLUMN `effective_time` datetime NULL COMMENT '计划生效时间' AFTER `withdraw_time`;
				update core_resumption_plan set publish_time =update_time WHERE publish_time is null and plan_status=1;
				update core_resumption_plan set withdraw_time =update_time WHERE withdraw_time is null and plan_status=2;
				update core_resumption_plan set effective_time =update_time WHERE effective_time is null and plan_status=1;
    END IF;
END ??
DELIMITER;
CALL schema_change ();

-- 删除知识库标签管理菜单权限
set @id = (select id from sys_menu where menu_name='知识库标签管理' limit 1);
update sys_menu  set id =1731954732809224193 where id=@id;
update sys_menu  set parent_id =1731954732809224193 where parent_id=@id;
-- 隐藏知识库标签管理菜单
delete  from sys_role_menu rm  where rm.menu_id in ( select id from sys_menu  where menu_name='知识库标签管理' union all select sm.id from sys_menu m inner join sys_menu sm on m.id=sm.parent_id where  m.menu_name='知识库标签管理');
delete from sys_menu where id=1731954732809224193 or parent_id=1731954732809224193;

-- 恢复知识库标签管理菜单权限
-- set @eduParentId = (select id from sys_menu where menu_name='教育培训' limit 1);
-- INSERT INTO `sys_menu`(`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 ('查询标签', 1731954732809224193, 1, '', NULL, NULL, 1, 0, 'F', '0', '0', 'core:knowledge:query', '1', '#', NULL, '何悦', '2023-08-21 15:54:54', '何悦', '2023-08-24 09:04:24', '');
-- INSERT INTO `sys_menu`(`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 ('新增标签', 1731954732809224193, 2, '', NULL, NULL, 1, 0, 'F', '0', '0', 'core:knowledge:add', '1', '#', NULL, '何悦', '2023-08-21 15:55:21', '何悦', '2023-08-24 09:04:37', '');
-- INSERT INTO `sys_menu`(`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 ('编辑标签', 1731954732809224193, 3, '', NULL, NULL, 1, 0, 'F', '0', '0', 'core:knowledge:edit', '1', '#', NULL, '何悦', '2023-08-21 15:55:42', '何悦', '2023-08-24 09:04:44', '');
-- INSERT INTO `sys_menu`(`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 ('删除标签', 1731954732809224193, 4, '', NULL, NULL, 1, 0, 'F', '0', '0', 'core:knowledge:remove', '1', '#', NULL, '何悦', '2023-08-21 15:56:03', '何悦', '2023-08-24 09:04:59', '');
-- 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 (1731954732809224193, '知识库标签管理', @eduParentId, 14, 'knowledge', 'core/knowledge/index', NULL, 1, 0, 'C', '0', '0', 'core:knowledge:list', '1', 'documentation', NULL, '何悦', '2023-08-21 15:49:29', '超级管理员', '2023-09-14 14:33:40', '');

-- 修改安全责任书类型
DELETE FROM `sys_dict_data` WHERE `dict_type`='safety_book_type';
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', 'safety_book_type', NULL, 'default', 'N', '0', '超级管理员', '2023-10-11 14:37:00', '省联社账号', '2023-12-06 16:24:41', NULL);
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, '联防协议书', '2', 'safety_book_type', NULL, 'default', 'N', '0', '超级管理员', '2023-10-11 14:37:07', '省联社账号', '2023-11-24 09:16:58', NULL);
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', 'safety_book_type', NULL, 'default', 'N', '0', '超级管理员', '2023-10-11 14:37:13', '省联社账号', '2023-11-24 09:17:05', NULL);

-- 修改安全责任书菜单
DELETE FROM `sys_menu` WHERE id IN (1711913107380531202,1732224068700721153);
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 (1711913107380531202, '旧安全责任书', 1711912586825461761, 1, 'index', 'safetyBook/index', NULL, 1, 0, 'C', '1', '0', '', '1', 'clipboard', NULL, '超级管理员', '2023-10-11 09:14:42', '省联社账号', '2023-12-07 11:01:00', '');

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 (1732224068700721153, '安全责任书', 1711912586825461761, 4, 'safetyBookNew', 'safetyBook/newBook/index', NULL, 1, 0, 'C', '0', '0', 'safetyBookNew', '1', 'documentation', NULL, '省联社账号', '2023-12-06 10:23:25', '省联社账号', '2023-12-07 11:01:09', '');
-- 修改高管角色
DELETE FROM `sys_dict_data` WHERE `dict_type`='hsggbsdj_role';
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', 'hsggbsdj_role', NULL, 'default', 'N', '0', '省联社账号', '2023-12-05 14:56:48', '省联社账号', '2023-12-07 15:22:29', NULL);
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, '行长（主任）', '2', 'hsggbsdj_role', NULL, 'default', 'N', '0', '省联社账号', '2023-12-05 14:56:55', '省联社账号', '2023-12-07 15:22:39', NULL);
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', 'hsggbsdj_role', NULL, 'default', 'N', '0', '省联社账号', '2023-12-07 15:22:48', '', NULL, NULL);
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, '行长助理（主任助理）', '4', 'hsggbsdj_role', NULL, 'default', 'N', '0', '省联社账号', '2023-12-07 15:23:04', '', NULL, NULL);


UPDATE sys_menu set menu_name='安全检查' WHERE menu_name='安全检查登记' and platform_type=0;
UPDATE sys_menu set menu_name='布防撤防' WHERE menu_name='布撤防状态登记' and platform_type=0;
UPDATE sys_menu set menu_name='教育培训' WHERE menu_name='培训登记' and platform_type=0;
UPDATE sys_menu set menu_name='预案演练' WHERE menu_name='演练登记' and platform_type=0;

UPDATE sys_menu set menu_name='查询' WHERE menu_name='履职内容库定义查询' and menu_type='F' and platform_type=1;
UPDATE sys_menu set menu_name='新增履职手册' WHERE menu_name='履职内容库定义新增' and menu_type='F' and platform_type=1;
UPDATE sys_menu set menu_name='编辑手册' WHERE menu_name='履职内容库定义编辑' and menu_type='F' and platform_type=1;
UPDATE sys_menu set menu_name='删除' WHERE menu_name='履职内容库定义删除' and menu_type='F' and platform_type=1;
UPDATE sys_menu set menu_name='管理履职内容' WHERE menu_name='履职内容库管理' and menu_type='F' and platform_type=1;
UPDATE sys_menu set menu_name='管理检查内容' WHERE menu_name='内容库管理' and menu_type='F' and platform_type=1;
-- 新增来访管理登记簿字典
delete from sys_dict_data where dict_type='register_book_type' and dict_label='来访管理登记簿';
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', 'register_book_type', NULL, 'default', 'N', '0', NULL, NOW(), NULL, NOW(), NULL);


