Commit da705be1 authored by yanzg's avatar yanzg

常规BUG的修改

parent e6f3a7db
...@@ -66,6 +66,32 @@ public class StringHelper { ...@@ -66,6 +66,32 @@ public class StringHelper {
return false; return false;
} }
/**
* 是否属于空数组
*
* @param val
* @return
*/
public static boolean isEmptyArray(Object val) {
if (val == null) {
return true;
}
boolean isArray = val instanceof List || val.getClass().isArray();
if (!isArray) {
return false;
}
List list;
// 判断处理
if (val instanceof List) {
list = (List) val;
} else {
Object[] arr = (Object[]) val;
list = Arrays.asList(arr);
}
int length = list.size();
return length == 0;
}
/** /**
* 判断字符串是否为空 * 判断字符串是否为空
* *
...@@ -1021,4 +1047,5 @@ public class StringHelper { ...@@ -1021,4 +1047,5 @@ public class StringHelper {
return from; return from;
} }
} }
...@@ -485,7 +485,7 @@ public abstract class BaseDaoSql { ...@@ -485,7 +485,7 @@ public abstract class BaseDaoSql {
// 进行SQL语句参数替换,后面增加一个空格,方便后续用正则表达式进行替换处理 // 进行SQL语句参数替换,后面增加一个空格,方便后续用正则表达式进行替换处理
sql = sql.replaceFirst("\\?", "@" + field.paraName + " "); sql = sql.replaceFirst("\\?", "@" + field.paraName + " ");
} }
if (isCond && StringHelper.isEmpty(val)) { if (isCond && (StringHelper.isEmpty(val) || StringHelper.isEmptyArray(val))) {
continue; continue;
} }
} }
...@@ -566,8 +566,7 @@ public abstract class BaseDaoSql { ...@@ -566,8 +566,7 @@ public abstract class BaseDaoSql {
List list; List list;
// 判断处理 // 判断处理
boolean isList = val instanceof List; if (val instanceof List) {
if (isList) {
list = (List) val; list = (List) val;
} else { } else {
Object[] arr = (Object[]) val; Object[] arr = (Object[]) val;
......
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