
com.penglecode.mybatis.ex.BatchResultUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mybatis-ex Show documentation
Show all versions of mybatis-ex Show documentation
mybatis的自定义扩展。
版本1.0.0 支持mybatis 3.2|3.3版本
版本1.0.1 支持mybatis 3.4版本
package com.penglecode.mybatis.ex;
import java.util.List;
import org.apache.ibatis.executor.BatchResult;
public class BatchResultUtils {
public static void extractBatchResult(List batchResultList, List currentBatchResults) {
if(currentBatchResults != null && !currentBatchResults.isEmpty()){
for(BatchResult batchResult : currentBatchResults){
int[] updateCounts = batchResult.getUpdateCounts();
if(updateCounts != null && updateCounts.length > 0){
for(int n = 0; n < updateCounts.length; n++){
batchResultList.add(updateCounts[n]);
}
}
}
}
}
public static int[] toPrimitive(List batchResultList) {
int len = batchResultList.size();
int[] updates = new int[len];
for(int i = 0; i < len; i++){
updates[i] = batchResultList.get(i);
}
batchResultList = null;
return updates;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy