mybatis获取主键id

版权声明: https://blog.csdn.net/thedarkclouds/article/details/82490797

<insert id="insert" parameterType="com.pinyougou.pojo.TbSpecification" >

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

insert into tb_specification (id, spec_name)
values (#{id,jdbcType=BIGINT}, #{specName,jdbcType=VARCHAR})

</insert>


 

猜你喜欢

转载自blog.csdn.net/thedarkclouds/article/details/82490797