<?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.KuaishouStrategyMapper">
    <select id="queryPlanIdsByStrategyId" parameterType="java.util.Map" resultType="com.alibaba.fastjson.JSONObject">
         select
          account_id as accountId,
          campaign_id as campaignId,
          unit_id as unitId,
          creative_id as creativeId
          from ctop_ai_kuaishou_strategy_map_creative
         where strategy_id = #{id}
    </select>

    <select id="queryActiveAccount" resultType="java.lang.Long">
        SELECT account_id FROM ctop_ai_kuaishou_advertiser_strategy
        WHERE timer_task_status = 1
        GROUP BY account_id
    </select>

    <select id="queryShouTaoAccounts" resultType="java.lang.Long">
        select t1.account_id from ctop_ai_kuaishou_advertiser_strategy t1
        LEFT JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
        where t2.project_id = 458
        AND t1.status = 1
    </select>
</mapper>
