{"record":{"id":"dc6b0f26a15cff1f","repo":"paascloud/paascloud-master","slug":"uac10013006","errorCode":"UAC10013006","errorMessage":"更新菜单状态失败,menuId=%s","messagePattern":"更新菜单状态失败,menuId=(.+?)","errorType":"error_code","errorClass":"UacBizException","httpStatus":null,"severity":"error","filePath":"paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacMenuServiceImpl.java","lineNumber":365,"sourceCode":"\t\t\t// 获取菜单、其子菜单以及父菜单\n\t\t\tUacMenu uacMenu = new UacMenu();\n\t\t\tuacMenu.setPid(id);\n\t\t\tresult = this.selectCount(uacMenu);\n\t\t\t// 此菜单含有子菜单\n\t\t\tif (result > 0) {\n\t\t\t\tmenuList = this.getAllChildMenuByMenuId(id, UacMenuStatusEnum.DISABLE.getType());\n\t\t\t}\n\t\t\tList<UacMenu> menuListTemp = this.getAllParentMenuByMenuId(id);\n\t\t\tfor (UacMenu menu : menuListTemp) {\n\t\t\t\tif (!menuList.contains(menu)) {\n\t\t\t\t\tmenuList.add(menu);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// 启用菜单、其子菜单以及父菜单\n\t\t\tresult = this.enableMenuList(menuList, loginAuthDto);\n\t\t}\n\t\tif (result < 1) {\n\t\t\tthrow new UacBizException(ErrorCodeEnum.UAC10013006, id);\n\t\t}\n\t}\n\n\t@Override\n\t@Transactional(readOnly = true, rollbackFor = Exception.class)\n\tpublic boolean checkMenuHasChildMenu(Long pid) {\n\t\tPreconditions.checkArgument(pid != null, \"菜单pid不能为空\");\n\n\t\tUacMenu uacMenu = new UacMenu();\n\t\tuacMenu.setStatus(UacMenuStatusEnum.ENABLE.getType());\n\t\tuacMenu.setPid(pid);\n\n\t\treturn mapper.selectCount(uacMenu) > 0;\n\t}\n\n\t@Override\n\tpublic List<UacMenu> listMenuListByRoleId(Long roleId) {\n\t\tList<UacMenu> menuList = uacMenuMapper.listMenuListByRoleId(roleId);","sourceCodeStart":347,"sourceCodeEnd":383,"githubUrl":"https://github.com/paascloud/paascloud-master/blob/781281a9503332ed3cef44ea618349d14230a127/paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacMenuServiceImpl.java#L347-L383","documentation":"UacBizException UAC10013006 thrown by updateUacMenuStatusById when neither the disable nor enable batch path updates at least one row (result < 1). The method dispatches to disableMenuList or enableMenuList for the target menu with its children/parents and throws this generic 'update menu status failed' error if nothing was updated. Message contains the requested menuId.","triggerScenarios":"Calling updateUacMenuStatusById(id, status) where every update in the batch matched 0 rows — typically because the target menu and all its related menus were deleted between selectByKey and the batch update, or the status value produced an empty menuList.","commonSituations":"Concurrent deletion wiping the subtree during the status change; a status string that is neither ENABLE nor DISABLE leaving menuList empty; stale UI performing the update on already-removed menus.","solutions":["Re-fetch the menu and retry the status change; if it no longer exists, treat as a no-op.","Verify the status value is exactly UacMenuStatusEnum.ENABLE.getType() or DISABLE.getType() — anything else yields an empty batch.","Check the target menuId still exists via selectByKey before updating status.","Inspect DB transaction logs for conflicting concurrent updates on the same rows."],"exampleFix":"// before: assume a valid status populates menuList\nuacMenuService.updateUacMenuStatusById(id, statusDto.getStatus());\n// after: validate status first\nString status = statusDto.getStatus();\nif (!UacMenuStatusEnum.ENABLE.getType().equals(status)\n    && !UacMenuStatusEnum.DISABLE.getType().equals(status)) {\n  throw new IllegalArgumentException(\"invalid status: \" + status);\n}\nuacMenuService.updateUacMenuStatusById(id, status);","handlingStrategy":"validation","validationCode":"String status = statusDto.getStatus();\nif (!UacMenuStatusEnum.ENABLE.getType().equals(status)\n    && !UacMenuStatusEnum.DISABLE.getType().equals(status)) {\n  throw new IllegalArgumentException(\"invalid status: \" + status);\n}\nif (uacMenuService.selectByKey(statusDto.getId()) == null) {\n  // menu gone; no-op\n}","typeGuard":"boolean isValidMenuStatus(String s) {\n  return UacMenuStatusEnum.ENABLE.getType().equals(s) || UacMenuStatusEnum.DISABLE.getType().equals(s);\n}","tryCatchPattern":"try {\n  uacMenuService.updateUacMenuStatusById(statusDto, loginAuthDto);\n} catch (UacBizException e) {\n  if (\"UAC10013006\".equals(e.getCode())) { /* re-fetch and retry once */ }\n  throw e;\n}","preventionTips":["Only send status values from UacMenuStatusEnum; never raw strings from the client.","Verify the target menu exists before a status update.","Refresh the tree after concurrent deletes before updating status."],"tags":["database","menu-management","uac","status-update"],"backgroundTag":"database-write-failed","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"}