Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

统一格式参数解析 #45

Open
sunnymaple opened this issue Apr 15, 2022 · 0 comments
Open

统一格式参数解析 #45

sunnymaple opened this issue Apr 15, 2022 · 0 comments

Comments

@sunnymaple
Copy link

接口返回的参数通过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
}
}

是否可以支持这种封装

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant