-- 修改菜单名称的SQL脚本
-- 删除第一个"test"菜单项，将第二个"test"改为"系统管理"

-- 1. 首先查看当前的菜单结构
-- SELECT id, parent_id, name, type, sort FROM sys_menu WHERE is_delete = 0 ORDER BY sort;

-- 2. 删除第一个"test"菜单项（假设它的sort值较小）
-- 注意：这里需要根据实际的菜单ID来删除，请先查询确认
DELETE FROM sys_menu WHERE name = 'test' AND parent_id = 0 AND sort = (SELECT MIN(sort) FROM sys_menu WHERE name = 'test' AND parent_id = 0 AND is_delete = 0);

-- 3. 将第二个"test"菜单项的名称改为"系统管理"
UPDATE sys_menu 
SET name = '系统管理', update_time = NOW() 
WHERE name = 'test' AND parent_id = 0 AND is_delete = 0;

-- 4. 验证修改结果
-- SELECT id, parent_id, name, type, sort FROM sys_menu WHERE is_delete = 0 ORDER BY sort;
