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));
|
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("添加授权域名")
|
||||||
|
|||||||
@@ -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("添加租户")
|
||||||
|
|||||||
@@ -39,4 +39,5 @@ public interface DomainService extends IService<Domain> {
|
|||||||
*/
|
*/
|
||||||
Domain getByIdRel(Integer id);
|
Domain getByIdRel(Integer id);
|
||||||
|
|
||||||
|
Domain getByDomainRel(String domain);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,28 +20,35 @@ import java.util.List;
|
|||||||
@Service
|
@Service
|
||||||
public class DomainServiceImpl extends ServiceImpl<DomainMapper, Domain> implements DomainService {
|
public class DomainServiceImpl extends ServiceImpl<DomainMapper, Domain> implements DomainService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<Domain> pageRel(DomainParam param) {
|
public PageResult<Domain> pageRel(DomainParam param) {
|
||||||
PageParam<Domain, DomainParam> page = new PageParam<>(param);
|
PageParam<Domain, DomainParam> page = new PageParam<>(param);
|
||||||
page.setDefaultOrder("create_time desc");
|
page.setDefaultOrder("create_time desc");
|
||||||
List<Domain> list = baseMapper.selectPageRel(page, param);
|
List<Domain> list = baseMapper.selectPageRel(page, param);
|
||||||
return new PageResult<>(list, page.getTotal());
|
return new PageResult<>(list, page.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Domain> listRel(DomainParam param) {
|
public List<Domain> listRel(DomainParam param) {
|
||||||
List<Domain> list = baseMapper.selectListRel(param);
|
List<Domain> list = baseMapper.selectListRel(param);
|
||||||
// 排序
|
// 排序
|
||||||
PageParam<Domain, DomainParam> page = new PageParam<>();
|
PageParam<Domain, DomainParam> page = new PageParam<>();
|
||||||
page.setDefaultOrder("create_time desc");
|
page.setDefaultOrder("create_time desc");
|
||||||
return page.sortRecords(list);
|
return page.sortRecords(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Domain getByIdRel(Integer id) {
|
public Domain getByIdRel(Integer id) {
|
||||||
DomainParam param = new DomainParam();
|
DomainParam param = new DomainParam();
|
||||||
param.setId(id);
|
param.setId(id);
|
||||||
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));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user