Skip to content

Commit a764404

Browse files
committed
更新主键生成器.
1 parent da03775 commit a764404

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/content/docs/guides/sql-injector.mdx

+2-1
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,9 @@ public class MysqlInsertAllBatch extends AbstractMethod {
8484
.collect(Collectors.joining(",")) + ")";
8585
String valuesScript = SqlScriptUtils.convertForeach(value, "list", null, ENTITY, COMMA);
8686
SqlSource sqlSource = super.createSqlSource(configuration, "<script>" + sql + valuesScript + "</script>", modelClass);
87+
KeyGenerator keyGenerator = tableInfo.getIdType() == IdType.AUTO ? Jdbc3KeyGenerator.INSTANCE : NoKeyGenerator.INSTANCE;
8788
// 第三个参数必须和baseMapper的自定义方法名一致
88-
return this.addInsertMappedStatement(mapperClass, modelClass, this.methodName, sqlSource, new NoKeyGenerator(), null, null);
89+
return this.addInsertMappedStatement(mapperClass, modelClass, this.methodName, sqlSource, keyGenerator,tableInfo.getKeyProperty(), tableInfo.getKeyColumn());
8990
}
9091
}
9192
```

0 commit comments

Comments
 (0)