to give the primary key is inserted mybatis

<selectKey order="AFTER" resultType="long" keyProperty="id">
    SELECT LAST_INSERT_ID() as id
</selectKey>

id will be set to the object parameter passing, the return value of the insert method is still the number of rows affected.

Guess you like

Origin www.cnblogs.com/xmsx/p/11607227.html