From 5e8136f6481581b606d053e84f624bf7f919c310 Mon Sep 17 00:00:00 2001
From: fhx <308050795@qq.com>
Date: 星期四, 06 四月 2023 10:50:56 +0800
Subject: [PATCH] 1.增加生成小程序连接方法

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

diff --git a/src/main/java/com/hx/resultTool/Result.java b/src/main/java/com/hx/resultTool/Result.java
index 8356a6a..5c696b0 100644
--- a/src/main/java/com/hx/resultTool/Result.java
+++ b/src/main/java/com/hx/resultTool/Result.java
@@ -1,8 +1,12 @@
 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;
+import java.util.List;
 
 /**
  * 缁熶竴杩斿洖鏍煎紡
@@ -71,6 +75,26 @@
         }
     }
 
+    /**杩斿洖鏁版嵁杞琂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 <T> List<T> getArray(Object data, Class<T> clazz) {
+        return JSONArray.parseArray(JSON.toJSONString(data), clazz);
+    }
+
     /*******************************************************************************/
 
     public String getCode() {

--
Gitblit v1.8.0