方式一:
<insert id="方法名" useGeneratedKeys="true" keyProperty="自增长主键名">
方式二:
<insert id="方法名">
<selectKey order="ALTER" keyProperty="自增长主键名" resultType>
select @@identity
</selectKey>
</insert>
<insert id="方法名" useGeneratedKeys="true" keyProperty="自增长主键名">
<insert id="方法名">
<selectKey order="ALTER" keyProperty="自增长主键名" resultType>
select @@identity
</selectKey>
</insert>