From 28e7d3937f819a3486b22bfa1c84aee172aaccb4 Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期一, 17 一月 2022 17:46:42 +0800
Subject: [PATCH] 优化代码

---
 java110-service/src/main/java/com/java110/service/smo/impl/QueryServiceSMOImpl.java |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/java110-service/src/main/java/com/java110/service/smo/impl/QueryServiceSMOImpl.java b/java110-service/src/main/java/com/java110/service/smo/impl/QueryServiceSMOImpl.java
index 5ae8d2d..fbba361 100755
--- a/java110-service/src/main/java/com/java110/service/smo/impl/QueryServiceSMOImpl.java
+++ b/java110-service/src/main/java/com/java110/service/smo/impl/QueryServiceSMOImpl.java
@@ -23,7 +23,7 @@
 import org.dom4j.DocumentHelper;
 import org.dom4j.Element;
 import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import com.java110.core.log.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
@@ -341,6 +341,25 @@
         }
     }
 
+    /**
+     * 鎵цjava鑴氭湰
+     *
+     * @param javaCode
+     * @throws BusinessException
+     */
+    public JSONObject execJava(JSONObject params, String javaCode) throws BusinessException {
+        try {
+            //JSONObject params = dataQuery.getRequestParams();
+            Interpreter interpreter = new Interpreter();
+            interpreter.eval(javaCode);
+            interpreter.set("params", params);
+            return JSONObject.parseObject(interpreter.eval("execute(dataQuery)").toString());
+        } catch (Exception e) {
+            logger.error("鏁版嵁浜や簰寮傚父锛�", e);
+            throw new BusinessException(ResponseConstant.RESULT_CODE_INNER_ERROR, "鏁版嵁浜や簰寮傚父," + e.getMessage());
+        }
+    }
+
     @Override
     public JSONObject execQuerySql(JSONObject params, String currentSql) throws BusinessException {
         List<Map<String, Object>> results = null;

--
Gitblit v1.8.0