<?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.xxl.job.executor.batch.mapper.KuaiShouVideoGetMapper">
    <insert id="replaceBatch">
        replace into ctop_kuaishou_video_get(
        id,
        account_id,
        photo_id,
        width,
        height,
        url,
        cover_url,
        material_type,
        signature,
        update_time
        )
        values
        <foreach collection="videos" item="video" separator=",">
            (
            #{video.id},
            #{video.accountId},
            #{video.photoId},
            #{video.width},
            #{video.height},
            #{video.url},
            #{video.coverUrl},
            #{video.materialType},
            #{video.signature},
            #{video.updateTime}

            )
        </foreach>
    </insert>


    <select id="getVideoList" parameterType="java.util.Map"
            resultType="com.xxl.job.executor.batch.entity.vo.KuaiShouVideoGetVo">
        select
        stat_date as 'statDate',
        photo_id as 'photoId',
        url as 'url',
        cover_url as 'coverUrl',
        signature as 'signature',
        material_type as 'materialType'
        from ctop_kuaishou_video_get
        where account_id = #{accountId}
        and channel_type = #{channelType}
        and material_type = #{materialType}
        and status = 0
        <if test="startDate != null and startDate != '' ">
            and stat_date &gt;= #{startDate}
        </if>
        <if test="endDate != null and endDate != '' ">
            and stat_date &lt;= #{endDate}
        </if>
        group by signature
        order by stat_date desc
    </select>

</mapper>
