shuhao 1 mēnesi atpakaļ
vecāks
revīzija
874cd4cbb2

+ 4 - 1
src/main/java/com/xiesx/fastboot/core/body/GlobalBodyAdvice.java

@@ -9,7 +9,7 @@ import org.springframework.http.server.ServerHttpRequest;
 import org.springframework.http.server.ServerHttpResponse;
 import org.springframework.web.bind.annotation.RestControllerAdvice;
 import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
-
+import java.io.Serializable;
 import com.xiesx.fastboot.base.pagination.PaginationResult;
 import com.xiesx.fastboot.base.result.BaseResult;
 import com.xiesx.fastboot.base.result.R;
@@ -35,6 +35,9 @@ public class GlobalBodyAdvice implements ResponseBodyAdvice<Object> {
         log.debug("beforeBodyWrite ......");
         Object res = null;
         // 按需使用,如果有改动,务必兼容之前代码
+        if(returnValue instanceof Serializable){
+            return returnValue;
+        }
         if (returnValue instanceof BaseResult || returnValue instanceof PaginationResult) {
             res = returnValue;
         } else if (returnValue instanceof Map<?, ?> || returnValue instanceof Iterable<?>) {