在插入数据时候想自动返回mysql的自增的主键,需要在mapper.xml中配置下;
<insert id="insert" parameterType="com.rograndec.wdzs.admin.data.wdzs.entity.ProductCategoryEntity" useGeneratedKeys="true" keyProperty="id" > insert into product_category (id, parent_id, cate_name, sort_order, is_parent, created_at, updated_at) values (#{id,jdbcType=INTEGER}, #{parentId,jdbcType=INTEGER}, #{cateName,jdbcType=VARCHAR}, #{sortOrder,jdbcType=INTEGER}, #{isParent,jdbcType=BIT}, now(), now())</insert>相关链接: https://blog.csdn.net/sinat_30474567/article/details/51395247
原文地址:https://www.cnblogs.com/fengli9998/p/9089685.html
时间: 2024-10-01 06:52:49