1.根据useGeneratedKeys获取返回值,适用于mysql、sqlserver等数据库:
修改mapper.xml
...
<insert id="addOrder" parameterType="Order" useGeneratedKeys="true" keyProperty="id">
insert into ssm_order (order_message) values (#{orderMessage,jdbcType=VARCHAR})
</insert>
...
网友评论