<?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.batch.mapper.KuaiShouImageGetMapper">

    <insert id="replaceBatch">
        replace into ctop_kuaishou_image_get(
        id,
        account_id,
        `url`,
        `width`,
        `height`,
        `size`,
        `format`,
        material_type,
        signature,
        image_token,
        stat_date,
        create_time,
        update_time
        )
        values
        <foreach collection="images" item="image" separator=",">
            (
            #{image.id},
            #{image.accountId},
            #{image.url},
            #{image.width},
            #{image.height},
            #{image.size},
            #{image.format},
            #{image.materialType},
            #{image.signature},
            #{image.imageToken},
            #{image.statDate},
            #{image.createTime},
            #{image.updateTime}
            )
        </foreach>
    </insert>

    <select id="getUrlByCode" resultType="java.lang.String">
        select url
        from ctop_material_image_info
        where code = #{signature} limit 1
    </select>

    <select id="getUrlByImageTokens" resultType="cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouImageGet">
        select * from ctop_kuaishou_image_get
        where account_id = #{accountId}
        And image_token in
        <foreach collection="imageTokens" item="item" separator=","
                 open="(" close=")">
            #{item}
        </foreach>
    </select>

    <select id="getCutFrameUrlByCode" resultType="java.lang.String">
        select url
        from ctop_material_cut_frame
        where signature = #{signature} limit 1
    </select>


</mapper>
