sql insert的时候顺便update,on duplicate key update 的用法

    INSERT INTO channel_booking_ixd (
        booking_id,
        task_id,
        task_no,
        latest_leave_time,
        update_time
    )
    VALUES
    <foreach collection="list" item="item" index="index" separator=",">
        (
        #{item.bookingId},
        #{item.taskId},
        #{item.taskNo},
        #{item.latestLeaveTime},
        #{item.updateTime}
        )
    </foreach>
        on duplicate key update
        update_time=VALUES(update_time),
        latest_leave_time = VALUES(latest_leave_time)
</insert>
原文地址:https://www.cnblogs.com/xiaoliu66007/p/13528464.html