mirror of
https://codeup.aliyun.com/64f7d6b8ce01efaafef1e678/coal/coal.git
synced 2026-01-25 07:46:40 +08:00
完善返回值
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -33,3 +33,5 @@ build/
|
||||
.vscode/
|
||||
*.log
|
||||
|
||||
src/main/resources/rebel.xml
|
||||
coal.log.*.gz
|
||||
|
||||
@@ -29,6 +29,11 @@ public class RResponseBodyAdvice implements ResponseBodyAdvice<Object> {
|
||||
if (!selectedContentType.includes(MediaType.APPLICATION_JSON)) {
|
||||
return body;
|
||||
}
|
||||
|
||||
if (body == null) {
|
||||
return R.success();
|
||||
}
|
||||
|
||||
if (body instanceof byte[]) {
|
||||
return body;
|
||||
}
|
||||
|
||||
@@ -33,6 +33,10 @@ public class R<T> {
|
||||
}
|
||||
|
||||
|
||||
public static <T> R<T> success() {
|
||||
return success(null);
|
||||
}
|
||||
|
||||
public static <T> R<T> success(T data) {
|
||||
return create(data, "ok", "");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user