From 2bf68ba42eac2781eaa9e03d2b84d06682e7cfaf Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期四, 17 十月 2019 19:39:42 +0800
Subject: [PATCH] 打印 sql 中if 节点处理 打印日志方便调试

---
 java110-service/src/main/java/com/java110/service/smo/impl/QueryServiceSMOImpl.java |   37 +++++++++++++++----------------------
 1 files changed, 15 insertions(+), 22 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 0d13cd5..7cadaaf 100644
--- 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
@@ -4,19 +4,18 @@
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONPath;
-import com.java110.common.cache.ServiceSqlCache;
-import com.java110.common.constant.CommonConstant;
-import com.java110.common.constant.ResponseConstant;
-import com.java110.common.exception.BusinessException;
+import com.java110.utils.cache.ServiceSqlCache;
+import com.java110.utils.constant.CommonConstant;
+import com.java110.utils.constant.ResponseConstant;
+import com.java110.utils.exception.BusinessException;
 import com.java110.core.factory.DataTransactionFactory;
-import com.java110.common.log.LoggerEngine;
-import com.java110.common.util.Assert;
-import com.java110.common.util.StringUtil;
-import com.java110.entity.service.DataQuery;
+import com.java110.utils.log.LoggerEngine;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.StringUtil;
+import com.java110.service.context.DataQuery;
 import com.java110.entity.service.ServiceSql;
 import com.java110.service.dao.IQueryServiceDAO;
 import com.java110.service.smo.IQueryServiceSMO;
-import javassist.ClassPool;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.ibatis.ognl.Ognl;
 import org.apache.ibatis.ognl.OgnlException;
@@ -183,20 +182,9 @@
 
             Interpreter interpreter = new Interpreter();
             interpreter.eval(javaCode);
-           /* String param = "";
-            for (String key : params.keySet()) {
-                param += (params.getString(key) + ",");
-            }
-
-            if (param.endsWith(",")) {
-                param = param.substring(0, param.length() - 1);
-            }*/
-
-
-
-
+            interpreter.set("dataQuery", dataQuery);
             dataQuery.setResponseInfo(DataTransactionFactory.createBusinessResponseJson(ResponseConstant.RESULT_CODE_SUCCESS,
-                    "鎴愬姛", JSONObject.parseObject(interpreter.eval("execute(" + dataQuery + ")").toString())));
+                    "鎴愬姛", JSONObject.parseObject(interpreter.eval("execute(dataQuery)").toString())));
         } catch (Exception e) {
             logger.error("鏁版嵁浜や簰寮傚父锛�", e);
             throw new BusinessException(ResponseConstant.RESULT_CODE_INNER_ERROR, "鏁版嵁浜や簰寮傚父," + e.getMessage());
@@ -261,7 +249,10 @@
 
             String currentSql = sqlObj.getString(dataQuery.getTemplateKey());
             //澶勭悊 if 鍒ゆ柇
+            logger.debug("dealSqlIf寮�濮嬪鐞唖ql涓殑<if>鑺傜偣", currentSql);
             currentSql = dealSqlIf(currentSql, params);
+            logger.debug("dealSqlIf澶勭悊瀹屾垚sql涓殑<if>鑺傜偣", currentSql);
+
 
             String[] sqls = currentSql.split("#");
             String currentSqlNew = "";
@@ -376,6 +367,8 @@
                 newSql.append(root.getText());
             }
 
+
+
         }
 
 

--
Gitblit v1.8.0