<insert id="insert" parameterType="cn.e3mall.pojo.TbContentCategory" >
//返回自动生成的主键
<selectKey keyProperty="id" resultType="Long" order="AFTER"> //after指的是执行sql语句后
select last_insert_id()
</selectKey>
insert into tb_content_category (id, parent_id, name,
status, sort_order, is_parent,
created, updated)
values (#{id,jdbcType=BIGINT}, #{parentId,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR},
#{status,jdbcType=INTEGER}, #{sortOrder,jdbcType=INTEGER}, #{isParent,jdbcType=BIT},
#{created,jdbcType=TIMESTAMP}, #{updated,jdbcType=TIMESTAMP})
</insert>
mapper返回自动生成的主键
最新推荐文章于 2024-08-12 06:00:00 发布