Commit da705be1 authored by yanzg's avatar yanzg

常规BUG的修改

parent e6f3a7db
......@@ -66,6 +66,32 @@ public class StringHelper {
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;
}
/**
* 判断字符串是否为空
*
......@@ -196,7 +222,7 @@ public class StringHelper {
if (
(chars[start + 1] == 'x') ||
(chars[start + 1] == 'X')
) { // leading 0x/0X
) { // leading 0x/0X
int i = start + 2;
if (i == sz) {
// str == "0x"
......@@ -1021,4 +1047,5 @@ public class StringHelper {
return from;
}
}
......@@ -485,7 +485,7 @@ public abstract class BaseDaoSql {
// 进行SQL语句参数替换,后面增加一个空格,方便后续用正则表达式进行替换处理
sql = sql.replaceFirst("\\?", "@" + field.paraName + " ");
}
if (isCond && StringHelper.isEmpty(val)) {
if (isCond && (StringHelper.isEmpty(val) || StringHelper.isEmptyArray(val))) {
continue;
}
}
......@@ -566,8 +566,7 @@ public abstract class BaseDaoSql {
List list;
// 判断处理
boolean isList = val instanceof List;
if (isList) {
if (val instanceof List) {
list = (List) val;
} else {
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