package com.miaxis.feign;


import com.miaxis.school.domain.SchoolInfo;
import com.miaxis.common.core.page.ResponsePageInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(name="iMTrainRecordDataService",
        url = "${feign.jgpt_ipport}",
        fallback = ITMTrainRecordDataService.TMTrainRecordDataServiceImpl.class
)
public interface  ITMTrainRecordDataService {
    @RequestMapping(value = "/open-api/school/info/list", method = RequestMethod.GET)
    ResponsePageInfo<SchoolInfo> selectSchoolInfoList(@RequestParam("schoolInfo") SchoolInfo schoolInfo);
    /**
     * 容错处理类，当调用失败时，简单返回空字符串
     */
    @Component
    public class TMTrainRecordDataServiceImpl implements ITMTrainRecordDataService {
        @Override
        public ResponsePageInfo<SchoolInfo> selectSchoolInfoList(@RequestParam("schoolInfo") SchoolInfo schoolInfo) {
            System.out.println("调用失败");
            return null;
        }
    }
}
