{"record":{"id":"acdc04b3a4ec490f","repo":"jeecgboot/JeecgBoot","slug":"500-acdc04","errorCode":"500","errorMessage":"租户数据为空","messagePattern":"租户数据为空","errorType":"exception","errorClass":"JeecgBootException","httpStatus":null,"severity":"warning","filePath":"jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysUserTenantServiceImpl.java","lineNumber":112,"sourceCode":"        List<SysUserTenantVo> tenantListByUserId = userTenantMapper.getTenantListByUserId(userId, userTenantStatus);\n        // 代码逻辑说明: 【QQYUN-7283】1.已经是会员的租户，不是管理员时，没有购买按钮---\n        String noVip = \"default\";\n        tenantListByUserId.forEach((item) ->{\n            if(oConvertUtils.isNotEmpty(item.getMemberType()) && !noVip.equals(item.getMemberType())){\n                //查询是不是管理员\n                Long count = packUserMapper.izHaveBuyAuth(item.getId(), Integer.valueOf(item.getTenantUserId()));\n                if(count!=0){\n                    item.setTenantAdmin(true);\n                }\n            }\n        });\n        return tenantListByUserId;\n    }\n\n    @Override\n    public void updateUserTenantStatus(String id, String tenantId, String userTenantStatus) {\n        if (oConvertUtils.isEmpty(tenantId)) {\n            throw new JeecgBootException(\"租户数据为空\");\n        }\n        LambdaQueryWrapper<SysUserTenant> query = new LambdaQueryWrapper<>();\n        query.eq(SysUserTenant::getUserId, id);\n        query.eq(SysUserTenant::getTenantId, Integer.valueOf(tenantId));\n        SysUserTenant userTenant = userTenantMapper.selectOne(query);\n        if (null == userTenant) {\n            throw new JeecgBootException(\"租户数据为空\");\n        }\n        SysUserTenant tenant = new SysUserTenant();\n        tenant.setStatus(userTenantStatus);\n        this.update(tenant, query);\n    }\n\n    @Override\n    public IPage<SysUserTenantVo> getUserTenantPageList(Page<SysUserTenantVo> page, List<String> status, SysUser user, Integer tenantId) {\n        List<SysUserTenantVo> tenantPageList = userTenantMapper.getUserTenantPageList(page, status, user, tenantId);\n        List<String> userIds = tenantPageList.stream().map(SysUserTenantVo::getId).collect(Collectors.toList());\n        if (userIds != null && userIds.size() > 0) {","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/jeecgboot/JeecgBoot/blob/96fb33f5ec68516da0b0147da06b2eb0419e063a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysUserTenantServiceImpl.java#L94-L130","documentation":"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.","triggerScenarios":"Frontend submits the user-tenant status update without tenantId; field name mismatch yields null; a scripted/test call omits the parameter.","commonSituations":"Single-tenant deployment where the UI doesn't track tenantId; form field renamed; multi-tenant context not propagated through the request.","solutions":["Ensure the request includes a non-empty tenantId matching the sys_tenant record.","Derive tenantId from the current TenantContext on the server if the client shouldn't supply it.","Validate tenantId presence on the client before submit.","Log the incoming request body to confirm which field is missing."],"exampleFix":"// before: tenantId sourced from body, may be empty\npublic void updateUserTenantStatus(String id, String tenantId, String userTenantStatus) {\n    if (oConvertUtils.isEmpty(tenantId)) {\n        throw new JeecgBootException(\"租户数据为空\");\n    }\n...\n// after: fall back to current tenant context\nif (oConvertUtils.isEmpty(tenantId)) {\n    tenantId = TenantContext.getTenant();\n}\nif (oConvertUtils.isEmpty(tenantId)) {\n    throw new JeecgBootException(\"租户数据为空\");\n}","handlingStrategy":"validation","validationCode":"// Ensure tenantId is present, falling back to context\nif (oConvertUtils.isEmpty(tenantId)) {\n    tenantId = TenantContext.getTenant();\n}\nif (oConvertUtils.isEmpty(tenantId)) {\n    return Result.error(\"租户数据为空\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass the current tenantId from TenantContext or the login response.","Validate tenantId presence on the client.","Distinguish this input-missing case from the not-found case with different messages."],"tags":["tenant","input-validation","multi-tenant","jeecg-boot"],"backgroundTag":null,"analyzedSha":"96fb33f5ec68516da0b0147da06b2eb0419e063a","analyzedAt":"2026-08-14T00:04:16.786Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}