paascloud/paascloud-master · error · UacBizException

UAC10011026

UAC10011026

Error message

ErrorCodeEnum.UAC10011026

What it means

UacBizException with ErrorCodeEnum.UAC10011026 ("更新用户失败, userId=%") is thrown by UacUserServiceImpl.saveUacUser on the update branch when uacUserMapper.updateUacUser(user) affects fewer than 1 row. Although the user record was found by primary key, the UPDATE matched no rows.

Solutions

  1. Re-fetch the user, merge changes onto the fresh entity, and retry the update once
  2. Check for concurrent modification: compare version numbers and surface a 'record changed by someone else' error to the client
  3. Verify the updateUacUser mapper XML WHERE clause actually matches the row for the given entity state
  4. Confirm the user still exists before update and return UAC10011011 instead if it was deleted

Example fix

// before
int updateInt = uacUserMapper.updateUacUser(user);
if (updateInt < 1) {
    throw new UacBizException(ErrorCodeEnum.UAC10011026, user.getId());
}
// after
int updateInt = uacUserMapper.updateUacUser(user);
if (updateInt < 1) {
    if (uacUserMapper.selectByPrimaryKey(user.getId()) == null) {
        throw new UacBizException(ErrorCodeEnum.UAC10011011, user.getId());
    }
    throw new UacBizException(ErrorCodeEnum.UAC10011026, user.getId());
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (user.getId() != null && uacUserMapper.selectByPrimaryKey(user.getId()) == null) {
    throw new BusinessException("user no longer exists");
}

Try / catch

try {
    uacUserService.saveUacUser(user, initPwd, authResDto);
} catch (UacBizException e) {
    if (e.getCode() == 10011026) { /* reload entity, merge, retry once */ }
    else throw e;
}

Prevention

When it happens

Trigger: Calling saveUacUser with a non-null user.getId() where the UPDATE statement updates 0 rows — typically a concurrent delete between the selectByPrimaryKey check and the update, or updateUacUser's WHERE conditions (e.g. version/optimistic-lock column) not matching.

Common situations: Optimistic-locking version conflicts when two admins edit the same user; user deleted in another session; mapping SQL for updateUacUser filtering on a column that is null in the passed entity.

Related errors


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

Appendix: source

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

			user.setId(userId);
			user.setLoginName(loginName);
			user.setType(UacUserTypeEnum.OPERATE.getKey());
			user.setUserSource(UacUserSourceEnum.INSERT.getKey());
			// TODO 校验状态是否合法
			uacUserMapper.insertSelective(user);

			// 2.添加组织关联
			UacGroupUser groupUser = new UacGroupUser();
			groupUser.setGroupId(user.getGroupId());
			groupUser.setUserId(userId);
			uacGroupUserService.save(groupUser);
		} else {
			UacUser uacUser = uacUserMapper.selectByPrimaryKey(user.getId());
			Preconditions.checkArgument(uacUser != null, "用户不存在");
			// 1.更新用户信息
			int updateInt = uacUserMapper.updateUacUser(user);
			if (updateInt < 1) {
				throw new UacBizException(ErrorCodeEnum.UAC10011026, user.getId());
			}
			// 2.绑定组织信息
			UacGroupUser uacGroupUser = uacGroupUserService.queryByUserId(user.getId());
			if (uacGroupUser == null) {
				// 添加组织关联
				UacGroupUser groupUser = new UacGroupUser();
				groupUser.setGroupId(user.getGroupId());
				groupUser.setUserId(user.getId());
				uacGroupUserService.save(groupUser);
			} else {
				//修改组织
				UacGroupUser groupUser = new UacGroupUser();
				groupUser.setUserId(user.getId());
				groupUser.setGroupId(user.getGroupId());
				uacGroupUserService.updateByUserId(groupUser);
			}
		}

View on GitHub (pinned to 781281a950)