菜单管理修改接口优化
This commit is contained in:
@@ -284,10 +284,15 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
||||
@Override
|
||||
public int updateMenu(SysMenu menu) {
|
||||
//路径Path唯一性判断
|
||||
SysMenu sysMenu = menuMapper.selectMenuByPath(menu.getPath());
|
||||
if (sysMenu != null && !menu.getMenuId().equals(sysMenu.getMenuId())) {
|
||||
return -1;
|
||||
String path = menu.getPath();
|
||||
if (StringUtils.isNotBlank(path)) {
|
||||
SysMenu sysMenu = menuMapper.selectMenuByPath(menu.getPath());
|
||||
// 先判断sysMenu是否不为null,再比较menuId
|
||||
if (sysMenu != null && !menu.getMenuId().equals(sysMenu.getMenuId())) {
|
||||
return -1; // 路由地址已存在
|
||||
}
|
||||
}
|
||||
// 执行更新
|
||||
return menuMapper.updateMenu(menu);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user