package com.yuchen.saas.manage.system.api.feign;

import com.yuchen.saas.manage.system.api.entity.DataScope;
import feign.hystrix.FallbackFactory;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.stereotype.Component;

/**
 * @Author: 肖润飞
 * @CreateTime: 2022/11/25 10:49
 * @Description: TODO
 * @Version: 1.0
 */
@Component
public class DataScopeFeignFallback implements FallbackFactory<DataScopeFeignServer> {

    @Override
    public DataScopeFeignServer create(Throwable cause) {
        return new DataScopeFeignServer() {
            @Override
            public R<DataScope> detail(DataScope dataScope) {
                return R.error("远程调用失败");
            }

            @Override
            public R<DataScope> detailById(Long id) {
                return R.error("远程调用失败");
            }
        };
    }
}