package com.xunmei.system.api.factory;


import com.xunmei.common.core.domain.IdName;
import com.xunmei.common.core.vo.IdNameVo;
import com.xunmei.system.api.Eto.RoleConditionEto;
import com.xunmei.system.api.RemoteRoleService;
import com.xunmei.system.api.domain.SysRole;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;


/**
 * @author :LuoWei
 * @date : 2023/8/25
 */
@Component
public class RemoteRoleFallbackFactory implements FallbackFactory<RemoteRoleService> {
    private static final Logger log = LoggerFactory.getLogger(RemoteRoleFallbackFactory.class);


    @Override
    public RemoteRoleService create(Throwable cause) {
        log.error("用户服务调用失败:{}", cause.getMessage());
        return new RemoteRoleService() {
            @Override
            public SysRole getRoleById(Long id, String source) {
                return null;
            }

            @Override
            public List<IdNameVo> getNames(RoleConditionEto condition) {
                return null;
            }
        };
    }
}
