<?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="cn.com.ctop.kuaishou.modules.material.mapper.EtlKuaishouVideoInfoMapper">
    <insert id="replaceVideoInfo" parameterType="cn.com.ctop.kuaishou.modules.material.entity.EtlKuaishouVideoInfo">
        replace into ctop_etl_kuaishou_video_info
        <trim prefix="(" suffix=")" suffixOverrides="," >
            <if test="id != null" >
                id,
            </if>
            <if test="videoCode != null" >
                video_code,
            </if>
            <if test="stateDate != null" >
                state_date,
            </if>
            <if test="url != null" >
                url,
            </if>
            <if test="coverUrl != null" >
                cover_url,
            </if>
            <if test="channelType != null" >
                channel_type,
            </if>
            <if test="companyName != null" >
                company_name,
            </if>
            <if test="planId != null" >
                plan_id,
            </if>
            <if test="planName != null" >
                plan_name,
            </if>
            <if test="clipId != null" >
                clip_id,
            </if>
            <if test="clipName != null" >
                clip_name,
            </if>
            <if test="shotId != null" >
                shot_id,
            </if>
            <if test="shotName != null" >
                shot_name,
            </if>
            <if test="designTeamLeaderId != null" >
                design_team_leader_id,
            </if>
            <if test="designTeamLeaderName != null" >
                design_team_leader_name,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides="," >
            <if test="id != null" >
                #{id},
            </if>
            <if test="videoCode != null" >
                #{videoCode},
            </if>
            <if test="stateDate != null" >
                #{stateDate},
            </if>
            <if test="url != null" >
                #{url},
            </if>
            <if test="coverUrl != null" >
                #{coverUrl},
            </if>
            <if test="channelType != null" >
                #{channelType},
            </if>
            <if test="companyName != null" >
                #{companyName},
            </if>
            <if test="planId != null" >
                #{planId},
            </if>
            <if test="planName != null" >
                #{planName},
            </if>
            <if test="clipId != null" >
                #{clipId},
            </if>
            <if test="clipName != null" >
                #{clipName},
            </if>
            <if test="shotId != null" >
                #{shotId},
            </if>
            <if test="shotName != null" >
                #{shotName},
            </if>
            <if test="designTeamLeaderId != null" >
                #{designTeamLeaderId},
            </if>
            <if test="designTeamLeaderName != null" >
                #{designTeamLeaderName},
            </if>
        </trim>
    </insert>

    <select id="getVideoMinDate" resultType="java.lang.String">
        select min(stat_date) from ctop_kuaishou_report_daily_material where signature = #{signature}
    </select>
</mapper>
