<?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.KuaiShouAppListMapper">
    <insert id="replaceBatch">
        replace into ctop_kuaishou_app_list(
        account_id,
        app_id,
        url,
        app_version,
        app_name,
        app_icon_url,
        image_token,
        package_name,
        platform,
        return_time,
        app_privacy_url
        )
        values
        <foreach collection="addList" item="appInfo" separator=",">
            (
            #{appInfo.accountId},
            #{appInfo.appId},
            #{appInfo.url},
            #{appInfo.appVersion},
            #{appInfo.appName},
            #{appInfo.appIconUrl},
            #{appInfo.imageToken},
            #{appInfo.packageName},
            #{appInfo.platform},
            #{appInfo.returnTime},
            #{appInfo.appPrivacyUrl}
            )
        </foreach>
    </insert>

    <select id="getAppNames" resultType="cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAppList">
        SELECT account_id,app_id,app_version,app_name,package_name,platform
        FROM ctop_kuaishou_app_list
        WHERE app_id IN
        <foreach collection="appIds" item="item" separator=","
                 open="(" close=")">
            #{item}
        </foreach>
    </select>


    <select id="getAppListByAppId" resultType="cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAppList">
        SELECT *
        FROM ctop_kuaishou_app_list
        WHERE app_id = #{appId}
    </select>

</mapper>