jdbcTemplate批量插入
public boolean insertShopsInfo(List<Shops> list){
final List<Shops> shopsList = list;
String sql="INSERT INTO WEBSITE_MALL (NAME,HIGHT,MALL_INFO,OPRATION_BTIME ,OPRATION_ETIME,BELONG_TO,ADDRESS,VECTOR,FLOOR,FLOOR_IFNO,REMARK,UPDATE_DATE) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)";
this.getJdbcTemplate().batchUpdate(sql, new BatchPreparedStatementSetter(){
public void setValues(PreparedStatement ps,int i)throws SQLException
{
String name=shopsList.get(i).getName();
String hight = shopsList.get(i).getHight();
String mall_info = shopsList.get(i).getMall_info();
Date opration_btime = shopsList.get(i).getOpration_btime();
Date opration_etime = shopsList.get(i).getOpration_etime();
String belong_to = shopsList.get(i).getBelong_to();
String address = shopsList.get(i).getAddress();
String vector = shopsList.get(i).getVector();
String floor = shopsList.get(i).getFloor();
String floor_ifno = shopsList.get(i).getFloor_ifno();
String remark = shopsList.get(i).getRemark();
Date update_date = shopsList.get(i).getUpdate_date();
ps.setString(1, name);
ps.setString(2, hight);
ps.setString(2, mall_info);
ps.setDate(4, (java.sql.Date)opration_btime);
ps.setDate(5, (java.sql.Date)opration_etime);
ps.setString(6, belong_to);
ps.setString(7, address);
ps.setString(8, vector);
ps.setString(9, floor);
ps.setString(10, floor_ifno);
ps.setString(11, remark);
ps.setDate(12, (java.sql.Date)update_date);
}
public int getBatchSize()
{
return shopsList.size();