package com.yuchen.saas.park.api.feign.service;

import com.yuchen.saas.park.api.entity.park.PmgBatPointLocationInfo;
import com.yuchen.saas.park.api.util.SaasParkFeignFallbackUtils;
import feign.hystrix.FallbackFactory;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class PointLocationInfoFeignServiceFallback implements FallbackFactory<PointLocationInfoFeignService> {
    @Override
    public PointLocationInfoFeignService create(Throwable throwable) {
        return new PointLocationInfoFeignService() {

            @Override
            public R<PmgBatPointLocationInfo> selectOne(Long id) {
                return SaasParkFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<List<PmgBatPointLocationInfo>> listAll() {
                return SaasParkFeignFallbackUtils.printLogAndReturn(throwable);
            }
        };
    }
}
