File tree 1 file changed +25
-0
lines changed
1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -137,6 +137,31 @@ Mapper3接口有两种形式,一种是提供了一个方法的接口。还有
137
137
继承方法:` int insertUseGeneratedKeys(T record); ` <br >
138
138
说明:该接口不包含方法,继承了special中的` InsertListMapper<T> ` 和` InsertUseGeneratedKeysMapper<T> ` <br ><br >
139
139
140
+ ##SqlServer专用
141
+
142
+ 由于sqlserver中插入自增主键时,不能使用` null ` 插入,不能在insert语句中出现` id ` 。
143
+
144
+ 注意SqlServer的两个特有插入方法都使用了
145
+
146
+ ` @Options(useGeneratedKeys = true, keyProperty = "id") `
147
+
148
+ 这就要求表的主键为` id ` ,且为自增,如果主键不叫` id ` 可以看高级教程中的解决方法。
149
+
150
+ 另外这俩方法和<b >base</b >中的插入方法重名,不能同时存在!
151
+
152
+ 如果某种数据库和SqlServer这里类似,也可以使用这些接口(需要先测试)。
153
+
154
+ 接口:` InsertMapper `
155
+ 方法:` int insert(T record); `
156
+ 说明:插入数据库,` null ` 值也会插入,不会使用列的默认值
157
+
158
+ 接口:` InsertSelectiveMapper `
159
+ 方法:` int insertSelective(T record); `
160
+ 说明:插入数据库,不插入` null ` 的字段
161
+
162
+ 接口:` SqlServerMapper `
163
+ 说明:这是上面两个接口的组合接口。
164
+
140
165
##Mapper<T >接口
141
166
142
167
接口:` Mapper<T> ` <br >
You can’t perform that action at this time.
0 commit comments