package com.sptg.estate.api.feigns.fallback;

import com.baomidou.mybatisplus.plugins.Page;
import com.sptg.common.core.beans.PageBean;
import com.sptg.estate.api.dto.BaseUser;
import com.sptg.estate.api.dto.UserInfoDto;
import com.sptg.estate.api.feigns.BaseUserFeign;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * title: BaseUserFeignFallbackFactory
 * description:
 *
 *                  
 *            
 */
@Component
@Slf4j
public class BaseUserFeignFallbackFactory implements FallbackFactory<BaseUserFeign> {


    @Override
    public BaseUserFeign create(Throwable cause) {
        return new BaseUserFeign() {
            @Override
            public BaseUser getUserById(String userId) {
                log.error(cause.getMessage());
                return null;
            }

            @Override
            public Page<UserInfoDto> pagingQueryServerUser(PageBean<UserInfoDto, String> pageBean) {
                log.error(cause.getMessage());
                return pageBean;
            }

            @Override
            public Page<UserInfoDto> pagingQueryServerUserEnable(PageBean<UserInfoDto, String> pageBean) {
                log.error(cause.getMessage());
                return pageBean;
            }
            @Override
            public Page<UserInfoDto> pagingQueryUser(PageBean<UserInfoDto, String> pageBean) {
                log.error(cause.getMessage());
                return pageBean;
            }
            @Override
            public Page<UserInfoDto> pagingQueryUserEnable(PageBean<UserInfoDto, String> pageBean) {
                log.error(cause.getMessage());
                return pageBean;
            }
        };
    }
}
