AI助手支持GPT4.0
public void batchInsertRebateExclue(List<MDMS_A_CONTRACT_REBATE_EXCLUDE> entityList) {
String sql = "INSERT INTO xxxx(series, tenant_num_id, data_sign,meeting_num_id,item_num_id) VALUES (?, ?, ?, ?, ?)";
//总页数
int pageNum=new BigDecimal(String.valueOf(MathUtil.divide(entityList.size(), PAGE_SIZE, 4)))
.setScale(0, BigDecimal.ROUND_CEILING).intValue();
//分页批量插入
for (int i =1; i <=pageNum; i++) {
List<MDMS_A_CONTRACT_REBATE_EXCLUDE> pageList=entityList.stream()
.skip(PAGE_SIZE * (i - 1))
.limit(PAGE_SIZE).collect(Collectors.toList());
jdbcTemplate.batchUpdate(
sql,
pageList.stream()
.map(entity -> new Object[]{
SeqUtil.getNoSubSequence(SeqUtil.MDMS_A_CONTRACT_REBATE_EXCLUDE_SERIES),
entity.getTENANT_NUM_ID(),
entity.getDATA_SIGN(),
entity.getMEETING_NUM_ID(),
entity.getITEM_NUM_ID()
}).collect(Collectors.toList())
);
}
}