@Autowired private NamedParameterJdbcTemplate namedParameterJdbcTemplate;

 public void batchUpdate(List<User> list) {

    if(CollectionUtils.isNotEmpty(list)) {
          String sql = "INSERT INTO USER (NAME, TEL, ADDR) VALUES( :name, :tel, :addr)";
      SqlParameterSource[] batchArgs = SqlParameterSourceUtils.createBatch(list.toArray());
      nameJdbcTemplateOracle.batchUpdate(sql, batchArgs);   
    }
    
  }



@lombok.Data
public class SupStoreInfo{
  private String name;
    
  private String tel;

  private String addr;
}

文章標籤

咪卡恰比 發表在 痞客邦 留言(0) 人氣()