其實就是多個三個參數:
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方法,默認就實現了,這個插件的話可以不用考慮