feat(system): 添加域名和租户的查询接口

- 在 DomainController 中添加了 getByDomain 接口,用于根据域名查询授权域名信息
- 在 TenantController 中添加了 getByCode 接口,用于根据代码搜索租户信息
- 在 DomainService 和 TenantService 接口中定义了相应的查询方法
- 在 DomainServiceImpl 和 TenantServiceImpl 中实现了查询方法
This commit is contained in:
2025-08-28 15:03:06 +08:00
parent 3b786e2c45
commit b0fc834963
6 changed files with 53 additions and 21 deletions

View File

@@ -54,6 +54,15 @@ public class DomainController extends BaseController {
return success(domainService.getByIdRel(id)); return success(domainService.getByIdRel(id));
} }
@PreAuthorize("hasAuthority('sys:domain:list')")
@OperationLog
@ApiOperation("根据domain查询授权域名")
@GetMapping("/getByDomain/{domain}")
public ApiResult<Domain> getByDomain(@PathVariable("domain") String domain) {
// 使用关联查询
return success(domainService.getByDomainRel(domain));
}
@PreAuthorize("hasAuthority('sys:domain:save')") @PreAuthorize("hasAuthority('sys:domain:save')")
@OperationLog @OperationLog
@ApiOperation("添加授权域名") @ApiOperation("添加授权域名")

View File

@@ -96,6 +96,12 @@ public class TenantController extends BaseController {
return success(tenant.getTenantId()); return success(tenant.getTenantId());
} }
@ApiOperation("根据code搜索租户")
@GetMapping("/getByCode/{code}")
public ApiResult<Tenant> getByCode(@PathVariable("code") String code) {
return success(tenantService.getByCodeRel(code));
}
@PreAuthorize("hasAuthority('sys:tenant:save')") @PreAuthorize("hasAuthority('sys:tenant:save')")
@OperationLog @OperationLog
@ApiOperation("添加租户") @ApiOperation("添加租户")

View File

@@ -39,4 +39,5 @@ public interface DomainService extends IService<Domain> {
*/ */
Domain getByIdRel(Integer id); Domain getByIdRel(Integer id);
Domain getByDomainRel(String domain);
} }

View File

@@ -43,4 +43,6 @@ public interface TenantService extends IService<Tenant> {
Company initialization(Company company); Company initialization(Company company);
boolean destructionAll(Integer tenantId); boolean destructionAll(Integer tenantId);
Tenant getByCodeRel(String code);
} }

View File

@@ -44,4 +44,11 @@ public class DomainServiceImpl extends ServiceImpl<DomainMapper, Domain> impleme
return param.getOne(baseMapper.selectListRel(param)); return param.getOne(baseMapper.selectListRel(param));
} }
@Override
public Domain getByDomainRel(String domain) {
DomainParam param = new DomainParam();
param.setDomain(domain);
return param.getOne(baseMapper.selectListRel(param));
}
} }

View File

@@ -624,4 +624,11 @@ public class TenantServiceImpl extends ServiceImpl<TenantMapper, Tenant> impleme
return false; return false;
} }
@Override
public Tenant getByCodeRel(String code) {
TenantParam param = new TenantParam();
param.setTenantCode(code);
return param.getOne(baseMapper.selectListRel(param));
}
} }