R
R
Rocket-API
Search…
自定义返回结构封装
实现接口com.github.alenfive.rocketapi.extend.IResultWrapper
1
/**
2
* 默认结果包装类
3
*/
4
@Component
5
public class DefaultResultWrapper implements IResultWrapper{
6
7
@Override
8
public Object wrapper(Object data, HttpServletRequest request, HttpServletResponse response) {
9
return new ResultWrapper("0",request.getRequestURI(),"succeed",data);
10
}
11
12
@Override
13
public Object throwable(Throwable throwable, HttpServletRequest request, HttpServletResponse response) {
14
return new ResultWrapper("500",request.getRequestURI(),throwable.getMessage(),null);
15
}
16
}
17
Copied!
ResultWrapper类可自行定义
Last modified 10mo ago
Copy link