以下两种方式实现 主键回掉方式。

   <!--添加用户信息:主键回调-->
    <insert >
        INSERT INTO `user`(`userName`,`userPwd`,`realName`)
        VALUES(#{userName},#{userPwd},#{realName})
    </insert>
<!--添加用户信息:主键回调(select @@identity)--> <insert > <selectKey resultType="Integer" keyProperty="uId" order="AFTER"> SELECT LAST_INSERT_ID() </selectKey> INSERT INTO `user`(`userName`,`userPwd`,`realName`) VALUES(#{userName},#{userPwd},#{realName}) </insert>

uId 为实体类主键字段。

 

相关文章:

  • 2021-11-23
  • 2021-06-29
  • 2022-12-23
  • 2022-03-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-28
猜你喜欢
  • 2021-10-25
  • 2021-11-28
  • 2021-08-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-16
相关资源
相似解决方案