<?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="rptAdvertiserHourSqlMapper">
	
	<select id="findEveryHourData" parameterType="map" resultType="com.cloudcross.ssp.model.RptAdvertiserHour">
		select hour,sum(impression) as impression,sum(click) as click,sum(visit) as visit, sum(conversion) as conversion, sum(ecpm) as ecmp,sum(consume) as consume
		from t_rpt_advertiser_hour where  date = #{startDate}
		<if test="advertiserId!=null">
        	and advertiser_id = #{advertiserId}
        </if>   
        <if test="campaignId!=null">
        	and campaign_id = #{campaignId}
        </if>     
        <if test="adgroupId!=null">
        	and adgroup_id = #{adgroupId}
        </if>    
        <if test="bannerId!=null">
        	and banner_id = #{bannerId}
        </if>    
		group by hour
	</select>

</mapper>