From e3aed650aa4e232f4583a00fc3de088276a2188b Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期六, 15 一月 2022 13:41:18 +0800
Subject: [PATCH] 优化代码
---
java110-bean/src/main/java/com/java110/vo/ResultVo.java | 39 +++++++++++++++++++++++++++++++++++++--
1 files changed, 37 insertions(+), 2 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 8d4c337..8eb7044 100755
--- a/java110-bean/src/main/java/com/java110/vo/ResultVo.java
+++ b/java110-bean/src/main/java/com/java110/vo/ResultVo.java
@@ -28,6 +28,7 @@
public static final int CODE_UNAUTHORIZED = 401; //璁よ瘉澶辫触
public static final int CODE_WECHAT_UNAUTHORIZED = 1401; //璁よ瘉澶辫触
+ public static final int CODE_BUSINESS_VERIFICATION = 5010; //涓氬姟鏍¢獙鏈�氳繃
public static final int ORDER_ERROR = 500; //璁㈠崟璋冨害寮傚父
@@ -41,6 +42,10 @@
public static final int DEFAULT_RECORD = 1;
public static final int DEFAULT_TOTAL = 1;
+ public static final int CODE_WAIT_PAY = 41;// 鏀粯鏈畬鎴�
+
+ public static final String EMPTY_ARRAY = "[]";
+
// 鍒嗛〉椤垫暟
private int page;
// 琛屾暟
@@ -50,7 +55,7 @@
private int records;
// 鎬昏褰曟暟
- private int total;
+ private long total;
//鐘舵��
private int code;
@@ -82,6 +87,14 @@
}
public ResultVo(int records, int total, Object data) {
+ this.code = CODE_OK;
+ this.msg = MSG_OK;
+ this.records = records;
+ this.total = total;
+ this.data = data;
+ }
+
+ public ResultVo(int records, long total, Object data) {
this.code = CODE_OK;
this.msg = MSG_OK;
this.records = records;
@@ -146,7 +159,7 @@
this.records = records;
}
- public int getTotal() {
+ public long getTotal() {
return total;
}
@@ -239,6 +252,17 @@
*
* @return
*/
+ public static ResponseEntity<String> error(String msg,HttpStatus status) {
+ ResultVo resultVo = new ResultVo(CODE_ERROR, msg);
+ ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), status);
+ 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);
@@ -246,6 +270,17 @@
}
/**
+ * 鎴愬姛閫氱敤鍥炲
+ *
+ * @return
+ */
+ public static ResponseEntity<String> error(String msg,Object data) {
+ ResultVo resultVo = new ResultVo(CODE_ERROR, msg,data);
+ ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
+ return responseEntity;
+ }
+
+ /**
* 鍒涘缓ResponseEntity瀵硅薄
*
* @param records 椤垫暟
--
Gitblit v1.8.0