feat(tenant): 增加查询租户开启状态和租户根据域名查询租户的接口

This commit is contained in:
KAI
2025-07-19 15:58:00 +00:00
committed by Charles7c
parent 9eff846711
commit dec5d611be
7 changed files with 40 additions and 6 deletions

View File

@@ -16,17 +16,22 @@
package top.continew.admin.tenant.controller;
import cn.dev33.satoken.annotation.SaIgnore;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
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 top.continew.admin.tenant.model.entity.TenantDO;
import top.continew.admin.tenant.model.query.PackageQuery;
import top.continew.admin.tenant.service.PackageService;
import top.continew.admin.tenant.service.TenantService;
import top.continew.starter.extension.crud.model.query.SortQuery;
import top.continew.starter.extension.crud.model.resp.LabelValueResp;
import top.continew.starter.extension.tenant.annotation.TenantIgnore;
import top.continew.starter.log.annotation.Log;
import java.util.List;
@@ -47,9 +52,23 @@ public class CommonController {
private final PackageService packageService;
private final TenantService tenantService;
@Operation(summary = "查询套餐字典", description = "查询套餐字典列表")
@GetMapping("/dict/package")
public List<LabelValueResp> listPackageDict(PackageQuery query, SortQuery sortQuery) {
return packageService.listDict(query, sortQuery);
}
@Operation(summary = "根据域名查询租户ID", description = "根据域名查询租户编码")
@SaIgnore
@TenantIgnore
@GetMapping("/id/domain")
public Long getTenantIdByUrl(@RequestParam("domain") String domain){
TenantDO tenantDO = tenantService.getByDomain(domain);
if (tenantDO != null){
return tenantDO.getId();
}
return null;
}
}