public void afterWrite(List<? extends AwardWait> list) {
final List<? extends AwardWait> listNew=list;
String sqlMid="delete from tb_b_hebao_award_import_middle where partition_id=? and batch_sn=? and import_id=?";
BatchPreparedStatementSetter setterMid = new BatchPreparedStatementSetter(){
public int getBatchSize(){
return listNew.size();
}
public void setValues(PreparedStatement ps,int i){
AwardWait awardWait = listNew.get(i);
try{
ps.setString(1, awardWait.getPartition_id().toString());
ps.setLong(2, awardWait.getBatch_sn());
ps.setLong(3, awardWait.getImport_id());
if(i%500==0)
{
ps.executeBatch();
}
}catch(Exception e){
logger.error("batchInsertWaitAward Exception:",e);
}
}
};
jdbcTemplate.batchUpdate(sqlMid, setterMid);
}