完成 TenantApi 的 feign 支持
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package cn.iocoder.yudao.module.system.api.tenant;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.system.service.tenant.TenantService;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.module.system.enums.ApiConstants.VERSION;
|
||||
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@DubboService(version = VERSION) // 提供 Dubbo RPC 接口,给 Dubbo Consumer 调用
|
||||
@Validated
|
||||
public class TenantApiImpl implements TenantApi {
|
||||
|
||||
@Resource
|
||||
private TenantService tenantService;
|
||||
|
||||
@Override
|
||||
public CommonResult<List<Long>> getTenantIds() {
|
||||
return success(tenantService.getTenantIds());
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> validTenant(Long id) {
|
||||
tenantService.validTenant(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,7 +20,7 @@ import java.util.Set;
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface TenantService extends TenantFrameworkService {
|
||||
public interface TenantService {
|
||||
|
||||
/**
|
||||
* 初始化租户的本地缓存
|
||||
@@ -120,4 +120,18 @@ public interface TenantService extends TenantFrameworkService {
|
||||
* @param handler 处理器
|
||||
*/
|
||||
void handleTenantMenu(TenantMenuHandler handler);
|
||||
|
||||
/**
|
||||
* 获得所有租户
|
||||
*
|
||||
* @return 租户编号数组
|
||||
*/
|
||||
List<Long> getTenantIds();
|
||||
|
||||
/**
|
||||
* 校验租户是否合法
|
||||
*
|
||||
* @param id 租户编号
|
||||
*/
|
||||
void validTenant(Long id);
|
||||
}
|
||||
|
||||
@@ -77,6 +77,7 @@ yudao:
|
||||
- /admin-api/system/tenant/get-id-by-name # 基于名字获取租户,不许带租户编号
|
||||
- /admin-api/system/captcha/get-image # 获取图片验证码,和租户无关
|
||||
- /admin-api/system/sms/callback/* # 短信回调接口,无法带上租户编号
|
||||
- /rpc-api/system/tenant/valid # 防止递归。避免调用 /rpc-api/system/tenant/valid 接口时,又去触发 /rpc-api/system/tenant/valid 去校验
|
||||
ignore-tables:
|
||||
- system_tenant
|
||||
- system_tenant_package
|
||||
|
||||
Reference in New Issue
Block a user