select id, live_id,user_id, msg_status, online, create_time, create_by, update_by, update_time, remark,online_seconds,global_visible,single_visible,live_flag,replay_flag,location from live_watch_user insert into live_watch_user live_id, user_id, msg_status, online, create_time, create_by, update_by, update_time, remark, online_seconds, global_visible, single_visible, live_flag, replay_flag, location, #{liveId}, #{userId}, #{msgStatus}, #{online}, #{createTime}, #{createBy}, #{updateBy}, #{updateTime}, #{remark}, #{onlineSeconds}, #{globalVisible}, #{singleVisible}, #{liveFlag}, #{replayFlag}, #{location}, update live_watch_user live_id = #{liveId}, user_id = #{userId}, msg_status = #{msgStatus}, online = #{online}, create_time = #{createTime}, create_by = #{createBy}, update_by = #{updateBy}, update_time = #{updateTime}, remark = #{remark}, online_seconds = #{onlineSeconds}, global_visible = #{globalVisible}, single_visible = #{singleVisible}, live_flag = #{liveFlag}, replay_flag = #{replayFlag}, location = #{location}, where id = #{id} delete from live_watch_user where id = #{id} delete from live_watch_user where id in #{id} INSERT INTO live_watch_user ( live_id, user_id, live_flag, replay_flag, msg_status, online, location, create_time, update_time ) VALUES ( #{liveId}, #{userId}, #{liveFlag}, #{replayFlag}, #{msgStatus}, #{online}, #{location}, #{createTime}, #{updateTime} ) ON DUPLICATE KEY UPDATE msg_status = VALUES(msg_status), online = VALUES(online), location = VALUES(location), update_time = VALUES(update_time) UPDATE live_watch_user online_seconds = CASE id WHEN #{item.id} THEN #{item.onlineSeconds} ELSE online_seconds END, update_time = CASE id WHEN #{item.id} THEN #{item.updateTime} ELSE update_time END, msg_status = CASE id WHEN #{item.id} THEN #{item.msgStatus} ELSE msg_status END, online = CASE id WHEN #{item.id} THEN #{item.online} ELSE online END, live_flag = CASE id WHEN #{item.id} THEN #{item.liveFlag} ELSE live_flag END, replay_flag = CASE id WHEN #{item.id} THEN #{item.replayFlag} ELSE replay_flag END, location = CASE id WHEN #{item.id} THEN #{item.location} ELSE location END WHERE id IN #{item.id} INSERT INTO live_watch_user ( live_id, user_id, msg_status, online, online_seconds, global_visible, single_visible, live_flag, replay_flag, location, create_time, update_time ) VALUES ( #{item.liveId}, #{item.userId}, #{item.msgStatus}, #{item.online}, #{item.onlineSeconds}, #{item.globalVisible}, #{item.singleVisible}, #{item.liveFlag}, #{item.replayFlag}, #{item.location}, #{item.createTime}, #{item.updateTime} )