!1484 fix: 修复新增菜单时被允许相同组件名称问题

Merge pull request !1484 from 半栈幼儿员/hotfix/menu
This commit is contained in:
芋道源码 2025-12-25 13:43:24 +00:00 committed by Gitee
commit 3f1d80364f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -255,6 +255,9 @@ public class MenuServiceImpl implements MenuService {
return;
}
// 如果 id 为空说明不用比较是否为相同 id 的菜单
if (id == null) {
throw exception(MENU_NAME_DUPLICATE);
}
if (!menu.getId().equals(id)) {
throw exception(MENU_NAME_DUPLICATE);
}
@ -277,7 +280,7 @@ public class MenuServiceImpl implements MenuService {
}
// 如果 id 为空说明不用比较是否为相同 id 的菜单
if (id == null) {
return;
throw exception(MENU_COMPONENT_NAME_DUPLICATE);
}
if (!menu.getId().equals(id)) {
throw exception(MENU_COMPONENT_NAME_DUPLICATE);