paascloud/paascloud-master · error · UacBizException

UAC10013004

UAC10013004

Error message

启用菜单失败,menuId=%s

What it means

UacBizException UAC10013004 thrown by enableMenuList when a batch update that should set a menu's status to ENABLE affects 0 rows (mapper.updateByPrimaryKeySelective returned 0). Called from updateUacMenuStatusById when enabling a menu plus its child and parent menus. Message contains the offending menuId.

Solutions

  1. Re-fetch the menu tree and retry the status change; the missing sub-menu will drop out of the list.
  2. Check each menuId in the batch still exists (selectByPrimaryKey) before enabling.
  3. Coordinate with other admins to avoid concurrent delete/enable on the same subtree.
  4. If it persists, check uac_menu rows for the reported menuId — it was likely removed mid-transaction.

Example fix

// before: enable every collected menu unconditionally
for (UacMenu menu : menuList) {
  int result = mapper.updateByPrimaryKeySelective(uacMenuUpdate);
  if (result < 1) { throw new UacBizException(ErrorCodeEnum.UAC10013004, menu.getId()); }
}
// after: skip menus that vanished
for (UacMenu menu : menuList) {
  if (mapper.selectByPrimaryKey(menu.getId()) == null) { continue; }
  mapper.updateByPrimaryKeySelective(uacMenuUpdate);
}
Defensive patterns

Strategy: retry

Validate before calling

List<Long> missing = menuList.stream()
    .map(UacMenu::getId)
    .filter(mid -> uacMenuMapper.selectByPrimaryKey(mid) == null)
    .collect(Collectors.toList());
if (!missing.isEmpty()) { /* re-fetch tree and rebuild menuList */ }

Type guard

boolean allMenusExist(List<UacMenu> menus) {
  return menus.stream().allMatch(m -> uacMenuMapper.selectByPrimaryKey(m.getId()) != null);
}

Try / catch

try {
  uacMenuService.updateUacMenuStatusById(statusDto, loginAuthDto);
} catch (UacBizException e) {
  if ("UAC10013004".equals(e.getCode())) { /* re-fetch tree, retry once */ }
  throw e;
}

Prevention

When it happens

Trigger: Calling updateUacMenuStatusById with status=ENABLE where any menu in the computed menuList (target, children, parents) no longer exists or its selective update matches no row — most commonly a child menu deleted after the menu list was computed.

Common situations: Concurrent deletion of a child menu while an admin enables the parent; stale UI state listing menus that were already removed; the update payload's updateTime/version conflicting with concurrent edits.

Related errors


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

Appendix: source

Thrown at paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacMenuServiceImpl.java:224

		return result;
	}

	@Override
	public int enableMenuList(List<UacMenu> menuList, LoginAuthDto loginAuthDto) {
		UacMenu uacMenuUpdate = new UacMenu();
		int sum = 0;
		for (UacMenu menu : menuList) {
			uacMenuUpdate.setId(menu.getId());
			uacMenuUpdate.setVersion(menu.getVersion() + 1);
			uacMenuUpdate.setStatus(UacMenuStatusEnum.ENABLE.getType());
			uacMenuUpdate.setLastOperator(loginAuthDto.getLoginName());
			uacMenuUpdate.setLastOperatorId(loginAuthDto.getUserId());
			uacMenuUpdate.setUpdateTime(new Date());
			int result = mapper.updateByPrimaryKeySelective(uacMenuUpdate);
			if (result > 0) {
				sum += 1;
			} else {
				throw new UacBizException(ErrorCodeEnum.UAC10013004, menu.getId());
			}
		}
		return sum;
	}

	@Override
	@Transactional(readOnly = true, rollbackFor = Exception.class)
	public List<UacMenu> getAllParentMenuByMenuId(Long menuId) {
		UacMenu uacMenuQuery = new UacMenu();
		uacMenuQuery.setId(menuId);
		uacMenuQuery = mapper.selectOne(uacMenuQuery);
		List<UacMenu> uacMenuList = Lists.newArrayList();
		uacMenuList = buildParentNote(uacMenuList, uacMenuQuery);
		return uacMenuList;
	}

	@Override
	@Transactional(readOnly = true, rollbackFor = Exception.class)

View on GitHub (pinned to 781281a950)