public int[] sendSMS(final List<SmsMtSwapBean> beanList) throws DAOException {
int []flag = null;
String sql = " insert into sms_mt_swap t (t.id, t.msg_content, t.fee_terminal_id, t.dest_terminal_id, t.sp_code, t.service_id, t.fee_type, t.fee, t.recive_report, t.msg_format, t.request_time, t.biz_id,t.opt_code,t.priority) "
+ " values (SEQ_SMS_MT_SWAP.NEXTVAL,?,?,?,'10086','FREE','0','0','0','15',?,'ydzd','1','1') ";
BatchPreparedStatementSetter setter=new BatchPreparedStatementSetter (){
public void setValues(PreparedStatement ps,int i) throws SQLException{
SmsMtSwapBean formBean = beanList.get(i);
ps.setString(1,formBean.getMsgContent());
ps.setString(2, formBean.getFeeTerminalId());
ps.setString(3, formBean.getDestTerminalId());
ps.setString(4, formBean.getRequestTime());
}
public int getBatchSize(){
return beanList.size();
}
};
flag = this.getJdbcTemplate().batchUpdate(sql,setter);
return flag;
}
spring 批量操作