Files
cattleTransportation/tradeCattle/update_menu_names_final.sql
2025-10-21 17:29:52 +08:00

31 lines
760 B
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- 修改菜单名称的SQL脚本
-- 删除第一个"test"菜单项,将第二个"test"改为"系统管理"
-- 方案1基于sort字段删除和修改
-- 删除sort值最小的"test"菜单项
DELETE FROM sys_menu
WHERE name = 'test'
AND parent_id = 0
AND is_delete = 0
AND sort = (
SELECT min_sort FROM (
SELECT MIN(sort) as min_sort
FROM sys_menu
WHERE name = 'test' AND parent_id = 0 AND is_delete = 0
) t
);
-- 将剩余的"test"菜单项改为"系统管理"
UPDATE sys_menu
SET name = '系统管理',
update_time = NOW()
WHERE name = 'test'
AND parent_id = 0
AND is_delete = 0;
-- 验证修改结果
SELECT id, parent_id, name, type, sort, icon
FROM sys_menu
WHERE is_delete = 0
ORDER BY sort;