浏览代码

调整bom依赖修改Insert忽略自增注入Bug

hubin 1 年之前
父节点
当前提交
b21758ac8c

+ 6 - 2
mybatis-plus-bom/build.gradle

@@ -13,11 +13,15 @@ apply plugin: "io.spring.dependency-management"
 dependencyManagement {
     dependencies {
         dependency "com.baomidou:mybatis-plus-annotation:${APP_VERSION}"
-        dependency "com.baomidou:mybatis-plus-boot-starter:${APP_VERSION}"
-        dependency "com.baomidou:mybatis-plus-boot-starter-test:${APP_VERSION}"
         dependency "com.baomidou:mybatis-plus-core:${APP_VERSION}"
         dependency "com.baomidou:mybatis-plus-extension:${APP_VERSION}"
         dependency "com.baomidou:mybatis-plus-generator:${APP_VERSION}"
+        dependency "com.baomidou:mybatis-plus-boot-starter:${APP_VERSION}"
+        dependency "com.baomidou:mybatis-plus-boot-starter-test:${APP_VERSION}"
+        dependency "com.baomidou:mybatis-plus-spring-boot-autoconfigure:${APP_VERSION}"
+        dependency "com.baomidou:mybatis-plus-spring-boot-test-autoconfigure:${APP_VERSION}"
+        dependency "com.baomidou:mybatis-plus-spring-boot3-starter:${APP_VERSION}"
+        dependency "com.baomidou:mybatis-plus-spring-boot3-starter-test:${APP_VERSION}"
 
     }
 }

+ 1 - 1
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/metadata/TableInfo.java

@@ -373,7 +373,7 @@ public class TableInfo implements Constants {
      */
     public String getAllInsertSqlColumnMaybeIf(final String prefix, boolean ignoreAutoIncrementColumn) {
         final String newPrefix = prefix == null ? EMPTY : prefix;
-        if (ignoreAutoIncrementColumn) {
+        if (ignoreAutoIncrementColumn && idType == IdType.AUTO) {
             return fieldList.stream().map(i -> i.getInsertSqlColumnMaybeIf(newPrefix))
                 .filter(Objects::nonNull).collect(joining(NEWLINE));
         }

+ 1 - 1
settings.gradle

@@ -25,7 +25,7 @@ include 'spring-boot-starter'
 include ':spring-boot-starter:mybatis-plus-boot-starter'
 include ':spring-boot-starter:mybatis-plus-boot-starter-test'
 include ':spring-boot-starter:mybatis-plus-spring-boot-autoconfigure'
+include ':spring-boot-starter:mybatis-plus-spring-boot-test-autoconfigure'
 include ':spring-boot-starter:mybatis-plus-spring-boot3-starter'
 include ':spring-boot-starter:mybatis-plus-spring-boot3-starter-test'
-include ':spring-boot-starter:mybatis-plus-spring-boot-test-autoconfigure'