File tree Expand file tree Collapse file tree 3 files changed +13
-7
lines changed
main/java/org/mybatis/dynamic/sql/insert
test/java/examples/generated/always/spring Expand file tree Collapse file tree 3 files changed +13
-7
lines changed Original file line number Diff line number Diff line change 27
27
import org .mybatis .dynamic .sql .util .AbstractColumnMapping ;
28
28
import org .mybatis .dynamic .sql .util .Buildable ;
29
29
import org .mybatis .dynamic .sql .util .ConstantMapping ;
30
+ import org .mybatis .dynamic .sql .util .MappedColumnMapping ;
30
31
import org .mybatis .dynamic .sql .util .NullMapping ;
31
32
import org .mybatis .dynamic .sql .util .PropertyMapping ;
32
33
import org .mybatis .dynamic .sql .util .RowMapping ;
@@ -48,6 +49,11 @@ public <F> ColumnMappingFinisher<F> map(SqlColumn<F> column) {
48
49
return new ColumnMappingFinisher <>(column );
49
50
}
50
51
52
+ public <F > BatchInsertDSL <T > withMappedColumn (SqlColumn <F > column ) {
53
+ columnMappings .add (MappedColumnMapping .of (column ));
54
+ return this ;
55
+ }
56
+
51
57
@ Override
52
58
public BatchInsertModel <T > build () {
53
59
return BatchInsertModel .withRecords (records )
Original file line number Diff line number Diff line change @@ -26,10 +26,10 @@ public final class GeneratedAlwaysDynamicSqlSupport {
26
26
public static final SqlColumn <String > fullName = generatedAlways .fullName ;
27
27
28
28
public static final class GeneratedAlways extends SqlTable {
29
- public final SqlColumn <Integer > id = column ("id" );
30
- public final SqlColumn <String > firstName = column ("first_name" );
31
- public final SqlColumn <String > lastName = column ("last_name" );
32
- public final SqlColumn <String > fullName = column ("full_name" );
29
+ public final SqlColumn <Integer > id = column ("id" ). withJavaProperty ( "id" ) ;
30
+ public final SqlColumn <String > firstName = column ("first_name" ). withJavaProperty ( "firstName" ) ;
31
+ public final SqlColumn <String > lastName = column ("last_name" ). withJavaProperty ( "lastName" ) ;
32
+ public final SqlColumn <String > fullName = column ("full_name" ). withJavaProperty ( "fullName" ) ;
33
33
34
34
public GeneratedAlways () {
35
35
super ("GeneratedAlways" );
Original file line number Diff line number Diff line change @@ -241,9 +241,9 @@ void testInsertBatch() {
241
241
242
242
BatchInsert <GeneratedAlwaysRecord > batchInsert = insertBatch (records )
243
243
.into (generatedAlways )
244
- .map (id ). toProperty ( "id" )
245
- .map (firstName ). toProperty ( "firstName" )
246
- .map (lastName ). toProperty ( "lastName" )
244
+ .withMappedColumn (id )
245
+ .withMappedColumn (firstName )
246
+ .withMappedColumn (lastName )
247
247
.build ()
248
248
.render (RenderingStrategies .SPRING_NAMED_PARAMETER );
249
249
You can’t perform that action at this time.
0 commit comments