日期:2014-05-16 浏览次数:20767 次
<insert id="insert" parameterType="com.Test" >
insert into test(id, username)
values (#{id,jdbcType=INTEGER},#{username,jdbcType=VARCHAR})
<selectKey keyProperty="id" resultType="int" order="AFTER">
select LAST_INSERT_ID()
</selectKey>
</insert>
public void saveTest(Test test){
this.testMapper.insert(test);//运用mybatis自有接口来新增。
int id = test.getId();//id值为新增的主键值。
}