-- 检查粉丝团菜单是否存在
SELECT '=== 检查粉丝团菜单 ===' as info;
SELECT id, pid, name, path, component, perms, sort, is_show 
FROM eb_system_menu 
WHERE name LIKE '%粉丝团%' OR path LIKE '%fanGroup%' OR path LIKE '%fan-group%';

-- 如果不存在，添加粉丝团菜单
-- 首先找到"社交管理"或"直播管理"的父菜单ID
SELECT '=== 查找父菜单 ===' as info;
SELECT id, name, path FROM eb_system_menu WHERE name IN ('社交管理', '直播管理', '用户管理') AND pid = 0;

-- 添加粉丝团菜单（如果不存在）
-- 注意：需要根据实际的父菜单ID调整pid值
INSERT INTO eb_system_menu (pid, name, icon, path, component, perms, menu_type, sort, is_show, create_time, update_time)
SELECT 
    (SELECT id FROM eb_system_menu WHERE name = '社交管理' AND pid = 0 LIMIT 1) as pid,
    '粉丝团管理' as name,
    'el-icon-star-on' as icon,
    '/fanGroup/list' as path,
    'fanGroup/list/index' as component,
    'admin:fan:group:list' as perms,
    'C' as menu_type,
    10 as sort,
    1 as is_show,
    NOW() as create_time,
    NOW() as update_time
WHERE NOT EXISTS (
    SELECT 1 FROM eb_system_menu WHERE path = '/fanGroup/list'
);

-- 验证菜单
SELECT '=== 验证粉丝团菜单 ===' as info;
SELECT id, pid, name, path, component, perms, sort, is_show 
FROM eb_system_menu 
WHERE name LIKE '%粉丝团%' OR path LIKE '%fanGroup%';
