jeecgboot/JeecgBoot · warning · JeecgBootException

500

500

Error message

租户数据为空

What it means

Thrown by SysUserTenantServiceImpl.updateUserTenantStatus when the tenantId argument is empty (oConvertUtils.isEmpty(tenantId)). It is the first of two identical-message guards in this method: this one fires before any DB lookup because the caller omitted the tenant identifier.

Source

Thrown at jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysUserTenantServiceImpl.java:112

        List<SysUserTenantVo> tenantListByUserId = userTenantMapper.getTenantListByUserId(userId, userTenantStatus);
        // 代码逻辑说明: 【QQYUN-7283】1.已经是会员的租户,不是管理员时,没有购买按钮---
        String noVip = "default";
        tenantListByUserId.forEach((item) ->{
            if(oConvertUtils.isNotEmpty(item.getMemberType()) && !noVip.equals(item.getMemberType())){
                //查询是不是管理员
                Long count = packUserMapper.izHaveBuyAuth(item.getId(), Integer.valueOf(item.getTenantUserId()));
                if(count!=0){
                    item.setTenantAdmin(true);
                }
            }
        });
        return tenantListByUserId;
    }

    @Override
    public void updateUserTenantStatus(String id, String tenantId, String userTenantStatus) {
        if (oConvertUtils.isEmpty(tenantId)) {
            throw new JeecgBootException("租户数据为空");
        }
        LambdaQueryWrapper<SysUserTenant> query = new LambdaQueryWrapper<>();
        query.eq(SysUserTenant::getUserId, id);
        query.eq(SysUserTenant::getTenantId, Integer.valueOf(tenantId));
        SysUserTenant userTenant = userTenantMapper.selectOne(query);
        if (null == userTenant) {
            throw new JeecgBootException("租户数据为空");
        }
        SysUserTenant tenant = new SysUserTenant();
        tenant.setStatus(userTenantStatus);
        this.update(tenant, query);
    }

    @Override
    public IPage<SysUserTenantVo> getUserTenantPageList(Page<SysUserTenantVo> page, List<String> status, SysUser user, Integer tenantId) {
        List<SysUserTenantVo> tenantPageList = userTenantMapper.getUserTenantPageList(page, status, user, tenantId);
        List<String> userIds = tenantPageList.stream().map(SysUserTenantVo::getId).collect(Collectors.toList());
        if (userIds != null && userIds.size() > 0) {

View on GitHub (pinned to 96fb33f5ec)

Solutions

  1. Ensure the request includes a non-empty tenantId matching the sys_tenant record.
  2. Derive tenantId from the current TenantContext on the server if the client shouldn't supply it.
  3. Validate tenantId presence on the client before submit.
  4. Log the incoming request body to confirm which field is missing.

Example fix

// before: tenantId sourced from body, may be empty
public void updateUserTenantStatus(String id, String tenantId, String userTenantStatus) {
    if (oConvertUtils.isEmpty(tenantId)) {
        throw new JeecgBootException("租户数据为空");
    }
...
// after: fall back to current tenant context
if (oConvertUtils.isEmpty(tenantId)) {
    tenantId = TenantContext.getTenant();
}
if (oConvertUtils.isEmpty(tenantId)) {
    throw new JeecgBootException("租户数据为空");
}
Defensive patterns

Strategy: validation

Validate before calling

// Ensure tenantId is present, falling back to context
if (oConvertUtils.isEmpty(tenantId)) {
    tenantId = TenantContext.getTenant();
}
if (oConvertUtils.isEmpty(tenantId)) {
    return Result.error("租户数据为空");
}

Prevention

When it happens

Trigger: Frontend submits the user-tenant status update without tenantId; field name mismatch yields null; a scripted/test call omits the parameter.

Common situations: Single-tenant deployment where the UI doesn't track tenantId; form field renamed; multi-tenant context not propagated through the request.

Related errors


AI-assisted analysis of jeecgboot/JeecgBoot@96fb33f5ec (2026-08-14). Data as JSON: /api/errors/acdc04b3a4ec490f. Report an issue: GitHub.