<?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.channel.mapper.KuaishouChannelCreateStrategyMapper">

    <select id="queryAllIdByAccountId" resultType="java.lang.Long">
        SELECT id
        FROM (SELECT id
              FROM ctop_kuaishou_channel_create_strategy
              WHERE account_id = #{accountId}
              UNION ALL
              SELECT id
              FROM ctop_kuaishou_channel_create_strategy
              WHERE project_id = (SELECT project_id FROM ctop_user_allocation WHERE account_id = #{accountId})) t
        GROUP BY t.id
    </select>

</mapper>