{"record":{"id":"8528927deb3e881f","repo":"paascloud/paascloud-master","slug":"uac10015008","errorCode":"UAC10015008","errorMessage":"该组织下绑定的用户，不能将其删除, groupId=%s","messagePattern":"该组织下绑定的用户，不能将其删除, groupId=(.+?)","errorType":"error_code","errorClass":"UacBizException","httpStatus":null,"severity":"error","filePath":"paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacGroupServiceImpl.java","lineNumber":168,"sourceCode":"\n\t\t// 根据前台传入的组织参数校验该组织是否存在\n\t\tUacGroup uacGroup = uacGroupMapper.selectByPrimaryKey(id);\n\t\tif (PublicUtil.isEmpty(uacGroup)) {\n\t\t\tthrow new UacBizException(ErrorCodeEnum.UAC10015004, id);\n\t\t}\n\t\t//判断该组织下是否存在子节点\n\t\tUacGroup childGroup = new UacGroup();\n\t\tchildGroup.setPid(id);\n\t\tList<UacGroup> childGroupList = uacGroupMapper.select(childGroup);\n\t\tif (PublicUtil.isNotEmpty(childGroupList)) {\n\t\t\tthrow new UacBizException(ErrorCodeEnum.UAC10015007, id);\n\t\t}\n\t\t//判断该组织下是否存在用户\n\t\tUacGroupUser uacGroupUser = new UacGroupUser();\n\t\tuacGroupUser.setGroupId(id);\n\t\tList<UacGroupUser> uacGroupUserList = uacGroupUserMapper.select(uacGroupUser);\n\t\tif (PublicUtil.isNotEmpty(uacGroupUserList)) {\n\t\t\tthrow new UacBizException(ErrorCodeEnum.UAC10015008, id);\n\t\t}\n\n\t\treturn mapper.deleteByPrimaryKey(id);\n\t}\n\n\t@Override\n\t@Transactional(readOnly = true, rollbackFor = Exception.class)\n\tpublic UacGroup queryById(Long groupId) {\n\t\tPreconditions.checkArgument(PublicUtil.isNotEmpty(groupId), \"组织Id不能为空\");\n\t\tUacGroup query = new UacGroup();\n\t\tquery.setId(groupId);\n\t\treturn uacGroupMapper.selectOne(query);\n\t}\n\n\t@Override\n\t@Transactional(readOnly = true, rollbackFor = Exception.class)\n\tpublic List<GroupZtreeVo> getGroupTree(Long groupId) {\n\t\t// 1. 如果是仓库则 直接把仓库信息封装成ztreeVo返回","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/paascloud/paascloud-master/blob/781281a9503332ed3cef44ea618349d14230a127/paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacGroupServiceImpl.java#L150-L186","documentation":"UAC10015008 (\"该组织下绑定的用户，不能将其删除, groupId=%s\") is thrown by deleteUacGroupById when users are still bound to the group (rows in uac_group_user with groupId = id). The delete is blocked to avoid breaking user-group memberships.","triggerScenarios":"Calling deleteUacGroupById(id) where uacGroupUserMapper.select(uacGroupUser with groupId=id) returns a non-empty user binding list.","commonSituations":"Retiring a department that still has members; users were auto-assigned to the group by onboarding flows; bindings left behind after users were nominally transferred but group_user rows not cleaned.","solutions":["Unbind all users from the group first (delete uac_group_user rows or call the unbind-user API), then delete the group","Reassign users to another group before deleting the old one","Catch UacBizException UAC10015008 and show the affected user count in the UI before forcing unbind"],"exampleFix":"// before\nuacGroupService.deleteUacGroupById(groupId);\n// after\nList<UacGroupUser> bindings = uacGroupUserService.listByGroupId(groupId);\nfor (UacGroupUser bu : bindings) {\n    uacGroupUserService.delete(bu); // unbind users first\n}\nuacGroupService.deleteUacGroupById(groupId);","handlingStrategy":"validation","validationCode":"List<UacGroupUser> bindings = uacGroupUserMapper.select(new UacGroupUser().setGroupId(groupId));\nif (!bindings.isEmpty()) { throw new IllegalStateException(\"Unbind \" + bindings.size() + \" users first\"); }","typeGuard":null,"tryCatchPattern":"try {\n    uacGroupService.deleteUacGroupById(groupId);\n} catch (UacBizException e) {\n    if (ErrorCodeEnum.UAC10015008.getCode().equals(e.getCode())) { /* offer to unbind/reassign users, then retry */ }\n    else throw e;\n}","preventionTips":["Unbind or reassign users before group deletion","Clean up uac_group_user rows during user transfers","Show bound-user counts on the delete confirmation dialog"],"tags":["organization","user-binding","delete","referential-integrity"],"backgroundTag":"invalid-state-transition","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"}