-- 完整诊断菜单404问题

-- 1. 检查直播管理菜单及其子菜单
SELECT 
    m.id,
    m.pid,
    m.name,
    m.path,
    m.component,
    m.is_show,
    m.sort,
    CASE 
        WHEN m.pid = 0 THEN '顶级菜单'
        ELSE CONCAT('子菜单(父ID:', m.pid, ')')
    END as menu_level
FROM eb_system_menu m
WHERE m.name LIKE '%直播%' 
   OR m.path LIKE '%live%'
   OR m.path LIKE '%room%'
   OR m.path LIKE '%family%'
   OR m.path LIKE '%fanGroup%'
   OR m.path LIKE '%streamer%'
ORDER BY m.pid, m.sort, m.id;

-- 2. 检查礼物管理菜单
SELECT 
    m.id,
    m.pid,
    m.name,
    m.path,
    m.component,
    m.is_show,
    m.sort
FROM eb_system_menu m
WHERE m.name LIKE '%礼物%' 
   OR m.path LIKE '%gift%'
ORDER BY m.pid, m.sort, m.id;

-- 3. 检查是否有路径冲突
SELECT 
    path,
    COUNT(*) as count,
    GROUP_CONCAT(CONCAT(id, ':', name) SEPARATOR ' | ') as conflicting_menus
FROM eb_system_menu 
WHERE is_show = 1
GROUP BY path
HAVING count > 1;

-- 4. 检查component路径格式
SELECT 
    id,
    name,
    path,
    component,
    CASE 
        WHEN component LIKE '%.vue' THEN '有.vue扩展名'
        WHEN component LIKE '%/%' THEN '无.vue扩展名'
        ELSE '其他格式'
    END as component_format
FROM eb_system_menu 
WHERE (name LIKE '%直播%' OR path LIKE '%live%' OR path LIKE '%room%')
  AND component IS NOT NULL
  AND component != '';

-- 5. 检查菜单是否被禁用
SELECT 
    id,
    name,
    path,
    is_show,
    CASE 
        WHEN is_show = 1 THEN '显示'
        ELSE '隐藏'
    END as display_status
FROM eb_system_menu 
WHERE name LIKE '%直播%' OR path LIKE '%live%';
