Commit 49e22e2c authored by yanzg's avatar yanzg

身份证识别

parent d8109d6e
......@@ -118,6 +118,27 @@ public class ArrayHelper {
}
return list;
}
/**
* 获取对象为对象列表
*
* @param val 需要获取的对象,可以为List或者Array或者其他对象.
* @return
*/
public static List getCollection(Object val) {
boolean isArray = isArrayOrList(val);
List list;
// 判断处理
if (val instanceof List) {
list = (List) val;
} else if (isArray) {
Object[] arr = (Object[]) val;
list = Arrays.asList(arr);
} else {
list = new ArrayList();
list.add(val);
}
return list;
}
/**
* 将数组添加到列表中
......
......@@ -735,13 +735,13 @@ public abstract class BaseDaoSql {
* @return 获取包含列表的SQL语句的值
*/
private String getListSql(List<Object> paras, String sql, String name, Object val) {
List list = ArrayHelper.getList(val);
Collection list = ArrayHelper.getCollection(val);
int length = list.size();
// 进行循环
StringBuilder sb = new StringBuilder();
for (int i = 0; i < length; i++) {
Object item = list.get(i);
int i = 0;
for (Object item : list) {
// 判断列表是否为常规对象
if (item == null || item instanceof Number || item.getClass().isEnum() || item instanceof String || item instanceof Date) {
addArrayIn(paras, sb, i, item);
......@@ -750,6 +750,7 @@ public abstract class BaseDaoSql {
} else {
addArrayTable(paras, sb, i, item);
}
i++;
}
// 生成最终的SQL语句
......
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