feat(system): 添加域名和租户的查询接口
- 在 DomainController 中添加了 getByDomain 接口,用于根据域名查询授权域名信息 - 在 TenantController 中添加了 getByCode 接口,用于根据代码搜索租户信息 - 在 DomainService 和 TenantService 接口中定义了相应的查询方法 - 在 DomainServiceImpl 和 TenantServiceImpl 中实现了查询方法
This commit is contained in:
@@ -54,6 +54,15 @@ public class DomainController extends BaseController {
|
||||
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')")
|
||||
@OperationLog
|
||||
@ApiOperation("添加授权域名")
|
||||
|
||||
@@ -96,6 +96,12 @@ public class TenantController extends BaseController {
|
||||
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')")
|
||||
@OperationLog
|
||||
@ApiOperation("添加租户")
|
||||
|
||||
@@ -39,4 +39,5 @@ public interface DomainService extends IService<Domain> {
|
||||
*/
|
||||
Domain getByIdRel(Integer id);
|
||||
|
||||
Domain getByDomainRel(String domain);
|
||||
}
|
||||
|
||||
@@ -43,4 +43,6 @@ public interface TenantService extends IService<Tenant> {
|
||||
Company initialization(Company company);
|
||||
|
||||
boolean destructionAll(Integer tenantId);
|
||||
|
||||
Tenant getByCodeRel(String code);
|
||||
}
|
||||
|
||||
@@ -44,4 +44,11 @@ public class DomainServiceImpl extends ServiceImpl<DomainMapper, Domain> impleme
|
||||
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));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -624,4 +624,11 @@ public class TenantServiceImpl extends ServiceImpl<TenantMapper, Tenant> impleme
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tenant getByCodeRel(String code) {
|
||||
TenantParam param = new TenantParam();
|
||||
param.setTenantCode(code);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user