parent
816e1fbf9b
commit
e792054adb
@ -0,0 +1,43 @@
|
||||
package cn.iocoder.yudao.module.system.controller.app.tenant;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
||||
import cn.iocoder.yudao.module.system.controller.app.tenant.vo.AppTenantRespVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.tenant.TenantDO;
|
||||
import cn.iocoder.yudao.module.system.service.tenant.TenantService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.annotation.security.PermitAll;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "用户 App - 租户")
|
||||
@RestController
|
||||
@RequestMapping("/system/tenant")
|
||||
public class AppTenantController {
|
||||
|
||||
@Resource
|
||||
private TenantService tenantService;
|
||||
|
||||
@GetMapping("/get-by-website")
|
||||
@PermitAll
|
||||
@TenantIgnore
|
||||
@Operation(summary = "使用域名,获得租户信息", description = "根据用户的域名,获得租户信息")
|
||||
@Parameter(name = "website", description = "域名", required = true, example = "www.iocoder.cn")
|
||||
public CommonResult<AppTenantRespVO> getTenantByWebsite(@RequestParam("website") String website) {
|
||||
TenantDO tenant = tenantService.getTenantByWebsite(website);
|
||||
if (tenant == null || CommonStatusEnum.isDisable(tenant.getStatus())) {
|
||||
return success(null);
|
||||
}
|
||||
return success(BeanUtils.toBean(tenant, AppTenantRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package cn.iocoder.yudao.module.system.controller.app.tenant.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "用户 App - 租户 Response VO")
|
||||
@Data
|
||||
public class AppTenantRespVO {
|
||||
|
||||
@Schema(description = "租户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "租户名", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
|
||||
private String name;
|
||||
|
||||
}
|
||||
Loading…
Reference in new issue