From 0c51780582797cc003d59fe483c4e2754b2af577 Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期四, 04 三月 2021 14:33:05 +0800
Subject: [PATCH] 优化公摊

---
 java110-bean/src/main/java/com/java110/vo/ResultVo.java |   93 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 92 insertions(+), 1 deletions(-)

diff --git a/java110-bean/src/main/java/com/java110/vo/ResultVo.java b/java110-bean/src/main/java/com/java110/vo/ResultVo.java
index af0fbcf..8d4c337 100644
--- a/java110-bean/src/main/java/com/java110/vo/ResultVo.java
+++ b/java110-bean/src/main/java/com/java110/vo/ResultVo.java
@@ -52,7 +52,7 @@
     // 鎬昏褰曟暟
     private int total;
 
-    //鐘舵�佸槢
+    //鐘舵��
     private int code;
 
     //閿欒鎻愮ず
@@ -60,6 +60,12 @@
 
     //鏁版嵁瀵硅薄
     private Object data;
+
+    //鐢ㄦ潵瀛樻斁澶ц銆佸皬璁¢噾棰�
+    private Object sumTotal;
+
+    //鎵�闇�鏁版嵁
+    private Object rep;
 
     public ResultVo() {
     }
@@ -81,6 +87,25 @@
         this.records = records;
         this.total = total;
         this.data = data;
+    }
+
+    public ResultVo(int records, int total, Object data, Object sumTotal) {
+        this.code = CODE_OK;
+        this.msg = MSG_OK;
+        this.records = records;
+        this.total = total;
+        this.data = data;
+        this.sumTotal = sumTotal;
+    }
+
+    public ResultVo(int records, int total, Object data, Object sumTotal, Object rep) {
+        this.code = CODE_OK;
+        this.msg = MSG_OK;
+        this.records = records;
+        this.total = total;
+        this.data = data;
+        this.sumTotal = sumTotal;
+        this.rep = rep;
     }
 
     public ResultVo(int code, String msg, Object data) {
@@ -153,6 +178,22 @@
         this.data = data;
     }
 
+    public Object getSumTotal() {
+        return sumTotal;
+    }
+
+    public void setSumTotal(Object sumTotal) {
+        this.sumTotal = sumTotal;
+    }
+
+    public Object getRep() {
+        return rep;
+    }
+
+    public void setRep(Object rep) {
+        this.rep = rep;
+    }
+
     @Override
     public String toString() {
         return JSONObject.toJSONString(this, SerializerFeature.DisableCircularReferenceDetect, SerializerFeature.WriteDateUseDateFormat);
@@ -174,6 +215,39 @@
     /**
      * 鍒涘缓ResponseEntity瀵硅薄
      *
+     * @param resultVo 鏁版嵁瀵硅薄
+     * @return
+     */
+    public static ResponseEntity<String> createResponseEntity(ResultVo resultVo) {
+        ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
+        return responseEntity;
+    }
+
+    /**
+     * 鎴愬姛閫氱敤鍥炲
+     *
+     * @return
+     */
+    public static ResponseEntity<String> success() {
+        ResultVo resultVo = new ResultVo(CODE_OK, MSG_OK);
+        ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
+        return responseEntity;
+    }
+
+    /**
+     * 鎴愬姛閫氱敤鍥炲
+     *
+     * @return
+     */
+    public static ResponseEntity<String> error(String msg) {
+        ResultVo resultVo = new ResultVo(CODE_ERROR, msg);
+        ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
+        return responseEntity;
+    }
+
+    /**
+     * 鍒涘缓ResponseEntity瀵硅薄
+     *
      * @param records 椤垫暟
      * @param total   鎬昏褰曟暟
      * @param data    鏁版嵁瀵硅薄
@@ -181,6 +255,21 @@
      */
     public static ResponseEntity<String> createResponseEntity(int records, int total, Object data) {
         ResultVo resultVo = new ResultVo(records, total, data);
+        ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
+        return responseEntity;
+    }
+
+    /**
+     * 鍒涘缓ResponseEntity瀵硅薄
+     *
+     * @param records
+     * @param total
+     * @param data
+     * @param sumTotal
+     * @return
+     */
+    public static ResponseEntity<String> createResponseEntity(int records, int total, Object data, Object sumTotal) {
+        ResultVo resultVo = new ResultVo(records, total, data, sumTotal);
         ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
         return responseEntity;
     }
@@ -240,4 +329,6 @@
         ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
         return responseEntity;
     }
+
+
 }

--
Gitblit v1.8.0