myBatis mapper.xml 自动返回主键

来源:互联网 发布:刀塔传奇 源码 编辑:程序博客网 时间:2024/06/17 09:20
<insert id="insert" parameterType="com.App" keyProperty="id" useGeneratedKeys="true">        insert into info (id ,app_code, remark)        values (        #{id,jdbcType=INTEGER}, #{appCode,jdbcType=VARCHAR},#{remark,jdbcType=VARCHAR}        )</insert>
插入记录时,添加红色部分属性,在传入的对象中 会自动保存 id(主键)的值。
id 必须为主键自增长
0 0
原创粉丝点击