paascloud/paascloud-master · error · UacBizException

UAC10012006

UAC10012006

Error message

ErrorCodeEnum.UAC10012006

What it means

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.

Solutions

  1. Re-check the role list (all IDs exist) before batch delete, or filter to existing IDs
  2. Make the operation idempotent client-side: on UAC10012006, refresh the list and retry with only remaining roles
  3. Consider accepting result <= size as success when deletes are idempotent, if you control the service code

Example fix

// before
uacRoleService.batchDeleteByIdList(ids);
// after
List<Long> existing = ids.stream()
    .filter(id -> uacRoleService.getRoleById(id) != null)
    .collect(Collectors.toList());
if (!existing.isEmpty()) { uacRoleService.batchDeleteByIdList(existing); }
Defensive patterns

Strategy: retry

Validate before calling

List<Long> existing = roleIdList.stream().filter(id -> uacRoleService.getRoleById(id) != null).collect(Collectors.toList());

Type guard

boolean allRolesExist = roleIdList.stream().allMatch(id -> uacRoleService.getRoleById(id) != null);

Try / catch

try { service.batchDeleteByIdList(ids); } catch (UacBizException e) { if ("UAC10012006".equals(e.getCode())) { refreshList(); /* retry with remaining ids */ } else { throw e; } }

Prevention

When it happens

Trigger: 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.

Common situations: Double-click/double-submit deleting roles on the first request; another admin deleting the same roles concurrently; stale grid rows for already-deleted roles.

Related errors


AI-assisted analysis of paascloud/paascloud-master@781281a950 (2026-09-10). Data as JSON: /api/errors/132f081d9d0cc9ac. Report an issue: GitHub.

Appendix: source

Thrown at paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacRoleServiceImpl.java:328

		return menuVoList;
	}

	@Override
	public void batchDeleteByIdList(List<Long> roleIdList) {
		logger.info("批量删除角色. idList={}", roleIdList);
		Preconditions.checkArgument(PublicUtil.isNotEmpty(roleIdList), "删除角色ID不存在");

		List<UacRoleUser> uruList = uacRoleUserService.listByRoleIdList(roleIdList);
		if (!uruList.isEmpty()) {
			uacRoleUserService.deleteByRoleIdList(roleIdList);
		}

		uacRoleMenuService.deleteByRoleIdList(roleIdList);
		uacRoleActionService.deleteByRoleIdList(roleIdList);

		int result = uacRoleMapper.batchDeleteByIdList(roleIdList);
		if (result < roleIdList.size()) {
			throw new UacBizException(ErrorCodeEnum.UAC10012006, Joiner.on(GlobalConstant.Symbol.COMMA).join(roleIdList));
		}
	}

	@Override
	@Transactional(readOnly = true, rollbackFor = Exception.class)
	public List<MenuVo> getOwnAuthTree(Long userId) {
		if (userId == null) {
			throw new UacBizException(ErrorCodeEnum.UAC10011001);
		}

		return uacMenuService.getMenuVoList(userId, GlobalConstant.Sys.OPER_APPLICATION_ID);
	}

	@Override
	public void bindMenu(RoleBindMenuDto roleBindMenuDto) {

		Long roleId = roleBindMenuDto.getRoleId();
		Set<Long> menuIdList = roleBindMenuDto.getMenuIdList();

View on GitHub (pinned to 781281a950)