{"record":{"id":"d3705076fe4f6415","repo":"paascloud/paascloud-master","slug":"uac10014003","errorCode":"UAC10014003","errorMessage":"UAC10014003","messagePattern":"UAC10014003","errorType":"error_code","errorClass":"UacBizException","httpStatus":null,"severity":"error","filePath":"paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacActionServiceImpl.java","lineNumber":106,"sourceCode":"\t\t}\n\t}\n\n\t@Override\n\tpublic void saveAction(UacAction action, LoginAuthDto loginAuthDto) {\n\t\tList<Long> menuIdList = action.getMenuIdList();\n\t\tLong menuId;\n\t\tPreconditions.checkArgument(PublicUtil.isNotEmpty(menuIdList), \"菜单名称不能为空\");\n\t\tmenuId = menuIdList.get(menuIdList.size() - 1);\n\t\taction.setMenuId(menuId);\n\t\taction.setUpdateInfo(loginAuthDto);\n\t\tif (action.isNew()) {\n\t\t\tLong actionId = super.generateId();\n\t\t\taction.setId(actionId);\n\t\t\tuacActionMapper.insertSelective(action);\n\t\t} else {\n\t\t\tint result = uacActionMapper.updateByPrimaryKeySelective(action);\n\t\t\tif (result < 1) {\n\t\t\t\tthrow new UacBizException(ErrorCodeEnum.UAC10014003);\n\t\t\t}\n\t\t}\n\t}\n\n\t@Override\n\tpublic int deleteByMenuId(Long id) {\n\t\tPreconditions.checkArgument(id != null, \"菜单ID不能为空\");\n\n\t\treturn uacActionMapper.deleteByMenuId(id);\n\t}\n\n\t@Override\n\t@Transactional(readOnly = true, rollbackFor = Exception.class)\n\tpublic List<Long> getCheckedActionList(Long roleId) {\n\t\tif (roleId == null) {\n\t\t\tthrow new UacBizException(ErrorCodeEnum.UAC10012001);\n\t\t}\n\t\treturn uacActionMapper.getCheckedActionList(roleId);","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/paascloud/paascloud-master/blob/781281a9503332ed3cef44ea618349d14230a127/paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacActionServiceImpl.java#L88-L124","documentation":"UAC10014003 is thrown by saveAction when updating an existing action (updateByPrimaryKeySelective) affects zero rows. It means the update targeted an action id that does not exist or was concurrently deleted.","triggerScenarios":"saveAction(action, loginAuthDto) with action.id non-null but not present in uac_action; optimistic-concurrency style failure where the row vanished before the update.","commonSituations":"User edits a permission row in a stale browser tab after another admin deleted it; wrong environment DB; client sent a bogus id with the update payload.","solutions":["Verify action.id exists before updating; treat 0-updated-rows as record-not-found on the client","Refresh the permission list and re-apply the edit with a valid id","Consider falling back to insert when the row is missing if that matches business intent"],"exampleFix":"// before\nint result = uacActionMapper.updateByPrimaryKeySelective(action);\nif (result < 1) {\n    throw new UacBizException(ErrorCodeEnum.UAC10014003);\n}\n// after\nif (uacActionMapper.selectByPrimaryKey(action.getId()) == null) {\n    throw new UacBizException(ErrorCodeEnum.UAC10014001, action.getId());\n}\nuacActionMapper.updateByPrimaryKeySelective(action);","handlingStrategy":"validation","validationCode":"if (action.getId() != null && uacActionMapper.selectByPrimaryKey(action.getId()) == null) { treat as not found; }","typeGuard":"null","tryCatchPattern":"try { service.saveAction(action, loginAuthDto); } catch (UacBizException e) { if (\"UAC10014003\".equals(e.getCode())) { alertStaleRecord(); } }","preventionTips":["Detect stale edits and prompt the user to reload","Include a version/updatedAt check for concurrent edits","Verify ids against the correct environment"],"tags":["update","entity-not-found","stale-data"],"backgroundTag":"record-not-found","analyzedSha":"781281a9503332ed3cef44ea618349d14230a127","analyzedAt":"2026-09-10T10:59:02.070Z","contentChangedAt":"2026-09-10T10:59:02.070Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}