From 4484acb56810d06ef5c2f78190a93688a61f83a7 Mon Sep 17 00:00:00 2001
From: chenjiahe <763432473@qq.com>
Date: 星期二, 28 六月 2022 16:16:48 +0800
Subject: [PATCH] 修改包名称

---
 src/main/java/com/hx/resultTool/Result.java |   34 ++++++++++++++++++++++++++++++++++
 1 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/hx/resultTool/Result.java b/src/main/java/com/hx/resultTool/Result.java
index 32f35c9..4cc8121 100644
--- a/src/main/java/com/hx/resultTool/Result.java
+++ b/src/main/java/com/hx/resultTool/Result.java
@@ -1,5 +1,10 @@
 package com.hx.resultTool;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.hx.exception.TipsException;
+
 import java.io.Serializable;
 
 /**
@@ -54,6 +59,35 @@
         return Result;
     }
 
+    /**鏍¢獙杩斿洖鐮�*/
+    public Boolean checkCode(){
+        if(ResponseCode.SUCCESS.equals(code)){
+            return true;
+        }
+        return false;
+    }
+
+    /**鏍¢獙杩斿洖鐮侊紝杩涜閿欒鎻愮ず*/
+    public void checkTips(){
+        if(!ResponseCode.SUCCESS.equals(code)){
+            throw new TipsException("璇锋眰澶辫触锛�"+this.code+","+this.msg);
+        }
+    }
+
+    /**杩斿洖鏁版嵁杞琂SONObject*/
+    public JSONObject getJsonObject(Object data){
+        return JSONObject.parseObject(JSON.toJSONString(data));
+    }
+
+    /**杩斿洖鏁版嵁杞琂SONArray*/
+    public JSONArray getJsonArray(Object data){
+        return JSONArray.parseArray(JSON.toJSONString(data));
+    }
+
+    public <T> T getObject(Object data, Class<T> clazz) {
+        return JSONObject.parseObject(JSON.toJSONString(data), clazz);
+    }
+
     /*******************************************************************************/
 
     public String getCode() {

--
Gitblit v1.8.0