@@ -76,16 +76,16 @@ public interface SimpleTableAnnotatedMapper {
76
76
77
77
default QueryExpressionDSL <MyBatis3SelectModelAdapter <Long >>.QueryExpressionAfterFrom countByExample () {
78
78
return SelectDSL .selectWithMapper (this ::count , SqlBuilder .count ())
79
- .from (simpleTable );
79
+ .from (simpleTable );
80
80
}
81
81
82
82
default DeleteDSL <MyBatis3DeleteModelAdapter <Integer >> deleteByExample () {
83
83
return DeleteDSL .deleteFromWithMapper (this ::delete , simpleTable );
84
84
}
85
85
86
86
default int deleteByPrimaryKey (Integer id_ ) {
87
- return deleteByExample ( )
88
- .where (id , isEqualTo (id_ ))
87
+ return DeleteDSL . deleteFromWithMapper ( this :: delete , simpleTable )
88
+ .where (id , isEqualTo (id_ ))
89
89
.build ()
90
90
.execute ();
91
91
}
@@ -127,11 +127,11 @@ default QueryExpressionDSL<MyBatis3SelectModelAdapter<List<SimpleTableRecord>>>.
127
127
}
128
128
129
129
default SimpleTableRecord selectByPrimaryKey (Integer id_ ) {
130
- return selectOne ( SqlBuilder . select ( id .as ("A_ID" ), firstName , lastName , birthDate , employed , occupation )
130
+ return SelectDSL . selectWithMapper ( this :: selectOne , id .as ("A_ID" ), firstName , lastName , birthDate , employed , occupation )
131
131
.from (simpleTable )
132
132
.where (id , isEqualTo (id_ ))
133
133
.build ()
134
- .render ( RenderingStrategy . MYBATIS3 ) );
134
+ .execute ( );
135
135
}
136
136
137
137
default UpdateDSL <MyBatis3UpdateModelAdapter <Integer >> updateByExample (SimpleTableRecord record ) {
@@ -155,14 +155,26 @@ default UpdateDSL<MyBatis3UpdateModelAdapter<Integer>> updateByExampleSelective(
155
155
}
156
156
157
157
default int updateByPrimaryKey (SimpleTableRecord record ) {
158
- return updateByExample (record )
158
+ return UpdateDSL .updateWithMapper (this ::update , simpleTable )
159
+ .set (id ).equalTo (record .getId ())
160
+ .set (firstName ).equalTo (record .getFirstName ())
161
+ .set (lastName ).equalTo (record .getLastName ())
162
+ .set (birthDate ).equalTo (record .getBirthDate ())
163
+ .set (employed ).equalTo (record .getEmployed ())
164
+ .set (occupation ).equalTo (record .getOccupation ())
159
165
.where (id , isEqualTo (record .getId ()))
160
166
.build ()
161
167
.execute ();
162
168
}
163
169
164
170
default int updateByPrimaryKeySelective (SimpleTableRecord record ) {
165
- return updateByExampleSelective (record )
171
+ return UpdateDSL .updateWithMapper (this ::update , simpleTable )
172
+ .set (id ).equalToWhenPresent (record .getId ())
173
+ .set (firstName ).equalToWhenPresent (record .getFirstName ())
174
+ .set (lastName ).equalToWhenPresent (record .getLastName ())
175
+ .set (birthDate ).equalToWhenPresent (record .getBirthDate ())
176
+ .set (employed ).equalToWhenPresent (record .getEmployed ())
177
+ .set (occupation ).equalToWhenPresent (record .getOccupation ())
166
178
.where (id , isEqualTo (record .getId ()))
167
179
.build ()
168
180
.execute ();
0 commit comments