-- HTTP 审计规则菜单（系统管理下，与 HTTP接口审计 同级）；执行前请确认 id 393-397 未被占用
SET NAMES utf8mb4;

INSERT INTO `sys_menu` (`id`, `name`, `parent_id`, `parent_name`, `path`, `path_name`, `route`, `component`, `brief`, `code`, `type`, `authority`, `icon`, `sort`, `meta`, `tenant_id`, `status`, `deleted`, `create_time`, `create_by`, `update_time`, `update_by`, `memo`)
SELECT 393, 'menu.httpAuditRule', 1, 'menu.system', '1,393', 'menu.httpAuditRule', '/system/httpAuditRule', 'httpAuditRule', NULL, NULL, 0, NULL, 'Rule', 7, NULL, 1, 1, 0, NULL, NULL, NULL, NULL, NULL
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `id` = 393);

INSERT INTO `sys_menu` (`id`, `name`, `parent_id`, `parent_name`, `path`, `path_name`, `route`, `component`, `brief`, `code`, `type`, `authority`, `icon`, `sort`, `meta`, `tenant_id`, `status`, `deleted`, `create_time`, `create_by`, `update_time`, `update_by`, `memo`)
SELECT 394, 'Query HttpAuditRule', 393, '', '1,393,394', NULL, NULL, NULL, NULL, NULL, 1, 'system:httpAuditRule:list', NULL, 0, NULL, 1, 1, 0, NULL, NULL, NULL, NULL, NULL
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `id` = 394);

INSERT INTO `sys_menu` (`id`, `name`, `parent_id`, `parent_name`, `path`, `path_name`, `route`, `component`, `brief`, `code`, `type`, `authority`, `icon`, `sort`, `meta`, `tenant_id`, `status`, `deleted`, `create_time`, `create_by`, `update_time`, `update_by`, `memo`)
SELECT 395, 'Save HttpAuditRule', 393, '', '1,393,395', NULL, NULL, NULL, NULL, NULL, 1, 'system:httpAuditRule:save', NULL, 1, NULL, 1, 1, 0, NULL, NULL, NULL, NULL, NULL
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `id` = 395);

INSERT INTO `sys_menu` (`id`, `name`, `parent_id`, `parent_name`, `path`, `path_name`, `route`, `component`, `brief`, `code`, `type`, `authority`, `icon`, `sort`, `meta`, `tenant_id`, `status`, `deleted`, `create_time`, `create_by`, `update_time`, `update_by`, `memo`)
SELECT 396, 'Update HttpAuditRule', 393, '', '1,393,396', NULL, NULL, NULL, NULL, NULL, 1, 'system:httpAuditRule:update', NULL, 2, NULL, 1, 1, 0, NULL, NULL, NULL, NULL, NULL
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `id` = 396);

INSERT INTO `sys_menu` (`id`, `name`, `parent_id`, `parent_name`, `path`, `path_name`, `route`, `component`, `brief`, `code`, `type`, `authority`, `icon`, `sort`, `meta`, `tenant_id`, `status`, `deleted`, `create_time`, `create_by`, `update_time`, `update_by`, `memo`)
SELECT 397, 'Delete HttpAuditRule', 393, '', '1,393,397', NULL, NULL, NULL, NULL, NULL, 1, 'system:httpAuditRule:remove', NULL, 3, NULL, 1, 1, 0, NULL, NULL, NULL, NULL, NULL
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `id` = 397);

INSERT INTO `sys_role_menu` (`role_id`, `menu_id`)
SELECT 1, 393 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_role_menu` WHERE `role_id` = 1 AND `menu_id` = 393);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`)
SELECT 1, 394 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_role_menu` WHERE `role_id` = 1 AND `menu_id` = 394);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`)
SELECT 1, 395 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_role_menu` WHERE `role_id` = 1 AND `menu_id` = 395);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`)
SELECT 1, 396 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_role_menu` WHERE `role_id` = 1 AND `menu_id` = 396);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`)
SELECT 1, 397 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_role_menu` WHERE `role_id` = 1 AND `menu_id` = 397);
