All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.penglecode.mybatis.ex.BatchResultUtils Maven / Gradle / Ivy

Go to download

mybatis的自定义扩展。 版本1.0.0 支持mybatis 3.2|3.3版本 版本1.0.1 支持mybatis 3.4版本

There is a newer version: 1.0.1
Show newest version
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