Commit 51a31068 by s_guodong

适配hql

parent 7e986872
......@@ -97,9 +97,26 @@ public class MybatisArgumentAdapter {
String conditions = "";
if (whereSql != null && !whereSql.trim().equals("")) {
if (whereSql.toUpperCase().indexOf("WHERE") > -1) {
String s = whereSql.toUpperCase();
int where = s.indexOf("WHERE");
if (where > -1) {
pattern = pattern.replace("WHERE", "");
}
if (s.contains("FROM")) {
int fromIndex = s.indexOf("WITH");
if (fromIndex == -1) {
fromIndex = s.indexOf("ON");
if (fromIndex > -1) {
fromIndex += 2;
}
} else {
fromIndex += 4;
}
if (fromIndex > -1 && where > -1) {
String b = whereSql.substring(fromIndex, where);
whereSql = whereSql.substring(where) + " AND " + b;
}
}
if (params != null && params.length > 0) {
conditions = convertPlaceHolder(whereSql, params, sqlParams);
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment