有时候我们需要mybatis获取insert 后的id,现有两种解决方案

 

方案一:

<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
      SELECT LAST_INSERT_ID()
    </selectKey>

  

方案二:

 <insert >

  

再强调一下,AFTER     BEFORE必须大写

 

参考地址:https://blog.csdn.net/hehuihh/article/details/82800739

相关文章:

  • 2021-12-27
  • 2021-10-18
  • 2022-02-08
  • 2022-12-23
  • 2021-11-10
  • 2022-12-23
  • 2022-12-23
  • 2021-09-21
猜你喜欢
  • 2022-12-23
  • 2021-08-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-24
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案