diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/TenantController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/TenantController.java index 0020c928..0d1f86f0 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/TenantController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/TenantController.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.system.controller.admin.tenant; +import cn.hutool.core.map.MapUtil; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; @@ -20,6 +21,7 @@ import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import java.io.IOException; import java.util.List; +import java.util.Map; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; @@ -36,9 +38,13 @@ public class TenantController { @PermitAll @Operation(summary = "使用租户名,获得租户编号", description = "登录界面,根据用户的租户名,获得租户编号") @Parameter(name = "name", description = "租户名", required = true, example = "1024") - public CommonResult getTenantIdByName(@RequestParam("name") String name) { + public CommonResult getTenantIdByName(@RequestParam("name") String name) { TenantDO tenantDO = tenantService.getTenantByName(name); - return success(tenantDO != null ? tenantDO.getId() : null); + if (tenantDO == null) { + return success(null); + } + Map data = MapUtil.builder().put("id", tenantDO.getId()).put("name", tenantDO.getName()).build(); + return success(data); } @PostMapping("/create")