Commit e8089efb by 林永健

fix parse sql bug

1 parent 86d26e98
...@@ -204,6 +204,18 @@ public class SopDataService { ...@@ -204,6 +204,18 @@ public class SopDataService {
* 将指定条件SQL进行拼接 * 将指定条件SQL进行拼接
*/ */
public String parseSQL(SopDataActionDTO action, String StageName, String instId) { public String parseSQL(SopDataActionDTO action, String StageName, String instId) {
String res = parseSQL(action);
if (!StringUtils.hasLength(res)) {
return "";
}
res = res.replace("&lt;", "<")
.replace("&gt;", ">")
.replace("&eq;", "=")
.replace("&ne;", "!=");
return sqlAnd(String.format(updateStagePrefix, StageName, instId), res) + ";";
}
public String parseSQL(SopDataActionDTO action) {
String res = action.getSql(); String res = action.getSql();
if (CollectionUtils.isEmpty(action.getConditions())) { if (CollectionUtils.isEmpty(action.getConditions())) {
return res; return res;
...@@ -224,15 +236,8 @@ public class SopDataService { ...@@ -224,15 +236,8 @@ public class SopDataService {
} }
condStrList.add(condStr); condStrList.add(condStr);
} }
res = sqlAnd(res, joinWithDelimiter(" and ", condStrList));
if (!StringUtils.hasLength(res.trim())) { return sqlAnd(res, joinWithDelimiter(" and ", condStrList));
return "";
}
res = res.replace("&lt;", "<")
.replace("&gt;", ">")
.replace("&eq;", "=")
.replace("&ne;", "!=");
return sqlAnd(String.format(updateStagePrefix, StageName, instId), res) + ";";
} }
private String parseSQLWithOperator(SopDataConditionDTO condition) { private String parseSQLWithOperator(SopDataConditionDTO condition) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!