Mybatis Insert……on duplicate key update 用法
批量插入Mapper 文件
int insertBatch(List<UserDO> userDo);
<insert id="insertBatch" parameterType="java.util.List">
insert into tb_tablename
(user_id, user_type, user_name, create_time, update_time,
is_delete, operator)
values
<foreach collection="list" item="item" separator=",">
(#{item.userId,jdbcType=VARCHAR}, #{item.userType,jdbcType=TINYINT},
#{item.userName,jdbcType=VARCHAR},
{item.createTime,jdbcType=TIMESTAMP},
#{item.updateTime,jdbcType=TIMESTAMP}, #{item.isDelete,jdbcType=TINYINT},
#{item.operator,jdbcType=VARCHAR})
</foreach>
on duplicate key update