paascloud/paascloud-master · error · UacBizException

UAC10011011

UAC10011011

Error message

ErrorCodeEnum.UAC10011011

What it means

UacBizException with ErrorCodeEnum.UAC10011011 ("用户不存在, userId=%") is thrown by UacUserServiceImpl.modifyUserStatusById when uacUserMapper.selectByPrimaryKey(userId) returns null — the target user id does not correspond to any row in uac_user.

Solutions

  1. Verify the userId exists (selectByPrimaryKey or the user-detail API) before calling modifyUserStatusById
  2. Refresh the user list on the client after delete operations to avoid stale ids
  3. Check whether the user is soft-deleted (logic delete flag) and use the tool's undelete path if needed
  4. Catch UacBizException code 10011011 and show 'user not found, list may be outdated — please refresh'

Example fix

// before
UacUser target = new UacUser();
target.setId(request.getUserId());
target.setStatus(status);
uacUserService.modifyUserStatusById(target, authResDto);
// after
if (uacUserMapper.selectByPrimaryKey(request.getUserId()) != null) {
    UacUser target = new UacUser();
    target.setId(request.getUserId());
    target.setStatus(status);
    uacUserService.modifyUserStatusById(target, authResDto);
}
Defensive patterns

Strategy: validation

Validate before calling

UacUser u = uacUserMapper.selectByPrimaryKey(userId);
if (u == null) {
    throw new BusinessException("user not found: " + userId);
}

Type guard

UacUser u = uacUserMapper.selectByPrimaryKey(userId);
if (u != null) {
    uacUserService.modifyUserStatusById(uacUser, authResDto);
}

Try / catch

try {
    uacUserService.modifyUserStatusById(uacUser, authResDto);
} catch (UacBizException e) {
    if (e.getCode() == 10011011) { /* refresh list, report user not found */ }
    else throw e;
}

Prevention

When it happens

Trigger: Calling modifyUserStatusById with a UacUser whose id references a deleted or never-existing user, or an id from another data source/environment.

Common situations: Stale frontend list where the row was deleted by another admin; hard-coded or copied userId in a script/test; cross-environment data (test id used against prod DB); soft-deleted user filtered out by a logic-delete plugin.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


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

Appendix: source

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

	@Override
	@Transactional(readOnly = true, rollbackFor = Exception.class)
	public List<UacLog> queryUserLogListWithUserId(Long userId) {
		if (PublicUtil.isEmpty(userId)) {
			throw new UacBizException(ErrorCodeEnum.UAC10011001);
		}
		return uacLogService.selectUserLogListByUserId(userId);
	}

	@Override
	public int modifyUserStatusById(UacUser uacUser, LoginAuthDto authResDto) {
		Long loginUserId = authResDto.getUserId();
		Long userId = uacUser.getId();
		if (loginUserId.equals(userId)) {
			throw new UacBizException(ErrorCodeEnum.UAC10011023);
		}
		UacUser u = uacUserMapper.selectByPrimaryKey(userId);
		if (u == null) {
			throw new UacBizException(ErrorCodeEnum.UAC10011011, userId);
		}

		// 更新用户最后修改人与修改时间
		uacUser.setVersion(u.getVersion() + 1);
		uacUser.setUpdateInfo(authResDto);
		return uacUserMapper.updateByPrimaryKeySelective(uacUser);
	}

	@Override
	public void bindUserRoles(BindUserRolesDto bindUserRolesDto, LoginAuthDto authResDto) {

		if (bindUserRolesDto == null) {
			logger.error("参数不能为空");
			throw new IllegalArgumentException("参数不能为空");
		}

		Long operUserId = bindUserRolesDto.getUserId();
		Long loginUserId = authResDto.getUserId();

View on GitHub (pinned to 781281a950)