<?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.ytpm.dao.PlacementMapper">
    <insert id="addOne">
        insert into yt_app_placement
        (
         placement_id,
         placement_name,
         app_id,
         app_name,
         network_app_id,
         network_app_name,
         status,
         remark,
         ad_format
        )
        values
        (
         #{placementId},
         #{placementName},
         #{appId},
         #{appName},
         #{networkAppId},
         #{networkAppName},
         #{status},
         #{remark},
         #{adFormat}
        )
    </insert>
    <update id="updateOne">
        update yt_app_placement
        <set>
            <if test="placementName != null">
                placement_name = #{placementName},
            </if>
            <if test="appId != null">
                app_id = #{appId},
            </if>
            <if test="appName != null">
                app_name = #{appName},
            </if>
            <if test="networkAppId != null">
                network_app_id = #{networkAppId},
            </if>
            <if test="networkAppName != null">
                network_app_name = #{networkAppName},
            </if>
            <if test="status != null">
                `status` = #{status},
            </if>
            <if test="remark != null">
                remark = #{remark},
            </if>
            <if test=" adFormat!= null">
                ad_format = #{adFormat},
            </if>
        </set>
        where placement_id = #{placementId}
    </update>
    <delete id="deleteOne">
        delete from yt_app_placement where placement_id = #{placementId}
    </delete>

    <select id="selectList" resultType="com.ytpm.agent.view.AgentPlacementView">
        select
            placement_id, placement_name, app_id, app_name, network_app_id, network_app_name, status, remark,ad_format,platform appType
        from yt_app_placement
    </select>
</mapper>