paascloud/paascloud-master · error · UacBizException
UAC10012007
UAC10012007
Error message
ErrorCodeEnum.UAC10012007
What it means
UacBizException with code UAC10012007 (role-user binding batch delete failed) thrown by deleteByRoleIdList when the number of deleted rows is less than the size of the given roleIdList. The service treats a partial delete as a failure and reports the affected role ids in the message.
Solutions
- Verify each roleId in the list has at least one role-user binding before batch deletion, or only delete ids known to have bindings.
- Make deletion idempotent in the caller: treat 'already deleted' as success and retry without the missing ids.
- Catch UacBizException, parse the reported role ids, and remove only those still present.
Example fix
// before
uacRoleUserService.deleteByRoleIdList(roleIdList);
// after
List<Long> existing = filterRolesWithBindings(roleIdList);
if (PublicUtil.isNotEmpty(existing)) {
uacRoleUserService.deleteByRoleIdList(existing);
} Defensive patterns
Strategy: try-catch
Validate before calling
List<Long> existing = roleIdList.stream()
.filter(id -> PublicUtil.isNotEmpty(uacRoleUserService.listByRoleId(id)))
.collect(Collectors.toList());
if (PublicUtil.isNotEmpty(existing)) { uacRoleUserService.deleteByRoleIdList(existing); } Type guard
boolean deletable = roleIdList != null && !roleIdList.isEmpty() && !roleIdList.contains(GlobalConstant.Sys.SUPER_MANAGER_ROLE_ID);
Try / catch
try {
uacRoleUserService.deleteByRoleIdList(roleIdList);
} catch (UacBizException e) {
if ("UAC10012007".equals(e.getCode())) { log.warn("partial delete: {}", e.getMessage()); return; }
throw e;
} Prevention
- Design delete flows to be idempotent
- Check bindings exist before batch deletes
- Exclude role ids without bindings from the batch
When it happens
Trigger: deleteByRoleIdList(roleIdList) where one or more role ids in the list have no role-user rows (rows already deleted, or ids referencing non-existent roles), so uacRoleUserMapper.deleteByRoleIdList returns fewer rows than roleIdList.size().
Common situations: Re-running a delete after a partially completed previous attempt; list contains role ids that never had users assigned; concurrent transactions removed some bindings first.
Related errors
AI-assisted analysis of paascloud/paascloud-master@781281a950 (2026-09-10).
Data as JSON: /api/errors/f7946aeaa18751d3.
Report an issue: GitHub.
Appendix: source
Thrown at paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacRoleUserServiceImpl.java:136
}
@Override
@Transactional(readOnly = true, rollbackFor = Exception.class)
public List<UacRoleUser> listByUserId(Long userId) {
if (userId == null) {
throw new UacBizException(ErrorCodeEnum.UAC10011001);
}
return uacRoleUserMapper.listByUserId(userId);
}
@Override
public void deleteByRoleIdList(List<Long> roleIdList) {
Preconditions.checkArgument(PublicUtil.isNotEmpty(roleIdList), ErrorCodeEnum.UAC10012001.msg());
Preconditions.checkArgument(!roleIdList.contains(GlobalConstant.Sys.SUPER_MANAGER_ROLE_ID), "超级管理员角色不能删除");
int result = uacRoleUserMapper.deleteByRoleIdList(roleIdList);
if (result < roleIdList.size()) {
throw new UacBizException(ErrorCodeEnum.UAC10012007, Joiner.on(GlobalConstant.Symbol.COMMA).join(roleIdList));
}
}
@Override
public void deleteByRoleId(Long roleId) {
Preconditions.checkArgument(roleId != null, ErrorCodeEnum.UAC10012001.msg());
Preconditions.checkArgument(!Objects.equals(roleId, GlobalConstant.Sys.SUPER_MANAGER_ROLE_ID), "超级管理员角色不能删除");
int result = uacRoleUserMapper.deleteByRoleId(roleId);
if (result < 1) {
throw new UacBizException(ErrorCodeEnum.UAC10012006, roleId);
}
}
}
View on GitHub (pinned to 781281a950)