1. 程式人生 > >分批次插入資料程式碼

分批次插入資料程式碼

如果DATAS != && DATAS 大小()> 0 ){
 INT 大小= DATAS size ();
int commitCount = baseConstant getCountPreCommit ();
int lastIndex = 0 ;
for int i = 0 ; i <= size / commitCount ; i ++ ){
                        if (i == (size/commitCount)){
            lastIndex = size;
        }else {
            
lastIndex = commitCount*(i+1); } if (!datas.subList(commitCount*i, lastIndex).isEmpty()){ fileDataMapper.batchSaveFileData(datas.subList(commitCount*i, lastIndex)); } } }