{"record":{"id":"132f081d9d0cc9ac","repo":"paascloud/paascloud-master","slug":"uac10012006","errorCode":"UAC10012006","errorMessage":"ErrorCodeEnum.UAC10012006","messagePattern":"ErrorCodeEnum\\.UAC10012006","errorType":"error_code","errorClass":"UacBizException","httpStatus":null,"severity":"error","filePath":"paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacRoleServiceImpl.java","lineNumber":328,"sourceCode":"\t\treturn menuVoList;\n\t}\n\n\t@Override\n\tpublic void batchDeleteByIdList(List<Long> roleIdList) {\n\t\tlogger.info(\"批量删除角色. idList={}\", roleIdList);\n\t\tPreconditions.checkArgument(PublicUtil.isNotEmpty(roleIdList), \"删除角色ID不存在\");\n\n\t\tList<UacRoleUser> uruList = uacRoleUserService.listByRoleIdList(roleIdList);\n\t\tif (!uruList.isEmpty()) {\n\t\t\tuacRoleUserService.deleteByRoleIdList(roleIdList);\n\t\t}\n\n\t\tuacRoleMenuService.deleteByRoleIdList(roleIdList);\n\t\tuacRoleActionService.deleteByRoleIdList(roleIdList);\n\n\t\tint result = uacRoleMapper.batchDeleteByIdList(roleIdList);\n\t\tif (result < roleIdList.size()) {\n\t\t\tthrow new UacBizException(ErrorCodeEnum.UAC10012006, Joiner.on(GlobalConstant.Symbol.COMMA).join(roleIdList));\n\t\t}\n\t}\n\n\t@Override\n\t@Transactional(readOnly = true, rollbackFor = Exception.class)\n\tpublic List<MenuVo> getOwnAuthTree(Long userId) {\n\t\tif (userId == null) {\n\t\t\tthrow new UacBizException(ErrorCodeEnum.UAC10011001);\n\t\t}\n\n\t\treturn uacMenuService.getMenuVoList(userId, GlobalConstant.Sys.OPER_APPLICATION_ID);\n\t}\n\n\t@Override\n\tpublic void bindMenu(RoleBindMenuDto roleBindMenuDto) {\n\n\t\tLong roleId = roleBindMenuDto.getRoleId();\n\t\tSet<Long> menuIdList = roleBindMenuDto.getMenuIdList();","sourceCodeStart":310,"sourceCodeEnd":346,"githubUrl":"https://github.com/paascloud/paascloud-master/blob/781281a9503332ed3cef44ea618349d14230a127/paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacRoleServiceImpl.java#L310-L346","documentation":"batchDeleteByIdList throws UacBizException UAC10012006 when the number of rows deleted by uacRoleMapper.batchDeleteByIdList is less than roleIdList.size(), i.e. some roles in the list were not deleted (already gone or concurrent modification). The joined role IDs are passed into the message.","triggerScenarios":"Batch-deleting roles where one or more IDs no longer exist in uac_role, so the affected-row count falls short of the request size.","commonSituations":"Double-click/double-submit deleting roles on the first request; another admin deleting the same roles concurrently; stale grid rows for already-deleted roles.","solutions":["Re-check the role list (all IDs exist) before batch delete, or filter to existing IDs","Make the operation idempotent client-side: on UAC10012006, refresh the list and retry with only remaining roles","Consider accepting result <= size as success when deletes are idempotent, if you control the service code"],"exampleFix":"// before\nuacRoleService.batchDeleteByIdList(ids);\n// after\nList<Long> existing = ids.stream()\n    .filter(id -> uacRoleService.getRoleById(id) != null)\n    .collect(Collectors.toList());\nif (!existing.isEmpty()) { uacRoleService.batchDeleteByIdList(existing); }","handlingStrategy":"retry","validationCode":"List<Long> existing = roleIdList.stream().filter(id -> uacRoleService.getRoleById(id) != null).collect(Collectors.toList());","typeGuard":"boolean allRolesExist = roleIdList.stream().allMatch(id -> uacRoleService.getRoleById(id) != null);","tryCatchPattern":"try { service.batchDeleteByIdList(ids); } catch (UacBizException e) { if (\"UAC10012006\".equals(e.getCode())) { refreshList(); /* retry with remaining ids */ } else { throw e; } }","preventionTips":["Disable the delete button after first click to avoid double submits","Refresh the grid after deletions so stale rows disappear","Treat partial deletes idempotently when you control the service"],"tags":["database-write-failed","java","batch-delete"],"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"}