Browse Source

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

hubin 6 tháng trước cách đây
mục cha
commit
e8c003994f

+ 1 - 1
mybatis-plus/build.gradle

@@ -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'}"

+ 0 - 5
mybatis-plus/src/test/java/com/baomidou/mybatisplus/test/h2/H2UserTest.java

@@ -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

+ 3 - 11
mybatis-plus/src/test/java/com/baomidou/mybatisplus/test/h2/cache/service/impl/CacheServiceImpl.java

@@ -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();
     }
 }

+ 2 - 0
mybatis-plus/src/test/java/com/baomidou/mybatisplus/test/sqlrunner/SqlRunnerTest.java

@@ -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

+ 1 - 2
spring-boot-starter/mybatis-plus-spring-boot-autoconfigure/build.gradle

@@ -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}"