{"record":{"id":"74238ec812d883b7","repo":"paascloud/paascloud-master","slug":"uac10013010","errorCode":"UAC10013010","errorMessage":"选择菜单不是根目录,menuId=%s","messagePattern":"选择菜单不是根目录,menuId=(.+?)","errorType":"error_code","errorClass":"UacBizException","httpStatus":null,"severity":"warning","filePath":"paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacUserServiceImpl.java","lineNumber":929,"sourceCode":"\n\t\tList<MenuVo> currentUserMenuVoList = uacMenuService.findAllMenuListByAuthResDto(authResDto);\n\t\tList<Long> currentUserMenuIdList = Lists.newArrayList();\n\t\tfor (MenuVo menuVo : currentUserMenuVoList) {\n\t\t\tLong menuId = menuVo.getId();\n\n\t\t\tif (PublicUtil.isEmpty(menuId)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tcurrentUserMenuIdList.add(menuId);\n\t\t}\n\n\t\tPreconditions.checkArgument(currentUserMenuIdList.containsAll(menuIdList), \"参数异常\");\n\n\t\t// TODO 预留一个过滤已失效菜单的接口\n\t\tfor (Long menuId : menuIdList) {\n\t\t\tif (uacMenuService.checkMenuHasChildMenu(menuId)) {\n\t\t\t\tlogger.error(\" 选择菜单不是根目录 menuId= {}\", menuId);\n\t\t\t\tthrow new UacBizException(ErrorCodeEnum.UAC10013010, menuId);\n\t\t\t}\n\t\t\tUacUserMenu uacUserMenu = new UacUserMenu();\n\t\t\tuacUserMenu.setUserId(authResDto.getUserId());\n\t\t\tuacUserMenu.setMenuId(menuId);\n\t\t\tuacUserMenuList.add(uacUserMenu);\n\t\t}\n\t}\n\n\tprivate int handleUserMenuList(List<UacUserMenu> uacUserMenuList, UacUserMenu uacUserMenu) {\n\t\t// 如果存在记录则清空数据表\n\t\tdeleteUserMenuList(uacUserMenu);\n\n\t\treturn uacUserMenuService.batchSave(uacUserMenuList);\n\t}\n\n\tprivate void validateRegisterInfo(UserRegisterDto registerDto) {\n\t\tString mobileNo = registerDto.getMobileNo();\n","sourceCodeStart":911,"sourceCodeEnd":947,"githubUrl":"https://github.com/paascloud/paascloud-master/blob/781281a9503332ed3cef44ea618349d14230a127/paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacUserServiceImpl.java#L911-L947","documentation":"UAC10013010 is thrown while saving a user's chosen common menus: for each menuId in menuIdList, uacMenuService.checkMenuHasChildMenu(menuId) returns true, meaning the selected menu is a parent/directory node, not a leaf. Only leaf menu items may be added to a user's common-menu list, so the save aborts with 'menuId=...'.","triggerScenarios":"Client sends a menu tree's parent/directory IDs in the menuIdList; the frontend fails to filter out folder nodes before submitting; menu data changed so a previously-leaf menu gained children.","commonSituations":"Older frontend versions submitting full tree selections; menu reorganization turning a formerly selectable item into a directory; API consumers constructing menuIdList manually from the menu table.","solutions":["Filter out non-leaf menus on the client: only include menu IDs where checkMenuHasChildMenu(menuId) is false.","Have the server skip or reject parent nodes gracefully instead of failing the whole batch.","Refresh menu data on the client after any menu-structure change so stale leaf selections are dropped.","Wrap the save call in a handler for UacBizException(UAC10013010) and prompt the user to reselect menus."],"exampleFix":"// before\nList<Long> menuIdList = request.getMenuIdList();\nuacUserService.saveUserMenus(menuIdList);\n// after\nList<Long> leafIds = menuIdList.stream()\n    .filter(id -> !uacMenuService.checkMenuHasChildMenu(id))\n    .collect(Collectors.toList());\nuacUserService.saveUserMenus(leafIds);","handlingStrategy":"validation","validationCode":"List<Long> leafIds = menuIdList.stream()\n    .filter(id -> !uacMenuService.checkMenuHasChildMenu(id))\n    .collect(Collectors.toList());\nif (leafIds.size() != menuIdList.size()) {\n    return Result.fail(\"only leaf menus can be selected\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    uacUserService.saveUserMenus(menuIdList);\n} catch (UacBizException e) {\n    if (\"UAC10013010\".equals(e.getCode())) { return Result.fail(400, \"selected menu is a directory, reselect leaf items\"); }\n    throw e;\n}","preventionTips":["Filter directory nodes out on the client before submitting menuIdList.","Refresh menu metadata after any menu-structure change.","Validate menu IDs at API layer with a clear error listing the offending menuId.","Disable parent checkboxes in the menu-selection UI."],"tags":["menu","validation","invalid-argument"],"backgroundTag":"invalid-argument-value","analyzedSha":"781281a9503332ed3cef44ea618349d14230a127","analyzedAt":"2026-09-10T10:59:02.070Z","contentChangedAt":"2026-09-10T10:59:02.070Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}