调整依赖及被移除的方法涉及测试用例

This commit is contained in:
hubin 2024-10-14 22:27:57 +08:00
parent b1243a36fb
commit e8c003994f
5 changed files with 7 additions and 19 deletions

View File

@ -1,7 +1,7 @@
dependencies {
api project(":mybatis-plus-core")
api project(":mybatis-plus-annotation")
api project(":mybatis-plus-extension")
api project(":mybatis-plus-spring")
api "${lib.mybatis}"
api "${lib.'jsqlparser'}"

View File

@ -667,11 +667,6 @@ class H2UserTest extends BaseTest {
userService.removeById(h2User, true);
userService.removeById(h2User, false);
userService.removeBatchByIds(Arrays.asList(1L, 2L, h2User));
userService.removeBatchByIds(Arrays.asList(1L, 2L, h2User), 2);
userService.removeBatchByIds(Arrays.asList(1L, 2L, h2User), true);
userService.removeBatchByIds(Arrays.asList(1L, 2L, h2User), false);
userService.removeBatchByIds(Arrays.asList(1L, 2L, 3, "3", h2User), 2, true);
userService.removeBatchByIds(Arrays.asList(1L, 2L, h2User), 2, false);
}
@Test

View File

@ -1,6 +1,5 @@
package com.baomidou.mybatisplus.test.h2.cache.service.impl;
import com.baomidou.mybatisplus.core.enums.SqlMethod;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.test.h2.cache.mapper.CacheMapper;
import com.baomidou.mybatisplus.test.h2.cache.model.CacheModel;
@ -8,18 +7,11 @@ import com.baomidou.mybatisplus.test.h2.cache.service.ICacheService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Collection;
import java.util.Collections;
@Service
public class CacheServiceImpl extends ServiceImpl<CacheMapper, CacheModel> implements ICacheService {
//手动撸一个批量删除.
private void removeBatchById(Collection<Long> idList) {
String sqlStatement = sqlStatement(SqlMethod.DELETE_BY_ID);
executeBatch(idList, (sqlSession, id) -> sqlSession.delete(sqlStatement, id));
}
@Override
@Transactional
public long testBatchTransactionalClear1() {
@ -66,7 +58,7 @@ public class CacheServiceImpl extends ServiceImpl<CacheMapper, CacheModel> imple
public long testBatchTransactionalClear5() {
CacheModel model = new CacheModel("靓仔");
save(model);
removeBatchById(Collections.singletonList(model.getId()));
removeBatchByIds(Collections.singletonList(model.getId()));
removeById(model.getId());
return model.getId();
}
@ -76,7 +68,7 @@ public class CacheServiceImpl extends ServiceImpl<CacheMapper, CacheModel> imple
public long testBatchTransactionalClear6() {
CacheModel model = new CacheModel("靓仔");
save(model);
removeBatchById(Collections.singletonList(model.getId()));
removeBatchByIds(Collections.singletonList(model.getId()));
return model.getId();
}
@ -86,7 +78,7 @@ public class CacheServiceImpl extends ServiceImpl<CacheMapper, CacheModel> imple
CacheModel model = new CacheModel("靓仔");
save(model);
updateBatchById(Collections.singletonList(new CacheModel(model.getId(), "旺仔")));
removeBatchById(Collections.singletonList(model.getId()));
removeBatchByIds(Collections.singletonList(model.getId()));
return model.getId();
}
}

View File

@ -13,6 +13,8 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
/**
* @author miemie
* @since 2021-03-16

View File

@ -1,8 +1,7 @@
dependencies {
api project(":mybatis-plus-spring")
implementation project(":mybatis-plus")
implementation "${lib."mybatis-spring"}"
implementation "${lib."mybatis-spring"}"
implementation "org.springframework.boot:spring-boot-autoconfigure:${springBootVersion}"
implementation "org.springframework.boot:spring-boot-starter-jdbc:${springBootVersion}"
annotationProcessor "org.springframework.boot:spring-boot-configuration-processor:${springBootVersion}"