return (List<T>) (_list.isEmpty() ? null : _list);
} else {
while (rs.next()) {
t = cls.newInstance();
ReflectUtil ru = new ReflectUtil(t);
ORMConfigBean ormBean = ORMConfigBeanCache.get(cls);
for (Iterator<Property> it = ormBean.getProperty()
.iterator(); it.hasNext();) {
Property p = it.next();
String type = p.getType();
if (type == null)
continue;
// 如果查询出来的字段名字没有,则不进行值注入
boolean flag = false;
for (String col : columns) {
if (col.equalsIgnoreCase(p.getColumn())) {
flag = true;
continue;
}
}
if (!flag)
continue;
Method m = ru.getSetter(p.getName());
if (m == null)
continue;
Object value = rs.getObject(p.getColumn());
if (value == null)
continue;
String v = String.valueOf(value);
if (v == null) {
v = "";
}
if ("int".equalsIgnoreCase(type)
|| "java.lang.Integer".equalsIgnoreCase(type)) {
if ("".equals(v.trim())) {
v = "0";
}
m.invoke(t, Integer.parseInt(v));
} else if ("long".equalsIgnoreCase(type)
|| "java.lang.Long".equalsIgnoreCase(type)) {
if ("".equals(v.trim())) {
v = "0";
}
m.invoke(t, Long.parseLong(v));
} else if ("float".equalsIgnoreCase(type)
|| "java.lang.Float".equalsIgnoreCase(type)) {
if ("".equals(v.trim())) {
v = "0.0";
}
m.invoke(t, Float.parseFloat(v));
} else if ("double".equalsIgnoreCase(type)
|| "java.lang.Double".equalsIgnoreCase(type)) {
if ("".equals(v.trim())) {
v = "0.0";
}
m.invoke(t, Float.parseFloat(v));
} else if ("string".equalsIgnoreCase(type)
|| "java.lang.String".equalsIgnoreCase(type)) {
m.invoke(t, v);
} else if ("boolean".equalsIgnoreCase(type) || "java.lang.Boolean".equalsIgnoreCase(type)){
if ("1".equals(v.trim()) || "true".equals(v.trim())){
m.invoke(t, true);
}else if ("0".equals(v.trim()) || "false".equals(v.trim())){
m.invoke(t, false);
}
} else if ("date".equalsIgnoreCase(type) || "java.sql.Date".equalsIgnoreCase(type) || "java.util.Date".equalsIgnoreCase(type)) {
m.invoke(t, value);
} else if (PropType.ONE_ONE.equalsIgnoreCase(type) || PropType.MANY_ONE.equalsIgnoreCase(type)) {
if ("".equals(v))
continue;
Field field = ru.getField(p.getName());
Class<?> tarClass = field.getType();
String tarFKField = null;
tarFKField = ORMConfigBeanUtil.getIdField(tarClass);