Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,15 @@ public async virtual Task<MenuDto> UpdateAsync(Guid id, MenuUpdateDto input)
{
menu.Component = input.Component;
}
if (menu.ParentId != input.ParentId)
{
if (input.ParentId == menu.Id)
{
throw new BusinessException(PlatformErrorCodes.CannotSetSelfParentMenu, "The current menu cannot be the same as the upper-level menu!");
}
menu.ParentId = input.ParentId;
}

menu.ParentId = input.ParentId;
menu.IsPublic = input.IsPublic;

await MenuManager.UpdateAsync(menu);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"Platform:02001": "The same menu exists in the sibling directory: {Name}!",
"Platform:02002": "You are not allowed to delete menu nodes when there are other submenus!",
"Platform:02003": "The menu level has reached the specified maximum: {Depth}!",
"Platform:02004": "The current menu cannot be the same as the upper-level menu!",
"Platform:02101": "The menu metadata is missing the necessary element :{Name}, which is defined in the data dictionary :{DataName}!",
"Platform:03001": "The metadata format does not match!",
"Platform:04400": "The user favorites the menu repeatedly!",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"Platform:02001": "同级目录下存在相同的菜单: {Name}!",
"Platform:02002": "在有其他子菜单的情况下,不允许删除菜单节点!",
"Platform:02003": "菜单层级已达到规定最大值: {Depth}!",
"Platform:02004": "当前菜单不能与上级菜单相同!",
"Platform:02101": "菜单元数据缺少必要的元素: {Name},此选项在数据字典:{DataName} 中定义!",
"Platform:03001": "元数据格式不匹配!",
"Platform:04400": "用户重复收藏菜单!",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ public static class PlatformErrorCodes
/// </summary>
public const string MenuAchieveMaxDepth = Namespace + ":02003";
/// <summary>
/// 当前菜单不能与上级菜单相同
/// </summary>
public const string CannotSetSelfParentMenu = Namespace + ":02004";
/// <summary>
/// 菜单元数据缺少必要的元素
/// </summary>
public const string MenuMissingMetadata = Namespace + ":02101";
Expand Down
Loading