1. GET请求方式,对于feign接口一定得用 @RequestParam/@SpringQueryMap等注解声明是路径参数,否则会自动识别为body params报错(controller接口则可不用,springmvc会自动匹配相同字段名)
demo:
API 层controller接口:
前端传参可直接传Query里的字段名,springmvc会自动匹配
例如前端传参page?current=2&size=20&id=1
/*** 分页查询会员积分明细*/@GetMapping("/page")public PageVO<Student> detail(StudentQuery studentQuery, Query query) {return studentDetailClient.detail(dto, query);}
feign接口
@GetMapping("/page")PageVO<Student> detail(@SpringQueryMap StudentQuery studentQuery,@SpringQueryMap Query query);
服务提供controller
/*** 分页查询会员积分明细*/@GetMapping("/page")public PageVO<Student> detail(StudentQuery studentQuery, Query query) {....
}