1.自增主键id的获取
<!--数据插入,获取增长后的主键id-->
<selectKey keyProperty="id" resultType="int" order="AFTER">
select LAST_INSERT_ID()
</selectKey>
insert into user (username,sex,birthday,address)
value (#{
username},#{
sex},#{
birthday},#{
address})
</insert>
2.resultMap的使用
<!--设置返回数据为resultMap-->
<resultMap id="userResultMap" type="user">
<!-- property中对应是包装类中的属性变量; column中对应的是数据空中的列名-->
<id property="id" column="id_">