paascloud/paascloud-master · error · UacBizException
UAC10015007
UAC10015007
Error message
该组织下还存在子节点,不能将其删除, Pid=%s
What it means
UAC10015007 ("该组织下还存在子节点,不能将其删除, Pid=%s") is thrown by deleteUacGroupById when the target group still has child organizations (uac_group rows with pid = id). Deleting would orphan the subtree, so it is refused.
Solutions
- Delete or move all child organizations first, then delete the parent
- Catch UacBizException UAC10015007 and show the child count / prompt to handle children first
- Use a cascade-delete API (if provided) that removes the subtree in order when that is the intent
Example fix
// before
uacGroupService.deleteUacGroupById(parentId);
// after
List<UacGroup> children = uacGroupService.getChildGroups(parentId); // or query pid = parentId
for (UacGroup child : children) {
uacGroupService.deleteUacGroupById(child.getId()); // delete leaves first
}
uacGroupService.deleteUacGroupById(parentId); Defensive patterns
Strategy: validation
Validate before calling
List<UacGroup> children = uacGroupMapper.select(new UacGroup().setPid(groupId));
if (!children.isEmpty()) { throw new IllegalStateException("Group has " + children.size() + " children; delete them first"); } Try / catch
try {
uacGroupService.deleteUacGroupById(groupId);
} catch (UacBizException e) {
if (ErrorCodeEnum.UAC10015007.getCode().equals(e.getCode())) { /* show child groups, offer cascade or move */ }
else throw e;
} Prevention
- Expand/load full subtrees in the UI before allowing delete
- Offer a 'delete subtree' flow that removes leaves first
- Audit imported data for unexpected hierarchy depth
When it happens
Trigger: Calling deleteUacGroupById(id) where uacGroupMapper.select(childGroup with pid=id) returns a non-empty child list.
Common situations: Deleting a parent department instead of the intended leaf; UI tree not expanding children so hidden sub-organizations exist; data imported with hierarchy the user is unaware of.
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
AI-assisted analysis of paascloud/paascloud-master@781281a950 (2026-09-10).
Data as JSON: /api/errors/1a95219562d81c4e.
Report an issue: GitHub.
Appendix: source
Thrown at paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacGroupServiceImpl.java:161
}
@Override
public int deleteUacGroupById(Long id) {
Preconditions.checkArgument(id != null, "组织id为空");
Preconditions.checkArgument(!Objects.equals(id, GlobalConstant.Sys.SUPER_MANAGER_GROUP_ID), "该组织不能删除");
// 根据前台传入的组织参数校验该组织是否存在
UacGroup uacGroup = uacGroupMapper.selectByPrimaryKey(id);
if (PublicUtil.isEmpty(uacGroup)) {
throw new UacBizException(ErrorCodeEnum.UAC10015004, id);
}
//判断该组织下是否存在子节点
UacGroup childGroup = new UacGroup();
childGroup.setPid(id);
List<UacGroup> childGroupList = uacGroupMapper.select(childGroup);
if (PublicUtil.isNotEmpty(childGroupList)) {
throw new UacBizException(ErrorCodeEnum.UAC10015007, id);
}
//判断该组织下是否存在用户
UacGroupUser uacGroupUser = new UacGroupUser();
uacGroupUser.setGroupId(id);
List<UacGroupUser> uacGroupUserList = uacGroupUserMapper.select(uacGroupUser);
if (PublicUtil.isNotEmpty(uacGroupUserList)) {
throw new UacBizException(ErrorCodeEnum.UAC10015008, id);
}
return mapper.deleteByPrimaryKey(id);
}
@Override
@Transactional(readOnly = true, rollbackFor = Exception.class)
public UacGroup queryById(Long groupId) {
Preconditions.checkArgument(PublicUtil.isNotEmpty(groupId), "组织Id不能为空");
UacGroup query = new UacGroup();
query.setId(groupId);View on GitHub (pinned to 781281a950)