通用Mapper中insert和insertSelective方法
区别在于前者会对所有字段进行添加,而后者只对Selective的字段进行插入,代码层会有如下判断
[ ps:在使用insertSelective方法插入时,为防止主键被插入空字符串可主动将其设置为null ]
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 into tb_content_category
id,
parent_id,
name,
status,
sort_order,
is_parent,
created,
updated,
#{id,jdbcType=BIGINT},
#{parentId,jdbcType=BIGINT},
#{name,jdbcType=VARCHAR},
#{status,jdbcType=INTEGER},
#{sortOrder,jdbcType=INTEGER},
#{isParent,jdbcType=BIT},
#{created,jdbcType=TIMESTAMP},
#{updated,jdbcType=TIMESTAMP},