|
@@ -169,11 +169,11 @@ public final class SqlHelper {
|
|
|
*/
|
|
|
@Deprecated
|
|
|
public static boolean executeBatch(Class<?> entityClass, Log log, Consumer<SqlSession> consumer) {
|
|
|
- return executeBatch(sqlSessionFactory(entityClass), entityClass, log, consumer);
|
|
|
+ return executeBatch(sqlSessionFactory(entityClass), log, consumer);
|
|
|
}
|
|
|
|
|
|
@SneakyThrows
|
|
|
- public static boolean executeBatch(SqlSessionFactory sqlSessionFactory, Class<?> entityClass, Log log, Consumer<SqlSession> consumer) {
|
|
|
+ public static boolean executeBatch(SqlSessionFactory sqlSessionFactory, Log log, Consumer<SqlSession> consumer) {
|
|
|
SqlSessionHolder sqlSessionHolder = (SqlSessionHolder) TransactionSynchronizationManager.getResource(sqlSessionFactory);
|
|
|
boolean transaction = TransactionSynchronizationManager.isSynchronizationActive();
|
|
|
if (sqlSessionHolder != null) {
|
|
@@ -219,16 +219,16 @@ public final class SqlHelper {
|
|
|
* @param <E> T
|
|
|
* @return 操作结果
|
|
|
* @since 3.4.0
|
|
|
- * @deprecated {@link #executeBatch(SqlSessionFactory, Class, Log, Collection, int, BiConsumer)}
|
|
|
+ * @deprecated {@link #executeBatch(SqlSessionFactory, Log, Collection, int, BiConsumer)}
|
|
|
*/
|
|
|
@Deprecated
|
|
|
public static <E> boolean executeBatch(Class<?> entityClass, Log log, Collection<E> list, int batchSize, BiConsumer<SqlSession, E> consumer) {
|
|
|
- return executeBatch(sqlSessionFactory(entityClass), entityClass, log, list, batchSize, consumer);
|
|
|
+ return executeBatch(sqlSessionFactory(entityClass), log, list, batchSize, consumer);
|
|
|
}
|
|
|
|
|
|
- public static <E> boolean executeBatch(SqlSessionFactory sqlSessionFactory, Class<?> entityClass, Log log, Collection<E> list, int batchSize, BiConsumer<SqlSession, E> consumer) {
|
|
|
+ public static <E> boolean executeBatch(SqlSessionFactory sqlSessionFactory, Log log, Collection<E> list, int batchSize, BiConsumer<SqlSession, E> consumer) {
|
|
|
Assert.isFalse(batchSize < 1, "batchSize must not be less than one");
|
|
|
- return !CollectionUtils.isEmpty(list) && executeBatch(sqlSessionFactory, entityClass, log, sqlSession -> {
|
|
|
+ return !CollectionUtils.isEmpty(list) && executeBatch(sqlSessionFactory, log, sqlSession -> {
|
|
|
int size = list.size();
|
|
|
int idxLimit = Math.min(batchSize, size);
|
|
|
int i = 1;
|