api-generator icon indicating copy to clipboard operation
api-generator copied to clipboard

统一格式参数解析

Open sunnymaple opened this issue 3 years ago • 0 comments

接口返回的参数通过ResponseBodyAdvice封装成统一格式的响应参数: 如: 接口返回Student对象(含有id,name 和age属性): /**

  • 根据ID获取学生信息
  • @param id 学生ID
  • @return */ @GetMapping public Student getStudentById(Integer id){ return new Student(); }

接口看似返回json: { “id”:1, "name":"张三", "age":18 }

但是在ResponseBodyAdvice实现类中,被封装成了: { "errorCode":“00000”, "message":"", "result":{ “id”:1, "name":"张三", "age":18 } }

是否可以支持这种封装

sunnymaple avatar Apr 15 '22 02:04 sunnymaple