Commit 7ea45f15 by 吴佳

dbReadset 查询条件带占位符报错问题修复

parent 94e18a23
...@@ -17,10 +17,7 @@ import org.slf4j.LoggerFactory; ...@@ -17,10 +17,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
...@@ -175,8 +172,12 @@ public class MybatisArgumentAdapter { ...@@ -175,8 +172,12 @@ public class MybatisArgumentAdapter {
//如果是多表查询 //如果是多表查询
if (null != clazzList && clazzList.size() > 1) { if (null != clazzList && clazzList.size() > 1) {
StringBuffer selectColumn = new StringBuffer(); StringBuffer selectColumn = new StringBuffer();
String tmpSql = sql.toLowerCase();
if(tmpSql.indexOf("where")!=-1 ) {
tmpSql = tmpSql.substring(0, tmpSql.lastIndexOf("where") - 1);
}
//获取SQL中别名和表明的对应关系 //获取SQL中别名和表明的对应关系
Map<String, String> tableNameMap = parseTableNameAndAlias(sql); Map<String, String> tableNameMap = parseTableNameAndAlias(tmpSql);
for (Class<? extends IModule> clazz : clazzList) { for (Class<? extends IModule> clazz : clazzList) {
//根据模型注解中的@Table 获取当前模型对应的表名 //根据模型注解中的@Table 获取当前模型对应的表名
String tableNam = clazz.getAnnotation(Table.class).value(); String tableNam = clazz.getAnnotation(Table.class).value();
......
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