<?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="org.jeecg.modules.bytedance.advertise.mapper.BytedanceImageInfoMapper">

    <insert id="replaceBatch">
        replace into ctop_bytedance_image_info(
        id,
        account_id,
        material_id,
        size,
        width,
        height,
        url,
        format,
        signature,
        image_create_time,
        create_time,
        update_time,image_url)
        values
        <foreach collection="imageInfos" item="imageInfo" separator=",">
            (#{imageInfo.id},
            #{imageInfo.accountId},
            #{imageInfo.materialId},
            #{imageInfo.size},
            #{imageInfo.width},
            #{imageInfo.height},
            #{imageInfo.url},
            #{imageInfo.format},
            #{imageInfo.signature},
            #{imageInfo.imageCreateTime},
            #{imageInfo.createTime},
            #{imageInfo.updateTime},#{imageInfo.imageUrl})
        </foreach>
    </insert>

    <update id="updateImageVerticalType">
        update
            ctop_bytedance_image_info
        set type = 2
        where height &gt; width and type is null
        and (height between 1280 and 2560)  and (width between 720 and 1440);
    </update>
    <update id="updateImageHorizonType">
        update ctop_bytedance_image_info
            set type = 1
        where height &lt; width and type is null
        and (width between 1280 and 2560)  and (height between 720 and 1440)
    </update>
</mapper>
