方式1
@SelectKey(statement="select LAST_INSERT_ID()", keyProperty="id", before=false, resultType=int.class)
public int insert(GenTemplate entity);
方式2
<insert id="save">
//注意keyProperty 与类中的id属性名称要一致
<selectKey keyProperty="fileId" resultType="int" order="AFTER">
//此处为mysql的函数
select LAST_INSERT_ID()
</selectKey>
insert into table_name
(...)
values
(...)
</insert>