SET @now = NOW(); SELECT @imRootId := `id` FROM `hg_admin_menu` WHERE `name` = 'imManager' LIMIT 1; INSERT INTO `hg_admin_menu` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) SELECT NULL, '0', 'IM管理', 'imManager', '/im', '', '1', '/im/tenant/index', '', '', 'LAYOUT', '1', '', '1', '0', '', '0', '0', '0', '1', '', '200', '', '1', @now, @now WHERE @imRootId IS NULL; SELECT @imRootId := `id` FROM `hg_admin_menu` WHERE `name` = 'imManager' LIMIT 1; SELECT @outboxDirId := `id` FROM `hg_admin_menu` WHERE `name` = 'imOutbox' LIMIT 1; INSERT INTO `hg_admin_menu` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) SELECT NULL, @imRootId, 'Outbox运维', 'imOutbox', 'outbox', '', '1', '/im/outbox/index', '', '', 'ParentLayout', '1', '', '0', '0', '', '0', '0', '0', '2', CONCAT('tr_', @imRootId, ' '), '65', '', '1', @now, @now WHERE @outboxDirId IS NULL; SELECT @outboxDirId := `id` FROM `hg_admin_menu` WHERE `name` = 'imOutbox' LIMIT 1; SELECT @outboxListId := `id` FROM `hg_admin_menu` WHERE `name` = 'imOutboxIndex' LIMIT 1; INSERT INTO `hg_admin_menu` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) SELECT NULL, @outboxDirId, 'Outbox列表', 'imOutboxIndex', 'index', '', '2', '', '/imOutbox/list', '', '/imOutbox/index', '1', 'imOutbox', '0', '0', '', '0', '0', '0', '3', CONCAT('tr_', @imRootId, ' tr_', @outboxDirId, ' '), '10', '', '1', @now, @now WHERE @outboxListId IS NULL; SELECT @outboxListId := `id` FROM `hg_admin_menu` WHERE `name` = 'imOutboxIndex' LIMIT 1; INSERT INTO `hg_admin_menu` (`id`, `pid`, `title`, `name`, `path`, `icon`, `type`, `redirect`, `permissions`, `permission_name`, `component`, `always_show`, `active_menu`, `is_root`, `is_frame`, `frame_src`, `keep_alive`, `hidden`, `affix`, `level`, `tree`, `sort`, `remark`, `status`, `created_at`, `updated_at`) SELECT NULL, @outboxListId, title, name, '', '', '3', '', permissions, '', '', '1', '', '0', '0', '', '0', '1', '0', '4', CONCAT('tr_', @imRootId, ' tr_', @outboxDirId, ' tr_', @outboxListId, ' '), sort, '', '1', @now, @now FROM ( SELECT 'Outbox详情' title, 'imOutboxView' name, '/imOutbox/view' permissions, 10 sort UNION ALL SELECT '重试Outbox事件', 'imOutboxRetry', '/imOutbox/retry', 20 UNION ALL SELECT '标记Outbox死信', 'imOutboxDead', '/imOutbox/dead', 30 ) p WHERE @outboxListId IS NOT NULL AND NOT EXISTS (SELECT 1 FROM `hg_admin_menu` WHERE `name` = p.name);