From 0daf439758c2714bc81955f21a3aaa0e2b1b30a0 Mon Sep 17 00:00:00 2001 From: qi_liang Date: Wed, 14 Aug 2019 21:33:45 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E8=BF=87beanUtil=E7=AE=80=E5=8C=96?= =?UTF-8?q?=E9=83=A8=E5=88=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/org/panda/jdbc/BeanHander.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/panda-jdbc/src/main/java/org/panda/jdbc/BeanHander.java b/panda-jdbc/src/main/java/org/panda/jdbc/BeanHander.java index 21c1491..864b7b6 100644 --- a/panda-jdbc/src/main/java/org/panda/jdbc/BeanHander.java +++ b/panda-jdbc/src/main/java/org/panda/jdbc/BeanHander.java @@ -1,13 +1,16 @@ package org.panda.jdbc; +import org.panda.beans.util.BeanUtil; import org.panda.code.uitl.ReflectionUtil; import org.panda.jdbc.annotation.Column; import org.panda.jdbc.sql.BeanSqlUtil; import java.lang.reflect.Field; +import java.lang.reflect.Method; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; +import java.util.List; /** * @author qi @@ -25,12 +28,13 @@ public class BeanHander implements ResultSetHandler { public Object handler(ResultSet rs) { try { - Object bean = clazz.newInstance(); + Object bean = BeanUtil.instantiateClass(clazz); ResultSetMetaData metadata = rs.getMetaData(); + //数据总数 int coulumnCount = metadata.getColumnCount(); + List fieldList = BeanUtil.getAllField(clazz); - Field [] fields = clazz.getDeclaredFields(); - for (Field f:fields){ + for (Field f:fieldList){ String fieldName = f.getName(); String columnName = BeanSqlUtil.caseToHump(fieldName); try {