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


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


@Component
public class NestBusinessFallback implements FallbackFactory<NestBusinessFeignServer> {



    @Override
    public NestBusinessFeignServer create(Throwable cause) {
        return new NestBusinessFeignServer() {

            @Override
            public R openList() {
                return R.error("远程调用失败");
            }

            @Override
            public R getListByIds(CommonListIdParam commonListIdParam) {
                return R.error("远程调用失败");
            }

            @Override
            public R<NestBusiness> getBusinessByMenuId(Long menuId) {
                return R.error("远程调用失败");
            }

            @Override
            public R<NestBusiness> getDetail(Long id) {
                return R.error("远程调用失败"+cause.getMessage());
            }

        };
    }
}
