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 = 'sys_org' AND COLUMN_NAME = 'affiliated_area' )
	THEN
    ALTER TABLE `sys_org`
	ADD COLUMN `affiliated_area` varchar(100) NULL COMMENT '机构所属地区' AFTER `tree_parent_code`,
	ADD COLUMN `affiliated_bank` varchar(100) NULL COMMENT '机构所属行社' AFTER `affiliated_area`;

	END IF;
	
	 IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE () 
		AND TABLE_NAME = 'sync_fjnx_org' AND COLUMN_NAME = 'affiliated_area' )
	THEN
		ALTER TABLE `sync_fjnx_org`
		ADD COLUMN `affiliated_area` varchar(100) NULL COMMENT '机构所属地区',
		ADD COLUMN `affiliated_bank` varchar(100) NULL COMMENT '机构所属行社' AFTER `affiliated_area`;

	END IF;

	 IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE ()
		AND TABLE_NAME = 'core_drill_task' AND COLUMN_NAME = 'unrec_status' )
	THEN
        ALTER TABLE `core_drill_task`
        ADD COLUMN `unrec_status` int NULL COMMENT '不推荐标识: 0 未设置不推荐，6 不推荐(保留普通案例) 7   不推荐(保留行社优秀案例) 8 不推荐(保留地区优秀案例)' AFTER `rec_status`;

END IF;

END ??
DELIMITER ;
CALL schema_change ();

UPDATE sys_menu m set m.menu_name='预案演练情况表' WHERE m.menu_name ='演练统计排行';
UPDATE sys_menu m set m.menu_name='教育培训情况表' WHERE m.menu_name ='培训统计排行';
UPDATE sys_menu m set m.menu_name='监控调阅情况表' WHERE m.menu_name ='监控调阅统计报表';
UPDATE sys_menu m set m.menu_name='履职情况表' WHERE m.menu_name ='履职报表';

UPDATE sys_dict_data set dict_label='普通案例' WHERE dict_type='drill_task_rec_status' AND dict_label='正常案例';

DELETE FROM `sys_dict_data` WHERE `dict_type`='drill_task_rec_status' AND `dict_label` like '不推荐%';
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 (6, '不推荐(保留普通案例)', '6', 'drill_task_rec_status', NULL, 'default', 'N', '0', '超级管理员', '2024-01-24 16:29:52', '超级管理员', '2024-01-24 16:42: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 (7, '不推荐(保留行社优秀案例)', '7', 'drill_task_rec_status', NULL, 'default', 'N', '0', '超级管理员', '2024-01-24 16:30:53', '超级管理员', '2024-01-24 16:42:56', 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 (8, '不推荐(保留地区优秀案例)', '8', 'drill_task_rec_status', NULL, 'default', 'N', '0', '超级管理员', '2024-01-24 16:36:35', '超级管理员', '2024-01-24 16:43:02', NULL);

DELETE FROM `sys_dict_data` WHERE `dict_type`='app_question_status' 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 (12, '逾期整改', '13', 'app_question_status', NULL, 'default', 'N', '0', '超级管理员', '2024-01-29 10:21:47', '', NULL, NULL);

DELETE FROM `sys_dict_data` WHERE `dict_type`='question_reform_status' 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 (2, '逾期整改', '13', 'question_reform_status', NULL, 'default', 'N', '0', '超级管理员', '2024-01-29 11:12:41', '超级管理员', '2024-01-29 11:12:53', NULL);

-- 刷新隐患问题状态 已关闭只待办 异议提出的已关闭
UPDATE core_question set confirm_status =2 WHERE confirm_status =3 AND reform_status =11;


