{"record":{"id":"70224ab7a1772aa7","repo":"paascloud/paascloud-master","slug":"uac10013004","errorCode":"UAC10013004","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":224,"sourceCode":"\t\treturn result;\n\t}\n\n\t@Override\n\tpublic int enableMenuList(List<UacMenu> menuList, LoginAuthDto loginAuthDto) {\n\t\tUacMenu uacMenuUpdate = new UacMenu();\n\t\tint sum = 0;\n\t\tfor (UacMenu menu : menuList) {\n\t\t\tuacMenuUpdate.setId(menu.getId());\n\t\t\tuacMenuUpdate.setVersion(menu.getVersion() + 1);\n\t\t\tuacMenuUpdate.setStatus(UacMenuStatusEnum.ENABLE.getType());\n\t\t\tuacMenuUpdate.setLastOperator(loginAuthDto.getLoginName());\n\t\t\tuacMenuUpdate.setLastOperatorId(loginAuthDto.getUserId());\n\t\t\tuacMenuUpdate.setUpdateTime(new Date());\n\t\t\tint result = mapper.updateByPrimaryKeySelective(uacMenuUpdate);\n\t\t\tif (result > 0) {\n\t\t\t\tsum += 1;\n\t\t\t} else {\n\t\t\t\tthrow new UacBizException(ErrorCodeEnum.UAC10013004, menu.getId());\n\t\t\t}\n\t\t}\n\t\treturn sum;\n\t}\n\n\t@Override\n\t@Transactional(readOnly = true, rollbackFor = Exception.class)\n\tpublic List<UacMenu> getAllParentMenuByMenuId(Long menuId) {\n\t\tUacMenu uacMenuQuery = new UacMenu();\n\t\tuacMenuQuery.setId(menuId);\n\t\tuacMenuQuery = mapper.selectOne(uacMenuQuery);\n\t\tList<UacMenu> uacMenuList = Lists.newArrayList();\n\t\tuacMenuList = buildParentNote(uacMenuList, uacMenuQuery);\n\t\treturn uacMenuList;\n\t}\n\n\t@Override\n\t@Transactional(readOnly = true, rollbackFor = Exception.class)","sourceCodeStart":206,"sourceCodeEnd":242,"githubUrl":"https://github.com/paascloud/paascloud-master/blob/781281a9503332ed3cef44ea618349d14230a127/paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacMenuServiceImpl.java#L206-L242","documentation":"UacBizException UAC10013004 thrown by enableMenuList when a batch update that should set a menu's status to ENABLE affects 0 rows (mapper.updateByPrimaryKeySelective returned 0). Called from updateUacMenuStatusById when enabling a menu plus its child and parent menus. Message contains the offending menuId.","triggerScenarios":"Calling updateUacMenuStatusById with status=ENABLE where any menu in the computed menuList (target, children, parents) no longer exists or its selective update matches no row — most commonly a child menu deleted after the menu list was computed.","commonSituations":"Concurrent deletion of a child menu while an admin enables the parent; stale UI state listing menus that were already removed; the update payload's updateTime/version conflicting with concurrent edits.","solutions":["Re-fetch the menu tree and retry the status change; the missing sub-menu will drop out of the list.","Check each menuId in the batch still exists (selectByPrimaryKey) before enabling.","Coordinate with other admins to avoid concurrent delete/enable on the same subtree.","If it persists, check uac_menu rows for the reported menuId — it was likely removed mid-transaction."],"exampleFix":"// before: enable every collected menu unconditionally\nfor (UacMenu menu : menuList) {\n  int result = mapper.updateByPrimaryKeySelective(uacMenuUpdate);\n  if (result < 1) { throw new UacBizException(ErrorCodeEnum.UAC10013004, menu.getId()); }\n}\n// after: skip menus that vanished\nfor (UacMenu menu : menuList) {\n  if (mapper.selectByPrimaryKey(menu.getId()) == null) { continue; }\n  mapper.updateByPrimaryKeySelective(uacMenuUpdate);\n}","handlingStrategy":"retry","validationCode":"List<Long> missing = menuList.stream()\n    .map(UacMenu::getId)\n    .filter(mid -> uacMenuMapper.selectByPrimaryKey(mid) == null)\n    .collect(Collectors.toList());\nif (!missing.isEmpty()) { /* re-fetch tree and rebuild menuList */ }","typeGuard":"boolean allMenusExist(List<UacMenu> menus) {\n  return menus.stream().allMatch(m -> uacMenuMapper.selectByPrimaryKey(m.getId()) != null);\n}","tryCatchPattern":"try {\n  uacMenuService.updateUacMenuStatusById(statusDto, loginAuthDto);\n} catch (UacBizException e) {\n  if (\"UAC10013004\".equals(e.getCode())) { /* re-fetch tree, retry once */ }\n  throw e;\n}","preventionTips":["Rebuild the menu list from the DB immediately before a status update.","Avoid running deletes and status changes on the same subtree concurrently.","Refresh the admin UI tree before batch operations."],"tags":["database","menu-management","uac","enable","batch-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"}