Prechádzať zdrojové kódy

返回值 content 为空 给个list

lvxianyun 3 rokov pred
rodič
commit
1a79f8ac76

+ 6 - 5
src/main/java/com/persagy/proxy/adm/request/AdmResponse.java

@@ -8,6 +8,7 @@ import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -36,15 +37,15 @@ public class AdmResponse {
     private List<?> content;
 
     public static AdmResponse success() {
-        return new AdmResponse(SUCCESS, "", 0L,null, 1, 500, null);
+        return new AdmResponse(SUCCESS, "", 0L,null, 1, 500, new ArrayList<>(1));
     }
 
     public static AdmResponse failure(String message) {
-        return new AdmResponse(FAILURE, message, null, null, null, null, null);
+        return new AdmResponse(FAILURE, message, null, null, null, null, new ArrayList<>(1));
     }
 
     public static AdmResponse success(List<?> content) {
-        return new AdmResponse(SUCCESS, "", CollUtil.isEmpty(content) ? 0L :content.size()*1L,null, 1, 500, content);
+        return new AdmResponse(SUCCESS, "", CollUtil.isEmpty(content) ? 0L :content.size()*1L,null, 1, 500, CollUtil.isEmpty(content) ? new ArrayList<>(1): content);
     }
 
     /**
@@ -65,9 +66,9 @@ public class AdmResponse {
         Integer pageNo = admRequest == null ? null : admRequest.getPageNumber();
         Integer pageSize = admRequest == null ? null : admRequest.getPageSize();
         if(admRequest.isOnlyCount()){
-            return new AdmResponse(SUCCESS, null, null,total, pageNo, pageSize, admVOs);
+            return new AdmResponse(SUCCESS, null, null,total, pageNo, pageSize, CollUtil.isEmpty(admVOs) ? new ArrayList<>(1) : admVOs);
         }else {
-            return new AdmResponse(SUCCESS, null, total,null, pageNo, pageSize, admVOs);
+            return new AdmResponse(SUCCESS, null, total,null, pageNo, pageSize, CollUtil.isEmpty(admVOs) ? new ArrayList<>(1) : admVOs);
         }
     }
 }