wuxw
2019-10-30 6b14a8bd143c548c29a464c9e479ec43def10506
java110-service/src/main/java/com/java110/service/smo/impl/QueryServiceSMOImpl.java
@@ -4,14 +4,14 @@
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.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;
@@ -182,16 +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());
@@ -256,7 +249,10 @@
            String currentSql = sqlObj.getString(dataQuery.getTemplateKey());
            //处理 if 判断
            logger.debug("dealSqlIf开始处理sql中的<if>节点 " + currentSql + " 入参:" + params.toJSONString());
            currentSql = dealSqlIf(currentSql, params);
            logger.debug("dealSqlIf处理完成sql中的<if>节点 " + currentSql + " 入参:" + params.toJSONString());
            String[] sqls = currentSql.split("#");
            String currentSqlNew = "";
@@ -371,10 +367,11 @@
                newSql.append(root.getText());
            }
        }
        return newSql.toString();
        return newSql.toString().replace("&gt;", ">").replace("&lt;", "<");
    }