From 8f781f3cb17187a7ee58f41632c25fbb2aa81cc7 Mon Sep 17 00:00:00 2001
From: linzhijie <19970921lzj>
Date: 星期二, 16 三月 2021 19:57:24 +0800
Subject: [PATCH] 补充环境配置

---
 src/main/java/com/ots/project/exam/dto/RestResponse.java |   31 +++++++++++++++++++++++++++++--
 1 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/ots/project/exam/dto/RestResponse.java b/src/main/java/com/ots/project/exam/dto/RestResponse.java
index daa0510..871c0fa 100644
--- a/src/main/java/com/ots/project/exam/dto/RestResponse.java
+++ b/src/main/java/com/ots/project/exam/dto/RestResponse.java
@@ -1,32 +1,51 @@
 package com.ots.project.exam.dto;
+
 import com.ots.common.enums.ResponseCode;
 import com.ots.common.enums.SystemCode;
 import com.ots.project.common.exception.BaseException;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.dao.DuplicateKeyException;
 
+/**
+ * @author Shawn
+ */
 @Slf4j
 public class RestResponse<T> {
     private int code;
     private String message;
     private T response;
+
     public RestResponse(int code, String message) {
         this.code = code;
         this.message = message;
     }
+
     public RestResponse(int code, String message, T response) {
         this.code = code;
         this.message = message;
         this.response = response;
     }
+
     public static RestResponse fail(Integer code, String msg) {
         return new RestResponse<>(code, msg);
     }
-    
+
+    /**
+     * 澧炲姞閿欒缂栫爜缁熶竴澶勭悊
+     *
+     * @param enumCode
+     * @return
+     */
     public static RestResponse fail(ResponseCode enumCode) {
         return new RestResponse<>(enumCode.getCode(), enumCode.getMessage());
     }
-    
+
+    /**
+     * 寮傚父缁撳悎鏋氫妇鏂逛究寮傚父缁熶竴澶勭悊
+     *
+     * @param e
+     * @return
+     */
     public static RestResponse fail(Exception e) {
         if (e instanceof BaseException) {
             BaseException e1 = (BaseException) e;
@@ -38,29 +57,37 @@
             return new RestResponse<>(999, e.getMessage());
         }
     }
+
     public static RestResponse ok() {
         SystemCode systemCode = SystemCode.OK;
         return new RestResponse<>(systemCode.getCode(), systemCode.getMessage());
     }
+
     public static <F> RestResponse<F> ok(F response) {
         SystemCode systemCode = SystemCode.OK;
         return new RestResponse<>(systemCode.getCode(), systemCode.getMessage(), response);
     }
+
     public int getCode() {
         return code;
     }
+
     public void setCode(int code) {
         this.code = code;
     }
+
     public String getMessage() {
         return message;
     }
+
     public void setMessage(String message) {
         this.message = message;
     }
+
     public T getResponse() {
         return response;
     }
+
     public void setResponse(T response) {
         this.response = response;
     }

--
Gitblit v1.9.1