paascloud/paascloud-master · error · UacBizException

UAC10011033

UAC10011033

Error message

清空该用户常用菜单失败

What it means

UAC10011033 is thrown by the user-menu clearing logic when uacUserMenuMapper.delete(uacUserMenu) deletes fewer rows (delCount) than were previously selected (selCount). Since delete() removes all rows matching the criteria in one statement, delCount < selCount signals an internal inconsistency (rows vanished/changed between select and delete), so the method aborts with '清空该用户常用菜单失败'.

Solutions

  1. Investigate the select vs delete criteria mismatch — ensure the delete template matches exactly the rows counted by selCount.
  2. Retry the whole select+delete operation under a transaction to eliminate the race window.
  3. If partial deletes are acceptable in your flow, replace the strict delCount < selCount check with a logged warning.
  4. Catch UacBizException(UAC10011033) and inform the user their menu save failed so they can retry.

Example fix

// before
int delCount = uacUserMenuMapper.delete(uacUserMenu);
if (delCount < selCount) { throw new UacBizException(ErrorCodeEnum.UAC10011033); }
// after
@Transactional
public int clearUserMenu(Long userId) {
    int selCount = countByUserId(userId);
    int delCount = uacUserMenuMapper.deleteByUserId(userId);
    if (delCount != selCount) { throw new UacBizException(ErrorCodeEnum.UAC10011033); }
    return delCount;
}
Defensive patterns

Strategy: retry

Validate before calling

int selCount = uacUserMenuMapper.selectCount(template);
if (selCount == 0) { return 0; } // nothing to clear, skip delete

Try / catch

try {
    int n = uacUserService.modifyUserMenus(...);
} catch (UacBizException e) {
    if ("UAC10011033".equals(e.getCode())) { return Result.fail(409, "menu update conflict, please retry"); }
    throw e;
}

Prevention

When it happens

Trigger: Concurrent modification of the user's menu rows between the select counting them and the delete; the delete's WHERE criteria not matching all selected rows (e.g. partial key in the uacUserMenu template); DB errors silently reducing affected rows.

Common situations: Two tabs/requests re-saving the user's common menus at the same time; batch jobs deleting menus while a user saves preferences; logic bugs where the delete condition uses only userId while the select filtered by userId+something else.

Related errors


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

Appendix: source

Thrown at paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacUserServiceImpl.java:897

		if (count < 1) {
			throw new UacBizException(ErrorCodeEnum.UAC10011032, loginName, email);
		}
	}

	/**
	 * 删除用户菜单表
	 */
	private int deleteUserMenuList(UacUserMenu uacUserMenu) {
		int selCount = uacUserMenuMapper.selectCount(uacUserMenu);
		// 如果查询结果为空, 默认认为已删除成功
		if (selCount < 1) {
			return 1;
		}

		int delCount = uacUserMenuMapper.delete(uacUserMenu);
		if (delCount < selCount) {
			logger.error("清空该用户常用菜单失败 delCount = {} selCount = {}", delCount, selCount);
			throw new UacBizException(ErrorCodeEnum.UAC10011033);
		}

		return delCount;
	}

	/**
	 * 校验数据是否合法
	 *
	 * @param menuIdList      需要操作的菜单Id集合
	 * @param authResDto      登录用户
	 * @param uacUserMenuList 需要插入的记录
	 */
	private void checkUserMenuList(List<Long> menuIdList, LoginAuthDto authResDto, List<UacUserMenu> uacUserMenuList) {

		List<MenuVo> currentUserMenuVoList = uacMenuService.findAllMenuListByAuthResDto(authResDto);
		List<Long> currentUserMenuIdList = Lists.newArrayList();
		for (MenuVo menuVo : currentUserMenuVoList) {
			Long menuId = menuVo.getId();

View on GitHub (pinned to 781281a950)