INSERT INTO restaurants (id, name, address, region, latitude, longitude, cuisine_type, price_range, google_place_id, phone, website, business_status, rating, rating_count) VALUES (#{id}, #{name}, #{address}, #{region}, #{latitude}, #{longitude}, #{cuisineType}, #{priceRange}, #{googlePlaceId}, #{phone}, #{website}, #{businessStatus}, #{rating}, #{ratingCount}) UPDATE restaurants SET name = #{name}, address = COALESCE(#{address}, address), region = COALESCE(#{region}, region), latitude = COALESCE(#{latitude}, latitude), longitude = COALESCE(#{longitude}, longitude), cuisine_type = COALESCE(#{cuisineType}, cuisine_type), price_range = COALESCE(#{priceRange}, price_range), google_place_id = COALESCE(#{googlePlaceId}, google_place_id), phone = COALESCE(#{phone}, phone), website = COALESCE(#{website}, website), business_status = COALESCE(#{businessStatus}, business_status), rating = COALESCE(#{rating}, rating), rating_count = COALESCE(#{ratingCount}, rating_count), updated_at = SYSTIMESTAMP WHERE id = #{id} UPDATE restaurants SET name = #{fields.name}, address = #{fields.address}, region = #{fields.region}, cuisine_type = #{fields.cuisine_type}, price_range = #{fields.price_range}, phone = #{fields.phone}, website = #{fields.website}, tabling_url = #{fields.tabling_url}, catchtable_url = #{fields.catchtable_url}, latitude = #{fields.latitude}, longitude = #{fields.longitude}, updated_at = SYSTIMESTAMP, WHERE id = #{id} DELETE FROM restaurant_vectors WHERE restaurant_id = #{id} DELETE FROM user_reviews WHERE restaurant_id = #{id} DELETE FROM user_favorites WHERE restaurant_id = #{id} DELETE FROM video_restaurants WHERE restaurant_id = #{id} DELETE FROM restaurants WHERE id = #{id} INSERT INTO video_restaurants (id, video_id, restaurant_id, foods_mentioned, evaluation, guests) VALUES (#{id}, #{videoId}, #{restaurantId}, #{foods,jdbcType=CLOB}, #{evaluation,jdbcType=CLOB}, #{guests,jdbcType=CLOB}) UPDATE restaurants SET cuisine_type = #{cuisineType} WHERE id = #{id} UPDATE video_restaurants SET foods_mentioned = #{foods,jdbcType=CLOB} WHERE id = #{id}