【JdbcTemplate】批处理batchUpdate

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/ivy_doudou/article/details/85271876
JdbcTemplate.batchUpdate(sqlAdd,new BatchPreparedStatementSetter() {
			  public void setValues(PreparedStatement ps, int i) throws SQLException { 
				  Map<String, Object> map = queryForList.get(i);
					  if(!StringUtils.isEmpty(map)){
						  String checkid=Guid.getGuid();
						  ps.setString(1, checkid);
						  ps.setString(2, modle.getKaohe_year());
						  ps.setString(3, modle.getKaohe_date()==null?null:format.format(modle.getKaohe_date()));ps.setString(4, modle.getKaohe_khqk());
						  ps.setString(5, modle.getKaohe_khdc());ps.setInt(6, modle.getKaohe_dp_yx());
						  ps.setInt(7,  modle.getKaohe_dp_cz());ps.setInt(8, modle.getKaohe_dp_yb());
						  ps.setInt(9,  modle.getKaohe_dp_bcz());ps.setDouble(10,  modle.getKaohe_mzScore());
						  ps.setString(11,  modle.getKaohe_mc());ps.setString(12,  modle.getKaohe_person());
						  ps.setString(13, format1.format(new Date()));ps.setString(14, map.get("basicInfoId")+"");
						  ps.setString(15, map.get("dept_id")+"");ps.setString(16, "ganbu");
						  ps.setString(17, modle.getUser_id());ps.setString(18,"8");
				  }
	              }      
	              //返回更新的结果集条数      
	          public int getBatchSize() {      
	                   return queryForList.size();      
	              }
		  });

猜你喜欢

转载自blog.csdn.net/ivy_doudou/article/details/85271876
今日推荐