赞
踩
<!--
<selectKey>标签的参数详解:
keyProperty: users对象的哪个属性来接收返回的主键值
resultType:返回的主键的类型
Order:指定生成返回主键的时机:AFTER:先插入再返回主键
BEFORE: 先生成再完成插入
-->
<insert id="insert" parameterType="users" >
<selectKey keyProperty="id" resultType="int" order="AFTER">
select last_insert_id()
</selectKey>
insert into users (username, birthday, sex, address) values(#{userName},#{birthday},#{sex},#{address})
</insert>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。