package com.muyu.common.system.remote.factory;

import com.muyu.common.core.domain.Result;
import com.muyu.common.system.domain.Datasource;
import com.muyu.common.system.domain.LoginUser;
import com.muyu.common.system.domain.SysUser;
import com.muyu.common.system.remote.RemoteSaaSService;
import com.muyu.common.system.remote.RemoteUserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 用户服务降级处理
 *
 * @author muyu
 */
@Component
public class RemoteSaaSFallbackFactory implements FallbackFactory<RemoteSaaSService> {

    @Override
    public RemoteSaaSService create(Throwable cause) {
        return new RemoteSaaSService() {
            @Override
            public Result<List<Datasource>> findDatabaseList() {
                return Result.error("查询数据库失败:" + cause.getMessage());
            }
        };
    }
}
