清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
public void addUserBean(List<UserBean> list) { final List<UserBean> tempBpplist = list; String sql="insert into user(id,name,isgood)" + " values(?,?,?)"; jdbcTemplateMysql.batchUpdate(sql,new BatchPreparedStatementSetter() { @Override public int getBatchSize() { return tempBpplist.size(); } @Override public void setValues(PreparedStatement ps, int i) throws SQLException { ps.setInt(1, tempBpplist.get(i).getId()); ps.setString(2, tempBpplist.get(i).getName()); ps.setBoolean(3, tempBpplist.get(i).isGood()); } }); }