|
@@ -29,14 +29,14 @@ public class MenuServiceImpl implements MenuService {
|
|
|
return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "父id,菜单名称,菜单路径不能为空");
|
|
|
}
|
|
|
if (menu.getParentId() == ConstantStr.TOP_LEVEL_MENU) {
|
|
|
- if (Blank.isNotEmpty(menuDao.getMenuByName(menu.getMenuName()))) {
|
|
|
+ if (Blank.isNotEmpty(menuDao.getMenuByName(menu.getMenuName(),0))) {
|
|
|
return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "该顶级菜单名称已被使用,请更换其他顶级菜单名称");
|
|
|
}
|
|
|
} else {
|
|
|
if (Blank.isNotEmpty(menuDao.getMenuByUrl(menu.getMenuUrl()))) {
|
|
|
return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "该菜单路径已被使用,请更换其他菜单路径");
|
|
|
}
|
|
|
- if (Blank.isNotEmpty(menuDao.getMenuByName(menu.getMenuName()))) {
|
|
|
+ if (Blank.isNotEmpty(menuDao.getMenuByName(menu.getMenuName(),menu.getParentId()))) {
|
|
|
return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "菜单名被占用,请跟换其他名字");
|
|
|
}
|
|
|
}
|
|
@@ -55,13 +55,16 @@ public class MenuServiceImpl implements MenuService {
|
|
|
}
|
|
|
Menu oldMenu = menuDao.getMenuById(menu.getId());
|
|
|
if (oldMenu.getParentId() == ConstantStr.TOP_LEVEL_MENU) {
|
|
|
- if (Blank.isNotEmpty(menuDao.getMenuByNoIdName(menu.getId(), menu.getMenuName()))) {
|
|
|
+ if (Blank.isNotEmpty(menuDao.getMenuByNoIdName(menu.getId(), menu.getMenuName(),0))) {
|
|
|
return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "该顶级菜单名称已被使用,请更换其他顶级菜单名称");
|
|
|
}
|
|
|
} else {
|
|
|
if (Blank.isNotEmpty(menuDao.getMenuByNoIdUrl(menu.getId(), menu.getMenuUrl()))) {
|
|
|
return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "已存在该菜单路径,请更换菜单路径");
|
|
|
}
|
|
|
+ if (Blank.isNotEmpty(menuDao.getMenuByNoIdName(menu.getId(), menu.getMenuName(),menu.getParentId()))) {
|
|
|
+ return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "该顶级菜单名称已被使用,请更换其他顶级菜单名称");
|
|
|
+ }
|
|
|
}
|
|
|
if (menuDao.updateMenu(menu) <= 0) {
|
|
|
return Result.no(ResultEnum.SERVER_ERROR.getRespCode(), "修改菜单失败");
|