-- =====================================================
-- fix_menu_components.sql 执行状态验证脚本
-- 在租户库执行：SELECT component FROM sys_menu WHERE menu_id=29355;
-- 预期返回: 'crm/customer/index'
-- 如果返回 'admin/crm/customer/index' → fix未执行 → 311个动态菜单404
-- =====================================================

-- 1. 核心检查：menu_id=29355 (crm/customer)
SELECT menu_id, menu_name, component,
       CASE WHEN component = 'crm/customer/index' THEN 'OK' ELSE 'NEED_FIX' END AS status
FROM sys_menu WHERE menu_id = 29355;

-- 2. 批量检查：还有多少菜单的 component 仍以 admin/ 开头
SELECT COUNT(*) AS needs_fix_count,
       CASE WHEN COUNT(*) = 0 THEN '全部已修复' ELSE CONCAT('还有 ', COUNT(*), ' 条需要修复') END AS summary
FROM sys_menu WHERE component LIKE 'admin/%';

-- 3. 抽查几个关键菜单
SELECT menu_id, menu_name, component FROM sys_menu WHERE menu_id IN (29194, 29384, 29525, 29543, 29556, 29639) ORDER BY menu_id;

-- 4. 如果以上查询显示还有 admin/ 前缀，执行 fix_menu_components.sql
-- 文件路径: d:\AICODE\saas\fix_menu_components.sql
