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

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

import java.util.List;

/**
 * @author zhouhanwei
 * @create 2023/11/1 9:11
 */
@Component
public class CustomerManageFallback implements FallbackFactory<CustomerManageFeignServer> {

    @Override
    public CustomerManageFeignServer create(Throwable throwable) {
        return new CustomerManageFeignServer() {

            @Override
            public R<List<NestCustomerManage>> getAllCustomerManageList() {
                return R.error("远程调用失败");
            }

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

            @Override
            public R<List<NestCustomerManage>> getCustomerManageListBySubjectId() {
                return R.error("远程调用失败");
            }
        };
    }
}
