<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.adx.tracking.storage.mapper.BidEventMapper">

    <insert id="insertOrUpdate">
        INSERT INTO ad_bid_events (
            qk, media, media_trace_id, req_id, bid_id, creative_id, imp_id, tag_id, price,
            show_urls, click_urls, landing_page, app_store_link, package_name,
            media_params, created_at
        ) VALUES (
            #{qk}, #{media}, #{mediaTraceId}, #{reqId}, #{bidId}, #{creativeId},
            #{impId}, #{tagId}, #{price}, #{showUrls}, #{clickUrls}, #{landingPage},
            #{appStoreLink}, #{packageName}, #{mediaParams}, #{createdAt}
        )
        ON DUPLICATE KEY UPDATE
            media = VALUES(media),
            media_trace_id = VALUES(media_trace_id),
            req_id = VALUES(req_id),
            bid_id = VALUES(bid_id),
            creative_id = VALUES(creative_id),
            imp_id = VALUES(imp_id),
            tag_id = VALUES(tag_id),
            price = VALUES(price),
            show_urls = VALUES(show_urls),
            click_urls = VALUES(click_urls),
            landing_page = VALUES(landing_page),
            app_store_link = VALUES(app_store_link),
            package_name = VALUES(package_name),
            media_params = VALUES(media_params)
    </insert>

</mapper>
