其实就是多个三个参数:
1.userGenerateKeys=true
2.指定使用对象的那个列作主键
3.指定使用数据库的哪个列作主键
<insert id="insertAndGetId"
useGeneratedKeys="true"
keyProperty="id"
keyColumn="id"
parameterType="com.entity.OrderRefundApply">
insert into mall_order_refund_apply
(order_no ,
refund_apply_type)
values (
#{orderNo},
#{refundApplyType}
)
</insert>
服务调用:直接返回的就是Integer整型
Integer insertAndGetId(OrderRefundApply orderRefundApply);
mybatispuls的insert方法,默认就实现了,这个插件的话可以不用考虑