<?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.report.mapper.BytedanceAccountReportHourlyDwMapper">

    <select id="getReportByParams" resultType="com.alibaba.fastjson.JSONObject">
        SELECT
        stat_datetime as statDate,
        account_id as accountId,
        account_name as authName,
        ${filedAll}
        FROM bytedance_advertiser_report_hourly_dw t1
        WHERE t1.stat_datetime = #{startDate}
        and t1.`hour` &lt;= #{hour}
        AND t1.account_id in
        <foreach item="item" index="index" collection="accountIds"
                 open="(" separator="," close=")">
            #{item}
        </foreach>
        <if test="hasGroupBy == 1">
            group by t1.account_id
        </if>
        order by ${target} ${order}
    </select>
</mapper>