mybatis插入数据并返回自增Id

上图mybatis的写法,在xxxMapper.xml中:

加入:useGeneratedKeys="true" keyProperty="applyId" keyColumn="apply_id"

<insert >
 insert into dlgl_materiel (apply_id, agent_id, create_account_id,
  create_time, status, remark, 
post_user_id, post_time, post_code,
receiver_address, receiver_user, post_remark
)
values (#{applyId,jdbcType=INTEGER}, #{agentId,jdbcType=VARCHAR}, #{createAccountId,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, #{remark,jdbcType=VARCHAR},
#{postUserId,jdbcType=VARCHAR}, #{postTime,jdbcType=TIMESTAMP}, #{postCode,jdbcType=VARCHAR},
#{receiverAddress,jdbcType=VARCHAR}, #{receiverUser,jdbcType=VARCHAR}, #{postRemark,jdbcType=VARCHAR}
)
</insert>
》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》
这里有件很坑的事,我在网上找这个方法的时候好多人都没有写出来。

就是我以为它回直接返回这个自增的id字段,然后我用一个Integer接收,靠调bug调了半天,才发现它是直接把这个字段返回给传入的对象里
所以使用这个插入方法根本不用东西去接收自增字段,直接调用便可,所要的自增id数据它回返回到传入的对象属性里