spring JdbcTemplate 查询的list集合数据怎么转为对象
如图,原因是有_用反向生成时变为大小,本人写了个转换工具,但不能强转为对象!用了个笨方法,反射+json,应该会有更好的办法,查看springAPI只说了取到数据是List的,怎么转为对象呢!
有大虾知道的吗?

如图,原因是有_用反向生成时变为大小,本人写了个转换工具,但不能强转为对象!用了个笨方法,反射+json,应该会有更好的办法,查看springAPI只说了取到数据是List的,怎么转为对象呢!
有大虾知道的吗?

解决方案
20
题主要把集合中的数据映射成对象jdbcTemplate本身就提供了这种方法了。
List<DgPdjDayReports> list=this.jdbcTemplate.query(“select * from channel.Dg_Pdj_Day_Report order by p_id desc”,new BeanPropertyRowMapper(DgPdjDayReports .class));
利用query(String sql,RowMapper rowMapper);这个方法就可以了