Browse Source

修改创意报表功能

fan.yang@cloudcross.com 9 years ago
parent
commit
3a8e591e99

+ 1895 - 1747
src/main/java/com/cloudcross/ssp/model/mapper/report.sql.xml

@@ -1,1748 +1,1896 @@
-<?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="adReportSqlMapper">
-	
-	<sql id="base_column">
-		id, 
-		advertiser_id as advertiserId,
-		order_id as orderId,
-		campaign_id as campaignId,
-		adgroup_id  as adGroupId,
-		 banner.id as bannerId,
-		t_banner.banner_template_id as bannerTemplateId,
-		t_advertiser.name as advertiserName,
-		t_order.name as orderName,
-		t_campaign.name as campaignName,
-		t_adgroup.name  as adGroupName,
-		t_banner_template.name as bannerName,
-		date as reportDate,
-		request,
-		impression,
-		impressionRate,
-		click,
-		visit,
-		conversion,
-		conversionRate,
-		clickRate,
-		visitRate,
-		conversionRate,
-		ecmp as eCmp,
-		consume,
-		os,
-		location,
-		impressionSum,
-		clickSum,
-		visitSum,
-		conversionSum,
-		eCmpSum,
-		consumeSum,
-		clickRatesum,
-		visitRatesum,
-		conversionRatesum
-		
-	</sql>
-	<sql id="base_column2">
-		id,
-		zone_id as zoneId,
-		pv,
-		uv,
-		width,
-		height,
-		position,
-		os,
-		device,
-		impression,
-		place,
-		click,
-		clickRate,
-		eCpm,
-		income,
-		t_rpt_zone.date as reportDate
-	</sql>
-	
-	<select id="findCountForDeliverEffectAnalysisAdvertiser" parameterType="map" resultType="int">
-		select count(1) from (
-		select b.name advertiserName,c.name orderName,d.name campaignName,e.name adgroupName,g.name bannerName,a.date reportDate,sum(a.impression) as impression,sum(a.click) as click,100*sum(a.click)/sum(a.impression) as clickRate,sum(a.visit) as visit,100*sum(a.visit)/sum(a.click) as visitRate,sum(a.conversion) as conversion,100*sum(a.conversion)/sum(a.visit) as conversionRate,sum(a.ecmp) as ecmp,sum(a.consume) as consume 
-		from t_rpt_advertiser a,t_advertiser b,t_order c,t_campaign d,t_adgroup e,t_banner f,t_banner_template g
-		where a.advertiser_id=b.id and a.order_id=c.id and a.campaign_id=d.id and a.adgroup_id=e.id and a.banner_id=f.id and f.banner_template_id=g.id
-		<if test="advertiserId != null and advertiserId ">
-			and a.advertiser_id = #{advertiserId}
-		</if>
-		<if test="orderId != null and orderId != ''">
-			and a.order_id = #{orderId}
-		</if>
-		<if test="campaginId != null and campaginId != ''">
-			and a.campagin_id = #{campaginId}
-		</if>
-		<if test="adgroupId != null and adgroupId != ''">
-			and a.adgroup_id = #{adgroupId}
-		</if>
-		<if test="startDate != null and startDate != ''and endDate != nul and endDate != ''">
-			and a.date &gt;=#{startDate} and a.date &lt;=#{endDate}
-		</if>
-		<choose>
-			<when test="dimensionStr != null and dimensionStr != ''">
-				GROUP BY ${dimensionStr}
-			</when>
-			<otherwise>
-				group by reportDate order by reportDate desc
-			</otherwise>
-		</choose>
-		) t	
-	</select>
-	<select id="findCountForDeliverEffectAnalysisBack" parameterType="map" resultType="int">
-		select count(1) 
-		from t_rpt_advertiser ad,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template
-           
-        <where>
-	 	    ad.advertiser_id=t_advertiser.id  and  ad.order_id = t_order.id  and ad.campaign_id= t_campaign.id   
-	 	    and  ad.adgroup_id=t_adgroup.id
-            and  ad.banner_id=t_banner.id 
-            and  t_banner.banner_template_id = t_banner_template.id
-	 	   
-			<if test="advertiserId !=null">
-			 and ad.advertiser_id=#{advertiserId}
-			</if>
-			
-			<if test="orderId !=null">
-			 and ad.order_id=#{orderId}
-			</if>
-			  
-		     <if test="campaignId !=null">
-			 and ad.campaign_id=#{campaignId}
-			</if>
-			
-			<if test="adGroupId !=null">
-			 and ad.adgroup_id=#{adGroupId}
-			</if>
-		 
-			<if test="startDate!=null and endDate!=null"> 
-	            and ad.date &gt;= #{startDate} and #{endDate} &gt;=ad.date
-			</if>
-		
-		</where>
-	</select>
-		<select id="findCountForDeliverEffectAnalysisOperator" parameterType="map" resultType="int">
-		select count(date) from ((
-		select distinct date 
-		from t_rpt_zone  
-		<where>
-		operator_id = #{operatorId} and date &gt;= #{startDate} and #{endDate} &gt;=date
-		<if test="zoneId!=null">
-		and zone_id=#{zoneId}
-		</if>
-		</where>
-		) as a)
-	</select>
-	
-		<select id="findCountForLocationAdvertiser" parameterType="map" resultType="int">
-		select count(location) from ( select location
-		from t_rpt_adv_location a, t_advertiser b
-       	<where>	
-       	a.advertiser_id = b.id and a.date &gt;= #{startDate} and #{endDate} &gt;=a.date
-			<if test="advertiserId ==null">
-			 and b.agent_id=#{agentId}
-			</if>
-			<if test="advertiserId != null">
-			and a.advertiser_id = #{advertiserId}	
-			</if>
-			<if test="orderId !=null">
-			 and a.order_id=#{orderId}
-			</if>
-		     <if test="campaignId !=null">
-			 and a.campaign_id=#{campaignId}
-			</if>
-			<if test="adGroupId !=null">
-			 and a.adgroup_id=#{adGroupId}
-			</if>
-		</where>
-		group by a.location
-		) as c
-	</select>
-	
-		<select id="findCountForLocationBack" parameterType="map" resultType="int">
-		select count(1) 
-		from t_rpt_adv_location rl, t_advertiser, t_order, t_campaign, t_adgroup
-        
-       	<where>	
-            rl.advertiser_id = t_advertiser.id  and  rl.order_id =  t_order.id and rl.campaign_id = t_campaign.id  and rl.adgroup_id =  t_adgroup.id
-	 	   	
-			<if test="advertiserId !=null">
-			 and rl.advertiser_id=#{advertiserId}
-			</if>
-			
-			<if test="orderId !=null">
-			 and rl.order_id=#{orderId}
-			</if>
-			  
-		     <if test="campaignId !=null">
-			 and rl.campaign_id=#{campaignId}
-			</if>
-			
-			<if test="adGroupId !=null">
-			 and rl.adgroup_id=#{adGroupId}
-			</if>
-		 
-			<if test="startDate!=null and endDate!=null"> 
-	            and rl.date &gt;= #{startDate} and #{endDate} &gt;=rl.date
-			</if>
-		
-		</where>
-	</select>
-	
-	<select id="findDeliverEffectAnalysis" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
-		select 
-		zone_id as zoneId,date as reportDate,sum(pv) as pv,sum(uv) as uv,sum(impression) as impression,sum(uimpression) as uImpression,
-		sum(uclick) as uClick,
-		100*sum(impression)/sum(pv) as fillRate,
-        sum(click) as click,100* sum(click)/sum(impression) as clickRate,sum(ecpm) as eCpm,sum(income) as income
-		from t_rpt_zone 
-		<where>
-		operator_id = #{operatorId} and date &gt;= #{startDate} and #{endDate} &gt;=date
-		<if test="zoneId!=null">
-		and zone_id=#{zoneId}
-		</if>
-		</where>
-		group by date
-		limit #{pager.offset}, #{pager.limit}
-	</select>
-	
-	<select id="findSum" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
-		select sum(pv) as pv, sum(uv) as uv, sum(impression) as impression, sum(click) as click, sum(income) as income
-		from t_rpt_zone 
-		<where>
-		operator_id = #{operatorId}
-		<if test="zoneId!=null">
-		and zone_id=#{zoneId}
-		</if>
-		<if test="startDate!=null and endDate!=null"> 
-            and date &gt;= #{startDate} and #{endDate} &gt;=date
-		</if>
-		</where>
-	</select>
-	
-    <select id="findCountForOs" parameterType="map" resultType="int">
-		select count(1) 
-		from t_rpt_adv_os ros, t_advertiser, t_order, t_campaign, t_adgroup        
-        <where>	          
-           ros.advertiser_id = t_advertiser.id  and  ros.order_id =  t_order.id and ros.campaign_id = t_campaign.id  and ros.adgroup_id =  t_adgroup.id
-	 	   
-			<if test="advertiserId !=null">
-			 and ros.advertiser_id=#{advertiserId}
-			</if>
-			
-			<if test="orderId !=null">
-			 and ros.order_id=#{orderId}
-			</if>
-			  
-		     <if test="campaignId !=null">
-			 and ros.campaign_id=#{campaignId}
-			</if>
-			
-			<if test="adGroupId !=null">
-			 and ros.adgroup_id=#{adGroupId}
-			</if>
-		 
-			<if test="startDate!=null and endDate!=null"> 
-	            and ros.date &gt;= #{startDate} and #{endDate} &gt;=ros.date
-			</if>
-		
-		</where>
-	</select>
-	
-		<select id="findDeliverEffectAnalysis1" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
-		select 
-		zone_id as zoneId,date as reportDate,sum(pv) as pv,sum(uv) as uv,sum(impression) as impression,
-		sum(uimpression) as uImpression,
-		sum(uclick) as uClick,100*sum(impression)/sum(pv) as fillRate,
-        sum(click) as click,100* sum(click)/sum(impression) as clickRate,sum(ecpm) as eCpm,sum(income) as income
-		from t_rpt_zone 
-		<where>
-		operator_id = #{operatorId} and date &gt;= #{startDate} and #{endDate} &gt;=date
-		<if test="zoneId!=null">
-		and zone_id=#{zoneId}
-		</if>
-		</where>
-		group by date
-	</select>
-	
-    <select id="findCountForScene" parameterType="map" resultType="int">
-		select count(1) 
-		from t_rpt_adv_place rp, t_advertiser, t_order, t_campaign, t_adgroup , t_place      
-
-        <where>      
-            rp.place_id = t_place.id and  rp.advertiser_id = t_advertiser.id  
-            and  rp.order_id = t_order.id and rp.campaign_id = t_campaign.id  and rp.adgroup_id =  t_adgroup.id
-			<if test="advertiserId !=null">
-			 and rp.advertiser_id=#{advertiserId}
-			</if>
-			
-			<if test="orderId !=null">
-			 and rp.order_id=#{orderId}
-			</if>
-			  
-		     <if test="campaignId !=null">
-			 and rp.campaign_id=#{campaignId}
-			</if>
-			
-			<if test="adGroupId !=null">
-			 and rp.adgroup_id=#{adGroupId}
-			</if>
-		 
-			<if test="startDate!=null and endDate!=null"> 
-	         and rp.date &gt;= #{startDate} and rp.date &lt;= #{endDate}
-			</if>
-		
-		</where>
-	</select>
-	
-	<select id="countBySize" parameterType="map" resultType="int">
-		 select count(height) from ((select distinct width,height from t_rpt_zone_size where 
-		  date &gt;= #{startDate} and #{endDate} &gt;=date
-		    and operator_id=#{operatorId}
-		 ) as a )
-	</select>
-	
-	 <select id="findByTotalReportAdvertiser" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
-		select b.name advertiserName,c.name orderName,d.name campaignName,e.name adgroupName,g.name bannerName,a.date reportDate,sum(a.impression) as impression,sum(a.click) as click,100*sum(a.click)/sum(a.impression) as clickRate,sum(a.visit) as visit,100*sum(a.visit)/sum(a.click) as visitRate,sum(a.conversion) conversion,100*sum(a.conversion)/sum(a.visit) as conversionRate,sum(a.ecmp) ecmp,sum(a.consume) as consume 
-		from t_rpt_advertiser a,t_advertiser b,t_order c,t_campaign d,t_adgroup e,t_banner f,t_banner_template g
-		where a.advertiser_id=b.id and a.order_id=c.id and a.campaign_id=d.id and a.adgroup_id=e.id and a.banner_id=f.id and f.banner_template_id=g.id
-		<if test="advertiserId != null and advertiserId ">
-			and a.advertiser_id = #{advertiserId}
-		</if>
-		<if test="orderId != null and orderId != ''">
-			and a.order_id = #{orderId}
-		</if>
-		<if test="campaginId != null and campaginId != ''">
-			and a.campagin_id = #{campaginId}
-		</if>
-		<if test="adgroupId != null and adgroupId != ''">
-			and a.adgroup_id = #{adgroupId}
-		</if>
-		<if test="startDate != null and startDate != ''and endDate != nul and endDate != ''">
-			and a.date &gt;=#{startDate} and a.date &lt;=#{endDate}
-		</if>
-		<choose>
-			<when test="dimensionStr != null and dimensionStr != ''">
-				GROUP BY ${dimensionStr}
-			</when>
-			<otherwise>
-				group by reportDate
-			</otherwise>
-		</choose>		
-		limit #{pager.offset}, #{pager.limit}
-	</select>
-	
-<select id="findBySize" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
-		select 
-	    id,date as reportDate,width ,height,100*sum(pv)/(select sum(pv) from t_rpt_zone_size 
-	    where
-            date &gt;= #{startDate} and #{endDate} &gt;=date
-		    and operator_id=#{operatorId}
-		) as viewRate,sum(pv) as pv,sum(uv) as uv,sum(impression) as impression,
-		sum(uimpression) as uImpression, sum(uclick) as uClick,
-		100*impression/pv as fillRate,sum(click) as click,100*sum(click)/sum(impression) as clickRate,sum(ecpm) as eCpm,sum(income) as income
-		from t_rpt_zone_size 
-		where
-            date &gt;= #{startDate} and #{endDate} &gt;=date
-		    and operator_id=#{operatorId}
-		group by width,height
-		order by impression desc
-		limit #{pager.offset}, #{pager.limit}
-	</select>
-	
-	 <select id="findByTotalReportBack" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
-		select 
-		t_advertiser.name as advertiserName,  t_order.name as orderName, t_campaign.name as campaignName, t_adgroup.name  as adGroupName, t_banner_template.name as bannerName, 
-        
-         ad.date as reportDate,     
-        (select sum(t_rpt_advertiser.impression) from  t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
-	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
-            and  t_rpt_advertiser.banner_id=t_banner.id 
-            and  t_banner.banner_template_id = t_banner_template.id 
-
-			<if test="advertiserId !=null">
-			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
-			</if>
-			<if test="orderId !=null">
-			 and t_rpt_advertiser.order_id=#{orderId}
-			</if>
-			  
-		     <if test="campaignId !=null">
-			 and t_rpt_advertiser.campaign_id=#{campaignId}
-			</if>
-			
-			<if test="adGroupId !=null">
-			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
-			</if>
-		 
-	    <if test="startDate!=null and endDate!=null"> 
-            and date &gt;= #{startDate} and #{endDate} &gt;=date
-	    </if>) as impressionSum,ad.impression,ad.click,visit,ad.conversion, 
-        100*ad.click/ad.impression as clickRate ,100*visit/ad.click as visitRate ,100*ad.conversion/visit as conversionRate ,ecmp as eCmp,ad.consume,
-		(select sum(t_rpt_advertiser.click) from t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
-	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
-            and  t_rpt_advertiser.banner_id=t_banner.id 
-            and  t_banner.banner_template_id = t_banner_template.id 
-
-			<if test="advertiserId !=null">
-			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
-			</if>
-			<if test="orderId !=null">
-			 and t_rpt_advertiser.order_id=#{orderId}
-			</if>
-			  
-		     <if test="campaignId !=null">
-			 and t_rpt_advertiser.campaign_id=#{campaignId}
-			</if>
-			
-			<if test="adGroupId !=null">
-			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
-			</if>
-		 
-	    <if test="startDate!=null and endDate!=null"> 
-            and date &gt;= #{startDate} and #{endDate} &gt;=date
-	    </if>) as clickSum, (select sum(t_rpt_advertiser.visit) from t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
-	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
-            and  t_rpt_advertiser.banner_id=t_banner.id 
-            and  t_banner.banner_template_id = t_banner_template.id 
-
-			<if test="advertiserId !=null">
-			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
-			</if>
-			<if test="orderId !=null">
-			 and t_rpt_advertiser.order_id=#{orderId}
-			</if>
-			  
-		     <if test="campaignId !=null">
-			 and t_rpt_advertiser.campaign_id=#{campaignId}
-			</if>
-			
-			<if test="adGroupId !=null">
-			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
-			</if>
-		 
-	    <if test="startDate!=null and endDate!=null"> 
-            and date &gt;= #{startDate} and #{endDate} &gt;=date
-	    </if>) as visitSum,
-        (select sum(t_rpt_advertiser.conversion) from t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
-	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
-            and  t_rpt_advertiser.banner_id=t_banner.id 
-            and  t_banner.banner_template_id = t_banner_template.id 
-
-			<if test="advertiserId !=null">
-			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
-			</if>
-			<if test="orderId !=null">
-			 and t_rpt_advertiser.order_id=#{orderId}
-			</if>
-			  
-		     <if test="campaignId !=null">
-			 and t_rpt_advertiser.campaign_id=#{campaignId}
-			</if>
-			
-			<if test="adGroupId !=null">
-			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
-			</if>
-		 
-	    <if test="startDate!=null and endDate!=null"> 
-            and date &gt;= #{startDate} and #{endDate} &gt;=date
-	    </if>) as conversionSum, 
-		(select sum(t_rpt_advertiser.ecmp) from t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
-	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
-            and  t_rpt_advertiser.banner_id=t_banner.id 
-            and  t_banner.banner_template_id = t_banner_template.id 
-
-			<if test="advertiserId !=null">
-			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
-			</if>
-			<if test="orderId !=null">
-			 and t_rpt_advertiser.order_id=#{orderId}
-			</if>
-			  
-		     <if test="campaignId !=null">
-			 and t_rpt_advertiser.campaign_id=#{campaignId}
-			</if>
-			
-			<if test="adGroupId !=null">
-			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
-			</if>
-		 
-	    <if test="startDate!=null and endDate!=null"> 
-            and date &gt;= #{startDate} and #{endDate} &gt;=date
-	    </if>) as eCmpSum, (select sum(t_rpt_advertiser.consume) from t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
-	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
-            and  t_rpt_advertiser.banner_id=t_banner.id 
-            and  t_banner.banner_template_id = t_banner_template.id 
-
-			<if test="advertiserId !=null">
-			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
-			</if>
-			<if test="orderId !=null">
-			 and t_rpt_advertiser.order_id=#{orderId}
-			</if>
-			  
-		     <if test="campaignId !=null">
-			 and t_rpt_advertiser.campaign_id=#{campaignId}
-			</if>
-			
-			<if test="adGroupId !=null">
-			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
-			</if>
-		 
-	    <if test="startDate!=null and endDate!=null"> 
-            and date &gt;= #{startDate} and #{endDate} &gt;=date
-	    </if>) as consumeSum, 
-        100*(select sum(t_rpt_advertiser.click) from t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
-	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
-            and  t_rpt_advertiser.banner_id=t_banner.id 
-            and  t_banner.banner_template_id = t_banner_template.id 
-
-			<if test="advertiserId !=null">
-			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
-			</if>
-			<if test="orderId !=null">
-			 and t_rpt_advertiser.order_id=#{orderId}
-			</if>
-			  
-		     <if test="campaignId !=null">
-			 and t_rpt_advertiser.campaign_id=#{campaignId}
-			</if>
-			
-			<if test="adGroupId !=null">
-			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
-			</if>
-		 
-	    <if test="startDate!=null and endDate!=null"> 
-            and date &gt;= #{startDate} and #{endDate} &gt;=date
-	    </if>)/(select sum(t_rpt_advertiser.impression) from t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
-	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
-            and  t_rpt_advertiser.banner_id=t_banner.id 
-            and  t_banner.banner_template_id = t_banner_template.id 
-
-			<if test="advertiserId !=null">
-			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
-			</if>
-			<if test="orderId !=null">
-			 and t_rpt_advertiser.order_id=#{orderId}
-			</if>
-			  
-		     <if test="campaignId !=null">
-			 and t_rpt_advertiser.campaign_id=#{campaignId}
-			</if>
-			
-			<if test="adGroupId !=null">
-			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
-			</if>
-		 
-	    <if test="startDate!=null and endDate!=null"> 
-            and date &gt;= #{startDate} and #{endDate} &gt;=date
-	    </if>) as clickRatesum, 
-		100*(select sum(t_rpt_advertiser.visit) from t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
-	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
-            and  t_rpt_advertiser.banner_id=t_banner.id 
-            and  t_banner.banner_template_id = t_banner_template.id 
-
-			<if test="advertiserId !=null">
-			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
-			</if>
-			<if test="orderId !=null">
-			 and t_rpt_advertiser.order_id=#{orderId}
-			</if>
-			  
-		     <if test="campaignId !=null">
-			 and t_rpt_advertiser.campaign_id=#{campaignId}
-			</if>
-			
-			<if test="adGroupId !=null">
-			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
-			</if>
-		 
-	    <if test="startDate!=null and endDate!=null"> 
-            and date &gt;= #{startDate} and #{endDate} &gt;=date
-	    </if>)/(select sum(t_rpt_advertiser.click) from t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
-	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
-            and  t_rpt_advertiser.banner_id=t_banner.id 
-            and  t_banner.banner_template_id = t_banner_template.id 
-
-			<if test="advertiserId !=null">
-			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
-			</if>
-			<if test="orderId !=null">
-			 and t_rpt_advertiser.order_id=#{orderId}
-			</if>
-			  
-		     <if test="campaignId !=null">
-			 and t_rpt_advertiser.campaign_id=#{campaignId}
-			</if>
-			
-			<if test="adGroupId !=null">
-			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
-			</if>
-		 
-	    <if test="startDate!=null and endDate!=null"> 
-            and date &gt;= #{startDate} and #{endDate} &gt;=date
-	    </if>) as visitRatesum,
-		100*(select sum(t_rpt_advertiser.conversion) from t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
-	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
-            and  t_rpt_advertiser.banner_id=t_banner.id 
-            and  t_banner.banner_template_id = t_banner_template.id 
-
-			<if test="advertiserId !=null">
-			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
-			</if>
-			<if test="orderId !=null">
-			 and t_rpt_advertiser.order_id=#{orderId}
-			</if>
-			  
-		     <if test="campaignId !=null">
-			 and t_rpt_advertiser.campaign_id=#{campaignId}
-			</if>
-			
-			<if test="adGroupId !=null">
-			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
-			</if>
-		 
-	    <if test="startDate!=null and endDate!=null"> 
-            and date &gt;= #{startDate} and #{endDate} &gt;=date
-	    </if>)/(select sum(t_rpt_advertiser.visit) from t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
-	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
-            and  t_rpt_advertiser.banner_id=t_banner.id 
-            and  t_banner.banner_template_id = t_banner_template.id 
-
-			<if test="advertiserId !=null">
-			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
-			</if>
-			<if test="orderId !=null">
-			 and t_rpt_advertiser.order_id=#{orderId}
-			</if>
-			  
-		     <if test="campaignId !=null">
-			 and t_rpt_advertiser.campaign_id=#{campaignId}
-			</if>
-			
-			<if test="adGroupId !=null">
-			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
-			</if>
-		 
-	    <if test="startDate!=null and endDate!=null"> 
-            and date &gt;= #{startDate} and #{endDate} &gt;=date
-	    </if>) as conversionRatesum
-		
-		from t_rpt_advertiser ad,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template
-           
-           
-           <where>
-	 	    ad.advertiser_id=t_advertiser.id  and  ad.order_id = t_order.id  and ad.campaign_id= t_campaign.id   
-	 	    and  ad.adgroup_id=t_adgroup.id
-            and  ad.banner_id=t_banner.id 
-            and  t_banner.banner_template_id = t_banner_template.id
-
-			<if test="advertiserId !=null">
-			 and ad.advertiser_id=#{advertiserId}
-			</if>
-			
-			<if test="orderId !=null">
-			 and ad.order_id=#{orderId}
-			</if>
-			  
-		     <if test="campaignId !=null">
-			 and ad.campaign_id=#{campaignId}
-			</if>
-			
-			<if test="adGroupId !=null">
-			 and ad.adgroup_id=#{adGroupId}
-			</if>
-		 
-	
-	    <if test="startDate!=null and endDate!=null"> 
-            and date &gt;= #{startDate} and #{endDate} &gt;=date
-	    </if>
-	  
-		  </where> 
-		
-		  limit #{pager.offset}, #{pager.limit}
-	</select>
-	
-	<!-- 系统报表 -->
-	<select id="countBySystem" parameterType="map" resultType="int">
-         select count(os) from ((select distinct os from t_rpt_zone_os where 
-		  date &gt;= #{startDate} and #{endDate} &gt;=date
-		    and operator_id=#{operatorId}
-		  ) as a)
-	</select>
-	
-		<select id="findByPosition" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
-		select 
-	    id,date as reportDate,position,100*sum(pv)/(select sum(pv) from t_rpt_zone_position where 
-		 date &gt;= #{startDate} and #{endDate} &gt;=date
-		    and operator_id=#{operatorId}
-		 ) as viewRate,sum(pv) as pv,sum(uv) as uv,sum(impression) as impression ,
-		 sum(uimpression) as uImpression, sum(uclick) as uClick,
-		 100*sum(impression)/sum(pv) as fillRate,sum(click) as click ,100*sum(click)/sum(impression) as clickRate,sum(eCpm) as eCpm,sum(income) as income 
-		from t_rpt_zone_position
-		where 
-		 date &gt;= #{startDate} and #{endDate} &gt;=date
-		    and operator_id=#{operatorId}
-		group by position 
-		order by impression desc 
-	</select>
-	
-	<select id="findBySize1" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
-		select 
-	    id,date as reportDate,width ,height,100*sum(pv)/(select sum(pv) from t_rpt_zone_size 
-	    where
-            date &gt;= #{startDate} and #{endDate} &gt;=date
-		    and operator_id=#{operatorId}
-		) as viewRate,sum(pv) as pv,sum(uv) as uv,sum(impression) as impression,
-		sum(uimpression) as uImpression, sum(uclick) as uClick,
-		100*impression/pv as fillRate,sum(click) as click,100*sum(click)/sum(impression) as clickRate,sum(ecpm) as eCpm,sum(income) as income
-		from t_rpt_zone_size 
-		where
-            date &gt;= #{startDate} and #{endDate} &gt;=date
-		    and operator_id=#{operatorId}
-		group by width,height
-		order by impression desc
-	</select>
-	
-	<select id="findByTotalReport2" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
-		select 
-		t_advertiser.name as advertiserName,  t_order.name as orderName, t_campaign.name as campaignName, t_adgroup.name  as adGroupName, t_banner_template.name as bannerName, 
-        
-         ad.date as reportDate,   ad.hour as hour,  
-        (select sum(impression) from t_rpt_advertiser_hour) as impressionSum,ad.impression,ad.click,visit,ad.conversion, 
-        100*ad.click/ad.impression as clickRate ,100*visit/ad.click as visitRate ,100*ad.conversion/visit as conversionRate ,ecmp as eCmp,ad.consume,
-		(select sum(click) from t_rpt_advertiser_hour) as clickSum, (select sum(visit) from t_rpt_advertiser_hour) as visitSum,
-        (select sum(conversion) from t_rpt_advertiser_hour) as conversionSum, 
-		(select sum(ecmp) from t_rpt_advertiser_hour) as eCmpSum, (select sum(consume) from t_rpt_advertiser_hour) as consumeSum, 
-        100*(select sum(click) from t_rpt_advertiser_hour)/(select sum(impression) from t_rpt_advertiser_hour) as clickRatesum, 
-		100*(select sum(visit) from t_rpt_advertiser_hour)/(select sum(click) from t_rpt_advertiser_hour) as visitRatesum,
-		100*(select sum(conversion) from t_rpt_advertiser_hour)/(select sum(visit) from t_rpt_advertiser_hour) as conversionRatesum
-		
-		from t_rpt_advertiser_hour ad,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template
-           
-           
-           <where>
-	 	    ad.advertiser_id=t_advertiser.id  and  ad.order_id = t_order.id  and ad.campaign_id= t_campaign.id   
-	 	    and  ad.adgroup_id=t_adgroup.id
-            and  ad.banner_id=t_banner.id 
-            and  t_banner.banner_template_id = t_banner_template.id
-
-			<if test="advertiserId !=null">
-			 and ad.advertiser_id=#{advertiserId}
-			</if>
-			
-			<if test="orderId !=null">
-			 and ad.order_id=#{orderId}
-			</if>
-			  
-		     <if test="campaignId !=null">
-			 and ad.campaign_id=#{campaignId}
-			</if>
-			
-			<if test="adGroupId !=null">
-			 and ad.adgroup_id=#{adGroupId}
-			</if>
-		 
-		 <if test="startDate!=null and endDate!=null"> 
-            and date &gt;= #{startDate} and #{endDate} &gt;=date
-		</if>
-		 
-		  </where> 
-		
-		  limit #{pager.offset}, #{pager.limit}
-	</select>
-	
-		<select id="findBySystem" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
-	   select 
-	    os as system,100*(sum(pv)/(select sum(pv) from t_rpt_zone_os
-		where date &gt;= #{startDate} and #{endDate} &gt;=date
-		    and operator_id=#{operatorId}
-		   )) as viewRate,
-		sum(pv) as pv,sum(uv) as uv,sum(impression) as impression,
-		sum(uimpression) as uImpression, sum(uclick) as uClick,
-		100*(sum(impression)/sum(pv)) as fillRate,
-        sum(click) as click,100*(sum(click)/sum(impression)) as clickRate,sum(ecpm) as eCpm,sum(income) as income
-		from t_rpt_zone_os 
-		where date &gt;= #{startDate} and #{endDate} &gt;=date
-		    and operator_id=#{operatorId}
-		group by os
-		order by impression desc
-	</select>
-	
-	<select id="findByLocationAdvertiser" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
-		select t_location.cn_city as location, 100 * sum(impression) /(select sum(impression) from t_rpt_adv_location a1,t_advertiser b1	
-		<where>	
-       	a1.advertiser_id = b1.id and a1.date &gt;= #{startDate} and #{endDate} &gt;=a1.date
-			<if test="advertiserId ==null">
-			 and b1.agent_id=#{agentId}
-			</if>
-			<if test="advertiserId != null">
-			and a1.advertiser_id = #{advertiserId}	
-			</if>
-			<if test="orderId !=null">
-			 and a1.order_id=#{orderId}
-			</if>
-		     <if test="campaignId !=null">
-			 and a1.campaign_id=#{campaignId}
-			</if>
-			<if test="adGroupId !=null">
-			 and a1.adgroup_id=#{adGroupId}
-			</if>
-		</where>
-		) as impressionRate, sum(impression) as impression, sum(click) as click, 100 * sum(click) / sum(impression) as clickRate,
-		sum(visit) as visit, 100 * sum(visit) / sum(click) as visitRate, 100 * sum(conversion) / sum(visit) as conversionRate,
-		sum(conversion) as conversion, sum(ecmp) as eCmp, sum(consume) as consume from t_rpt_adv_location a, t_advertiser b,t_location
-		 	<where>	
-       	a.advertiser_id = b.id and a.location = t_location.location and a.date &gt;= #{startDate} and #{endDate} &gt;=a.date
-			<if test="advertiserId ==null">
-			 and b.agent_id=#{agentId}
-			</if>
-			<if test="advertiserId != null">
-			and a.advertiser_id = #{advertiserId}	
-			</if>
-			<if test="orderId !=null">
-			 and a.order_id=#{orderId}
-			</if>
-		     <if test="campaignId !=null">
-			 and a.campaign_id=#{campaignId}
-			</if>
-			<if test="adGroupId !=null">
-			 and a.adgroup_id=#{adGroupId}
-			</if>
-		</where>
-		group by a.location
-		limit #{pager.offset}, #{pager.limit}
-	   </select>
-	   
-		<select id="findBySystem1" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
-	    select 
-	    os as system,100*(sum(pv)/(select sum(pv) from t_rpt_zone_os
-		where date &gt;= #{startDate} and #{endDate} &gt;=date
-		    and operator_id=#{operatorId}
-		   )) as viewRate,
-		sum(pv) as pv,sum(uv) as uv,sum(impression) as impression,
-		sum(uimpression) as uImpression, sum(uclick) as uClick,
-		100*(sum(impression)/sum(pv)) as fillRate,
-        sum(click) as click,100*(sum(click)/sum(impression)) as clickRate,sum(ecpm) as eCpm,sum(income) as income
-		from t_rpt_zone_os 
-		where date &gt;= #{startDate} and #{endDate} &gt;=date
-		    and operator_id=#{operatorId}
-		group by os
-		order by impression desc
-	</select>
-	
-	<select id="findByLocationBack" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
-		select 
-		t_advertiser.name as advertiserName,  t_order.name as orderName, t_campaign.name as campaignName, t_adgroup.name  as adGroupName,
-
-               rl.date as reportDate,
-        rl.impression,rl.click,visit,rl.conversion,location,
-        100*rl.impression/(select sum(t_rpt_adv_location.impression) from t_rpt_adv_location , t_advertiser, t_order, t_campaign, t_adgroup
-        
-           where	
-            t_rpt_adv_location.advertiser_id = t_advertiser.id  and  t_rpt_adv_location.order_id =  t_order.id and t_rpt_adv_location.campaign_id = t_campaign.id  and t_rpt_adv_location.adgroup_id =  t_adgroup.id
-         	   
-			<if test="advertiserId !=null">
-			 and t_rpt_adv_location.advertiser_id=#{advertiserId}
-			</if> 
-			
-			<if test="orderId !=null">
-			 and t_rpt_adv_location.order_id=#{orderId}
-			</if>
-		     
-		     <if test="campaignId !=null">
-			 and t_rpt_adv_location.campaign_id=#{campaignId}
-			</if>
-			
-			<if test="adGroupId !=null">
-			 and t_rpt_adv_location.adgroup_id=#{adGroupId}
-			</if>
-		
-	  	 <if test="startDate!=null and endDate!=null"> 
-            and t_rpt_adv_location.date &gt;= #{startDate} and #{endDate} &gt;=t_rpt_adv_location.date
-		 </if>) as impressionRate,100*rl.click/rl.impression as clickRate ,
-        100*visit/rl.click as visitRate ,100*rl.conversion/visit as conversionRate,ecmp as eCmp,consume   
-        from t_rpt_adv_location rl, t_advertiser, t_order, t_campaign, t_adgroup
-        
-           <where>	
-            rl.advertiser_id = t_advertiser.id  and  rl.order_id =  t_order.id and rl.campaign_id = t_campaign.id  and rl.adgroup_id =  t_adgroup.id
-         	   
-			<if test="advertiserId !=null">
-			 and rl.advertiser_id=#{advertiserId}
-			</if> 
-			
-			<if test="orderId !=null">
-			 and rl.order_id=#{orderId}
-			</if>
-		     
-		     <if test="campaignId !=null">
-			 and rl.campaign_id=#{campaignId}
-			</if>
-			
-			<if test="adGroupId !=null">
-			 and rl.adgroup_id=#{adGroupId}
-			</if>
-		
-	  	 <if test="startDate!=null and endDate!=null"> 
-            and rl.date &gt;= #{startDate} and #{endDate} &gt;=rl.date
-		      </if>
-	    
-		    </where> 
-		    
-		limit #{pager.offset}, #{pager.limit}
-	   </select>
-	
-	<select id="findByOs" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
-		select 
-		t_advertiser.name as advertiserName,  t_order.name as orderName, t_campaign.name as campaignName, t_adgroup.name  as adGroupName,
-
-              ros.date as reportDate,
-        ros.impression,ros.click,visit,ros.conversion,os,
-        100*ros.impression/(select sum(t_rpt_adv_os.impression) from t_rpt_adv_os, t_advertiser, t_order, t_campaign, t_adgroup        
-
-
-            where	          
-         
-           t_rpt_adv_os.advertiser_id = t_advertiser.id  and  t_rpt_adv_os.order_id =  t_order.id and t_rpt_adv_os.campaign_id = t_campaign.id  and t_rpt_adv_os.adgroup_id =  t_adgroup.id
-		     	   
-			<if test="advertiserId !=null">
-			 and t_rpt_adv_os.advertiser_id=#{advertiserId}
-			</if> 
-			
-			<if test="orderId !=null">
-			 and t_rpt_adv_os.order_id=#{orderId}
-			</if>
-		     
-		     <if test="campaignId !=null">
-			 and t_rpt_adv_os.campaign_id=#{campaignId}
-			</if>
-			
-			<if test="adGroupId !=null">
-			 and t_rpt_adv_os.adgroup_id=#{adGroupId}
-			</if>
-			
-	 		<if test="startDate!=null and endDate!=null"> 
-            and t_rpt_adv_os.date &gt;= #{startDate} and #{endDate} &gt;=t_rpt_adv_os.date
-		     </if>
-	) as impressionRate,100*ros.click/ros.impression as clickRate ,
-        100*visit/ros.click as visitRate ,100*ros.conversion/visit as conversionRate,ecmp as eCmp,consume   
-        from t_rpt_adv_os ros, t_advertiser, t_order, t_campaign, t_adgroup        
-
-
-            <where>	          
-         
-           ros.advertiser_id = t_advertiser.id  and  ros.order_id =  t_order.id and ros.campaign_id = t_campaign.id  and ros.adgroup_id =  t_adgroup.id
-		     	   
-			<if test="advertiserId !=null">
-			 and ros.advertiser_id=#{advertiserId}
-			</if> 
-			
-			<if test="orderId !=null">
-			 and ros.order_id=#{orderId}
-			</if>
-		     
-		     <if test="campaignId !=null">
-			 and ros.campaign_id=#{campaignId}
-			</if>
-			
-			<if test="adGroupId !=null">
-			 and ros.adgroup_id=#{adGroupId}
-			</if>
-			
-	 		<if test="startDate!=null and endDate!=null"> 
-            and ros.date &gt;= #{startDate} and #{endDate} &gt;=ros.date
-		     </if>
-	
-		   </where> 
-
-		limit #{pager.offset}, #{pager.limit}
-	</select>
-	
-		<select id="countByAllAreal" parameterType="map" resultType="int">
-		select count(cn) from ((select distinct cn from t_rpt_zone_location a,t_location b 
-  		where
-		a.location = b.location and date &gt;= #{startDate} and #{endDate} &gt;=date
-		    and operator_id=#{operatorId}
-		) as t)
-		
-	</select>
-	
-		<select id="findByAllAreal" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
-		 select 
-	    a.id,a.date as reportDate,b.cn,b.cn_city,100*sum(a.pv)/(select sum(pv) from t_rpt_zone_location where date &gt;= #{startDate} and #{endDate} &gt;=date
-		    and operator_id=#{operatorId}
-		) as viewRate,
-	    sum(a.pv) as pv,sum(a.uv) as uv,sum(a.impression) as impression,
-	    sum(uimpression) as uImpression, sum(uclick) as uClick,100*sum(a.impression)/sum(a.pv) as fillRate,sum(a.click) as click,100*sum(a.click)/sum(a.impression) as clickRate,sum(a.eCpm) as eCpm,sum(a.income) as income
-		from t_rpt_zone_location a,t_location b
-	 	where
-		a.location = b.location  and a.date &gt;= #{startDate} and #{endDate} &gt;=a.date
-		    and operator_id=#{operatorId}
-		group by b.cn 
-		order by b.cn 
-		limit #{pager.offset}, #{pager.limit}
-	</select>
-	
-<select id="findByDevice" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
-		
-		select 
-	    id,date as reportDate,device,100*sum(pv)/
-	    (select sum(pv) from t_rpt_zone_device where operator_id = #{operatorId} and date &gt;= #{startDate} and #{endDate} &gt;=date) as viewRate,
-	    sum(pv) as pv,sum(uv) as uv,sum(impression) as impression ,
-	    sum(uimpression) as uImpression,
-		sum(uclick) as uClick,100*sum(impression)/sum(pv) as fillRate,sum(click) as click ,100*sum(click)/sum(impression) as clickRate,sum(eCpm) as eCpm,sum(income) as income
-        from t_rpt_zone_device
-		where operator_id = #{operatorId} and date &gt;= #{startDate} and #{endDate} &gt;=date
-		group by device 
-		order by impression desc
-	</select>
-	
-	
-	 <select id="findByPlaceName" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
-		select 
-	             t_place.name as placeName,	t_advertiser.name as advertiserName,  t_order.name as orderName, 
-	             t_campaign.name as campaignName, t_adgroup.name as adGroupName,
-	             
-	              rp.date as reportDate,
-                  rp.impression,rp.click,visit,rp.conversion,
-              100*rp.impression/(select sum(t_rpt_adv_place.impression) from t_rpt_adv_place , t_advertiser, t_order, t_campaign, t_adgroup , t_place      
-
-
-             where      
-            t_rpt_adv_place.place_id = t_place.id and  t_rpt_adv_place.advertiser_id = t_advertiser.id  
-            and  t_rpt_adv_place.order_id = t_order.id and t_rpt_adv_place.campaign_id = t_campaign.id  and t_rpt_adv_place.adgroup_id =  t_adgroup.id
-	   
-			<if test="advertiserId !=null">
-			 and t_rpt_adv_place.advertiser_id=#{advertiserId}
-			</if> 
-			
-			<if test="orderId !=null">
-			 and t_rpt_adv_place.order_id=#{orderId}
-			</if>
-		     
-		     <if test="campaignId !=null">
-			 and t_rpt_adv_place.campaign_id=#{campaignId}
-			</if>
-			
-			<if test="adGroupId !=null">
-			 and t_rpt_adv_place.adgroup_id=#{adGroupId}
-			</if>
-		 
-	  		 <if test="startDate!=null and endDate!=null"> 
-            and t_rpt_adv_place.date &gt;= #{startDate} and #{endDate} &gt;=t_rpt_adv_place.date
-		        </if>) as impressionRate,100*rp.click/rp.impression as clickRate ,
-              100*visit/rp.click as visitRate ,100*rp.conversion/visit as conversionRate,ecmp as eCmp,consume   
-            from t_rpt_adv_place rp, t_advertiser, t_order, t_campaign, t_adgroup , t_place      
-
-
-              <where>      
-            rp.place_id = t_place.id and  rp.advertiser_id = t_advertiser.id  
-            and  rp.order_id = t_order.id and rp.campaign_id = t_campaign.id  and rp.adgroup_id =  t_adgroup.id
-	   
-			<if test="advertiserId !=null">
-			 and rp.advertiser_id=#{advertiserId}
-			</if> 
-			
-			<if test="orderId !=null">
-			 and rp.order_id=#{orderId}
-			</if>
-		     
-		     <if test="campaignId !=null">
-			 and rp.campaign_id=#{campaignId}
-			</if>
-			
-			<if test="adGroupId !=null">
-			 and rp.adgroup_id=#{adGroupId}
-			</if>
-		 
-	  		 <if test="startDate!=null and endDate!=null"> 
-            and rp.date &gt;= #{startDate} and #{endDate} &gt;=rp.date
-		        </if>
-		     
-		  </where> 
-		limit #{pager.offset}, #{pager.limit}
-	</select>
-	
-
-		<select id="findByArealCity" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
-		 select 
-	    b.cn,b.cn_city,100*sum(a.pv)/(select sum(pv) from t_rpt_zone_location where date &gt;= #{startDate} and #{endDate} &gt;=date
-		    and operator_id=#{operatorId}
-		) as viewRate,
-	    sum(a.pv) as pv,sum(a.uv) as uv,sum(a.impression),
-	    sum(uimpression) as uImpression, sum(uclick) as uClick,
-	    100*sum(a.impression)/sum(a.pv) as fillRate,sum(a.click),100*sum(a.click)/sum(a.impression) as clickRate,sum(a.eCpm) as eCpm,sum(a.income) as income
-		from t_rpt_zone_location a,t_location b
-		where
-		a.location=b.location and b.cn=#{cn} and date &gt;= #{startDate} and #{endDate} &gt;=date
-		    and operator_id=#{operatorId}
-       group by b.cn_city
-	</select>
-	
-	<!--<select id="findByOrderName" parameterType="map" resultType="DeliverAnalysis">
-		select 
-		t_order.name as orderName,impression,click,visit,conversion,click/impression as clickRate ,visit/click as visitRate ,conversion/visit as conversionRate,eCmp,income
-		from t_rpt_daily
-		left join t_order
-		ON t_rpt_daily.order_id=t_order.id
-		order by order_id desc
-		limit #{pager.offset}, #{pager.limit}
-	</select>
-	
-	<select id="findByCampaignName" parameterType="map" resultType="DeliverAnalysis">
-		select 
-		t_campaign.name as campaignName,impression,click,visit,conversion,click/impression as clickRate ,visit/click as visitRate ,conversion/visit as conversionRate ,eCmp,income
-		from t_rpt_daily
-		left join t_campaign
-		ON t_rpt_daily.campaign_id=t_campaign.id
-		order by campaign_id desc
-		limit #{pager.offset}, #{pager.limit}
-	</select>
-	
-	<select id="findByAdGroupName" parameterType="map" resultType="DeliverAnalysis">
-		select 
-		t_adgroup.name as adGroupName,impression,click,visit,conversion,click/impression as clickRate ,visit/click as visitRate ,conversion/visit as conversionRate ,eCmp,income
-		from t_rpt_daily
-		left join t_adgroup
-		ON t_rpt_daily.adgroup_id=t_adgroup.id
-		order by adgroup_id desc
-		limit #{pager.offset}, #{pager.limit}
-	</select>
-	
-	<select id="findByBannerName" parameterType="map" resultType="DeliverAnalysis">
-		select 
-		t_banner.name as bannerName,impression,click,visit,conversion,click/impression as clickRate ,visit/click as visitRate ,conversion/visit as conversionRate ,eCmp,income
-		from t_rpt_daily
-		left join t_banner
-		ON t_rpt_daily.banner_id=t_banner.id
-		order by banner_id desc
-		limit #{pager.offset}, #{pager.limit}
-	</select>  -->
-	
-	
-	
-	
-	<select id="findByAdvertiser" parameterType="map" resultType="map">
-		select ad.name as advertiserName,date as reportDate,sum(a.consume) as totalConsume,sum(a.impression) as totalImpression,
-sum(click) as totalClick, if(sum(a.impression) > 0,sum(a.click)/sum(a.impression),0)
-		as clickRate from t_rpt_advertiser as a left join t_advertiser ad on a.advertiser_id=ad.id
-		where a.advertiser_id=#{advertiserId}
-		and a.date >= #{startDate} and a.date &lt;=#{endDate}
-		group by date(a.date)
-	</select>
-	
-	<select id="findByAdvertiser3" parameterType="map" resultType="map">
-		select ad.name as advertiserName,date as reportDate,sum(a.consume) as totalConsume,sum(a.impression) as totalImpression,
-sum(click) as totalClick, if(sum(a.impression) > 0,sum(a.click)/sum(a.impression),0)
-		as clickRate from t_rpt_advertiser as a left join t_advertiser ad on a.advertiser_id=ad.id
-		where a.advertiser_id=#{advertiserId}
-		and a.date >= #{startDate} and a.date &lt;=#{endDate}
-		group by date(a.date)
-		limit #{pager.offset}, #{pager.limit} 
-	</select>
-	
-	<select id="findByAreal" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
-		select 
-	    b.cn,b.cn_city,100*sum(a.pv)/(select sum(pv) from t_rpt_zone_location where date &gt;= #{startDate} and #{endDate} &gt;=date
-		    and operator_id=#{operatorId}
-		) as viewRate,
-	    sum(a.pv) as pv,sum(a.uv) as uv,sum(a.impression),
-	    sum(uimpression) as uImpression, sum(uclick) as uClick,
-	    100*sum(a.impression)/sum(a.pv) as fillRate,sum(a.click),100*sum(a.click)/sum(a.impression) as clickRate,sum(a.eCpm) as eCpm,sum(a.income) as income
-		from t_rpt_zone_location a,t_location b
-		where
-		a.location=b.location and b.cn=#{cn} and date &gt;= #{startDate} and #{endDate} &gt;=date
-		    and operator_id=#{operatorId}
-       group by b.cn_city
-	</select>
-	
-	<select id="findByAdvertiser1" parameterType="map" resultType="map">
-		select ad.name as advertiserName,date as reportDate, a.hour as hour,sum(a.consume) as totalConsume,sum(a.impression) as totalImpression,
-sum(click) as totalClick, if(sum(a.impression) > 0,sum(a.click)/sum(a.impression),0)
-		as clickRate from t_rpt_advertiser_hour as a left join t_advertiser ad on a.advertiser_id=ad.id
-		where a.advertiser_id=#{advertiserId} and a.date = #{startDate}
-		group by a.hour
-	</select>
-	
-	<select id="countByPlace" parameterType="map" resultType="int">
-		select count(place_id) from ((select distinct place_id from t_rpt_zone_place where 
-		operator_id = #{operatorId} and date &gt;= #{startDate} and date &lt;= #{endDate}) as a) 
-	</select>
-	
-	
-	<select id="findByAdvertiser2" parameterType="map" resultType="map">
-		select ad.name as advertiserName,date as reportDate, a.hour as hour,sum(a.consume) as totalConsume,sum(a.impression) as totalImpression,
-sum(click) as totalClick, if(sum(a.impression) > 0,sum(a.click)/sum(a.impression),0)
-		as clickRate from t_rpt_advertiser_hour as a left join t_advertiser ad on a.advertiser_id=ad.id
-		where a.advertiser_id=#{advertiserId} and a.date = #{startDate}
-		group by a.hour
-		limit #{pager.offset}, #{pager.limit} 
-	</select>
-	
-	
-		<select id="findByPlace" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
-		select t_place.name as place,sum(p.pv) as pv, sum(p.uv) as uv, sum(p.impression) as impression, 
-		sum(uimpression) as uImpression,
-		sum(uclick) as uClick,sum(p.click) as click, sum(p.ecpm) as eCpm,
-    sum(p.income) as income, 100 * sum(p.pv) / (select sum(pv) from t_rpt_zone_place where operator_id = #{operatorId} and date &gt;= #{startDate} and date &lt;= #{endDate}) as viewRate, 
-    100 * sum(p.impression) / sum(p.pv) as fillRate, 100 * sum(p.click) / sum(p.impression) as clickRate
-    from ((select distinct place_id from t_rpt_zone_place where operator_id = #{operatorId} and date &gt;= #{startDate} and date &lt;= #{endDate}) as a ), 
-    t_rpt_zone_place as p, t_place where a.place_id = p.place_id and a.place_id = t_place.id
-    and operator_id = #{operatorId} and date &gt;= #{startDate} and date &lt;= #{endDate}
-    group by p.place_id
-    order by p.impression desc
-	limit #{pager.offset}, #{pager.limit}
-	</select>
-	
-	<select id="findCountForChart" parameterType="map" resultType="int">
-	select count(date) from((select distinct date from t_rpt_advertiser where advertiser_id=#{advertiserId}
-		and date >= #{startDate} and date &lt;=#{endDate}) as a)
-	</select>
-	
-		<select id="findByPlace1" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
-		select t_place.name as place,sum(p.pv) as pv, sum(p.uv) as uv, sum(p.impression) as impression, 
-		sum(uimpression) as uImpression,
-		sum(uclick) as uClick,sum(p.click) as click, sum(p.ecpm) as eCpm,
-    sum(p.income) as income, 100 * sum(p.pv) / (select sum(pv) from t_rpt_zone_place where operator_id = #{operatorId} and date &gt;= #{startDate} and date &lt;= #{endDate}) as viewRate, 
-    100 * sum(p.impression) / sum(p.pv) as fillRate, 100 * sum(p.click) / sum(p.impression) as clickRate
-    from ((select distinct place_id from t_rpt_zone_place where operator_id = #{operatorId} and date &gt;= #{startDate} and date &lt;= #{endDate}) as a ), 
-    t_rpt_zone_place as p, t_place where a.place_id = p.place_id and a.place_id = t_place.id
-    and operator_id = #{operatorId} and date &gt;= #{startDate} and date &lt;= #{endDate}
-    group by p.place_id
-     order by p.impression desc
-	</select>
-	
-	<select id="findCountForChart1" parameterType="map" resultType="int">
-		select count(hour) from ((select distinct hour from t_rpt_advertiser_hour where advertiser_id=#{advertiserId} and date = #{startDate}) as a) 
-	</select>
-	
-	<select id="findTotalImpressionAndClickByAdvertiserId" parameterType="map" resultType="map">
-		select sum(impression) as totalImpression, sum(click) as totalClick
-		from t_rpt_advertiser 
-		where advertiser_id = #{advertiserId} and date = #{date}
-	</select>
-	
-	<select id="countByApmac" parameterType="map" resultType="int">
-			select count(apmac) from ((select distinct apmac from t_rpt_zone_ap where 
-		operator_id = #{operatorId} and date &gt;= #{startDate} and date &lt;= #{endDate}) as a) 
-	</select>
-	
-	<select id="findTotalImpressionAndClickByAgentId" parameterType="map" resultType="map">
-		select sum(a.impression) as totalImpression, sum(a.click) as totalClick
-		from t_rpt_advertiser  a,t_advertiser b
-		where b.id = a.advertiser_id and b.agent_id = #{agentId}
-		and a.date = #{date}
-	
-	</select>
-	
-	<!--数据报表 导出excel -->
-	<select id="findByTotalForExcelAdvertiser" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
-		select b.name advertiserName,c.name orderName,d.name campaignName,e.name adgroupName,g.name bannerName,a.date reportDate,sum(a.impression) as impression,sum(a.click) as click,100*sum(a.click)/sum(a.impression) as clickRate,sum(a.visit) as visit,100*sum(a.visit)/sum(a.click) as visitRate,sum(a.conversion) conversion,100*sum(a.conversion)/sum(a.visit) as conversionRate,sum(a.ecmp) ecmp,sum(a.consume) as consume 
-		from t_rpt_advertiser a,t_advertiser b,t_order c,t_campaign d,t_adgroup e,t_banner f,t_banner_template g
-		where a.advertiser_id=b.id and a.order_id=c.id and a.campaign_id=d.id and a.adgroup_id=e.id and a.banner_id=f.id and f.banner_template_id=g.id
-		<if test="advertiserId != null and advertiserId ">
-			and a.advertiser_id = #{advertiserId}
-		</if>
-		<if test="orderId != null and orderId != ''">
-			and a.order_id = #{orderId}
-		</if>
-		<if test="campaginId != null and campaginId != ''">
-			and a.campagin_id = #{campaginId}
-		</if>
-		<if test="adgroupId != null and adgroupId != ''">
-			and a.adgroup_id = #{adgroupId}
-		</if>
-		<if test="startDate != null and startDate != ''and endDate != nul and endDate != ''">
-			and a.date &gt;=#{startDate} and a.date &lt;=#{endDate}
-		</if>
-		<choose>
-			<when test="dimensionStr != null and dimensionStr != ''">
-				GROUP BY ${dimensionStr}
-			</when>
-			<otherwise>
-				group by reportDate 
-			</otherwise>
-		</choose>		
-	</select>
-	
-	<select id="findByApmac" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
-		select apmac, sum(pv) as pv, sum(uv) as uv, sum(impression) as impression, 
-		sum(uimpression) as uImpression,
-		sum(uclick) as uClick,sum(click) as click, sum(ecpm) as eCpm,
-    sum(income) as income, 100 * sum(pv) / (select sum(pv) from t_rpt_zone_ap where operator_id = #{operatorId} and date &gt;= #{startDate} and date &lt;= #{endDate}) as viewRate, 
-    100 * sum(impression) / sum(pv) as fillRate, 100 * sum(click) / sum(impression) as clickRate
-    from  t_rpt_zone_ap  where 
-    operator_id = #{operatorId} and date &gt;= #{startDate} and date &lt;= #{endDate}
-    group by apmac
-    order by impression desc
-	limit #{pager.offset}, #{pager.limit}
-	</select>
-	
-	<select id="findByLocationForExcel" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
-		select t_location.cn_city as location, 100 * sum(impression) /(select sum(impression) from t_rpt_adv_location a1,t_advertiser b1	
-		<where>	
-       	a1.advertiser_id = b1.id and a1.date &gt;= #{startDate} and #{endDate} &gt;=a1.date
-			<if test="advertiserId ==null">
-			 and b1.agent_id=#{agentId}
-			</if>
-			<if test="advertiserId != null">
-			and a1.advertiser_id = #{advertiserId}	
-			</if>
-			<if test="orderId !=null">
-			 and a1.order_id=#{orderId}
-			</if>
-		     <if test="campaignId !=null">
-			 and a1.campaign_id=#{campaignId}
-			</if>
-			<if test="adGroupId !=null">
-			 and a1.adgroup_id=#{adGroupId}
-			</if>
-		</where>
-		) as impressionRate, sum(impression) as impression, sum(click) as click, 100 * sum(click) / sum(impression) as clickRate,
-		sum(visit) as visit, 100 * sum(visit) / sum(click) as visitRate, 100 * sum(conversion) / sum(visit) as conversionRate,
-		sum(conversion) as conversion, sum(ecmp) as eCmp, sum(consume) as consume from t_rpt_adv_location a, t_advertiser b,t_location
-		 	<where>	
-       	a.advertiser_id = b.id and a.location = t_location.location and a.date &gt;= #{startDate} and #{endDate} &gt;=a.date
-			<if test="advertiserId ==null">
-			 and b.agent_id=#{agentId}
-			</if>
-			<if test="advertiserId != null">
-			and a.advertiser_id = #{advertiserId}	
-			</if>
-			<if test="orderId !=null">
-			 and a.order_id=#{orderId}
-			</if>
-		     <if test="campaignId !=null">
-			 and a.campaign_id=#{campaignId}
-			</if>
-			<if test="adGroupId !=null">
-			 and a.adgroup_id=#{adGroupId}
-			</if>
-		</where>
-		group by a.location
-	   </select>
-	
-		<select id="findByApmac1" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
-			select apmac, sum(pv) as pv, sum(uv) as uv, sum(impression) as impression, 
-		sum(uimpression) as uImpression,
-		sum(uclick) as uClick,sum(click) as click, sum(ecpm) as eCpm,
-    sum(income) as income, 100 * sum(pv) / (select sum(pv) from t_rpt_zone_ap where operator_id = #{operatorId} and date &gt;= #{startDate} and date &lt;= #{endDate}) as viewRate, 
-    100 * sum(impression) / sum(pv) as fillRate, 100 * sum(click) / sum(impression) as clickRate
-    from  t_rpt_zone_ap  where 
-    operator_id = #{operatorId} and date &gt;= #{startDate} and date &lt;= #{endDate}
-    group by apmac
-    order by impression desc
-	</select>
-	
-	<!-- 导出excel -->
-	<select id="findByTotalForExcelBack" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
-		select 
-		t_advertiser.name as advertiserName,  t_order.name as orderName, t_campaign.name as campaignName, t_adgroup.name  as adGroupName, t_banner_template.name as bannerName, 
-        
-         ad.date as reportDate,     
-        (select sum(t_rpt_advertiser.impression) from  t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
-	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
-            and  t_rpt_advertiser.banner_id=t_banner.id 
-            and  t_banner.banner_template_id = t_banner_template.id 
-
-			<if test="advertiserId !=null">
-			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
-			</if>
-			<if test="orderId !=null">
-			 and t_rpt_advertiser.order_id=#{orderId}
-			</if>
-			  
-		     <if test="campaignId !=null">
-			 and t_rpt_advertiser.campaign_id=#{campaignId}
-			</if>
-			
-			<if test="adGroupId !=null">
-			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
-			</if>
-		 
-	    <if test="startDate!=null and endDate!=null"> 
-            and date &gt;= #{startDate} and #{endDate} &gt;=date
-	    </if>) as impressionSum,ad.impression,ad.click,visit,ad.conversion, 
-        100*ad.click/ad.impression as clickRate ,100*visit/ad.click as visitRate ,100*ad.conversion/visit as conversionRate ,ecmp as eCmp,ad.consume,
-		(select sum(t_rpt_advertiser.click) from t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
-	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
-            and  t_rpt_advertiser.banner_id=t_banner.id 
-            and  t_banner.banner_template_id = t_banner_template.id 
-
-			<if test="advertiserId !=null">
-			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
-			</if>
-			<if test="orderId !=null">
-			 and t_rpt_advertiser.order_id=#{orderId}
-			</if>
-			  
-		     <if test="campaignId !=null">
-			 and t_rpt_advertiser.campaign_id=#{campaignId}
-			</if>
-			
-			<if test="adGroupId !=null">
-			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
-			</if>
-		 
-	    <if test="startDate!=null and endDate!=null"> 
-            and date &gt;= #{startDate} and #{endDate} &gt;=date
-	    </if>) as clickSum, (select sum(t_rpt_advertiser.visit) from t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
-	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
-            and  t_rpt_advertiser.banner_id=t_banner.id 
-            and  t_banner.banner_template_id = t_banner_template.id 
-
-			<if test="advertiserId !=null">
-			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
-			</if>
-			<if test="orderId !=null">
-			 and t_rpt_advertiser.order_id=#{orderId}
-			</if>
-			  
-		     <if test="campaignId !=null">
-			 and t_rpt_advertiser.campaign_id=#{campaignId}
-			</if>
-			
-			<if test="adGroupId !=null">
-			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
-			</if>
-		 
-	    <if test="startDate!=null and endDate!=null"> 
-            and date &gt;= #{startDate} and #{endDate} &gt;=date
-	    </if>) as visitSum,
-        (select sum(t_rpt_advertiser.conversion) from t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
-	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
-            and  t_rpt_advertiser.banner_id=t_banner.id 
-            and  t_banner.banner_template_id = t_banner_template.id 
-
-			<if test="advertiserId !=null">
-			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
-			</if>
-			<if test="orderId !=null">
-			 and t_rpt_advertiser.order_id=#{orderId}
-			</if>
-			  
-		     <if test="campaignId !=null">
-			 and t_rpt_advertiser.campaign_id=#{campaignId}
-			</if>
-			
-			<if test="adGroupId !=null">
-			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
-			</if>
-		 
-	    <if test="startDate!=null and endDate!=null"> 
-            and date &gt;= #{startDate} and #{endDate} &gt;=date
-	    </if>) as conversionSum, 
-		(select sum(t_rpt_advertiser.ecmp) from t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
-	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
-            and  t_rpt_advertiser.banner_id=t_banner.id 
-            and  t_banner.banner_template_id = t_banner_template.id 
-
-			<if test="advertiserId !=null">
-			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
-			</if>
-			<if test="orderId !=null">
-			 and t_rpt_advertiser.order_id=#{orderId}
-			</if>
-			  
-		     <if test="campaignId !=null">
-			 and t_rpt_advertiser.campaign_id=#{campaignId}
-			</if>
-			
-			<if test="adGroupId !=null">
-			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
-			</if>
-		 
-	    <if test="startDate!=null and endDate!=null"> 
-            and date &gt;= #{startDate} and #{endDate} &gt;=date
-	    </if>) as eCmpSum, (select sum(t_rpt_advertiser.consume) from t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
-	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
-            and  t_rpt_advertiser.banner_id=t_banner.id 
-            and  t_banner.banner_template_id = t_banner_template.id 
-
-			<if test="advertiserId !=null">
-			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
-			</if>
-			<if test="orderId !=null">
-			 and t_rpt_advertiser.order_id=#{orderId}
-			</if>
-			  
-		     <if test="campaignId !=null">
-			 and t_rpt_advertiser.campaign_id=#{campaignId}
-			</if>
-			
-			<if test="adGroupId !=null">
-			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
-			</if>
-		 
-	    <if test="startDate!=null and endDate!=null"> 
-            and date &gt;= #{startDate} and #{endDate} &gt;=date
-	    </if>) as consumeSum, 
-        100*(select sum(t_rpt_advertiser.click) from t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
-	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
-            and  t_rpt_advertiser.banner_id=t_banner.id 
-            and  t_banner.banner_template_id = t_banner_template.id 
-
-			<if test="advertiserId !=null">
-			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
-			</if>
-			<if test="orderId !=null">
-			 and t_rpt_advertiser.order_id=#{orderId}
-			</if>
-			  
-		     <if test="campaignId !=null">
-			 and t_rpt_advertiser.campaign_id=#{campaignId}
-			</if>
-			
-			<if test="adGroupId !=null">
-			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
-			</if>
-		 
-	    <if test="startDate!=null and endDate!=null"> 
-            and date &gt;= #{startDate} and #{endDate} &gt;=date
-	    </if>)/(select sum(t_rpt_advertiser.impression) from t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
-	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
-            and  t_rpt_advertiser.banner_id=t_banner.id 
-            and  t_banner.banner_template_id = t_banner_template.id 
-
-			<if test="advertiserId !=null">
-			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
-			</if>
-			<if test="orderId !=null">
-			 and t_rpt_advertiser.order_id=#{orderId}
-			</if>
-			  
-		     <if test="campaignId !=null">
-			 and t_rpt_advertiser.campaign_id=#{campaignId}
-			</if>
-			
-			<if test="adGroupId !=null">
-			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
-			</if>
-		 
-	    <if test="startDate!=null and endDate!=null"> 
-            and date &gt;= #{startDate} and #{endDate} &gt;=date
-	    </if>) as clickRatesum, 
-		100*(select sum(t_rpt_advertiser.visit) from t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
-	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
-            and  t_rpt_advertiser.banner_id=t_banner.id 
-            and  t_banner.banner_template_id = t_banner_template.id 
-
-			<if test="advertiserId !=null">
-			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
-			</if>
-			<if test="orderId !=null">
-			 and t_rpt_advertiser.order_id=#{orderId}
-			</if>
-			  
-		     <if test="campaignId !=null">
-			 and t_rpt_advertiser.campaign_id=#{campaignId}
-			</if>
-			
-			<if test="adGroupId !=null">
-			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
-			</if>
-		 
-	    <if test="startDate!=null and endDate!=null"> 
-            and date &gt;= #{startDate} and #{endDate} &gt;=date
-	    </if>)/(select sum(t_rpt_advertiser.click) from t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
-	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
-            and  t_rpt_advertiser.banner_id=t_banner.id 
-            and  t_banner.banner_template_id = t_banner_template.id 
-
-			<if test="advertiserId !=null">
-			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
-			</if>
-			<if test="orderId !=null">
-			 and t_rpt_advertiser.order_id=#{orderId}
-			</if>
-			  
-		     <if test="campaignId !=null">
-			 and t_rpt_advertiser.campaign_id=#{campaignId}
-			</if>
-			
-			<if test="adGroupId !=null">
-			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
-			</if>
-		 
-	    <if test="startDate!=null and endDate!=null"> 
-            and date &gt;= #{startDate} and #{endDate} &gt;=date
-	    </if>) as visitRatesum,
-		100*(select sum(t_rpt_advertiser.conversion) from t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
-	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
-            and  t_rpt_advertiser.banner_id=t_banner.id 
-            and  t_banner.banner_template_id = t_banner_template.id 
-
-			<if test="advertiserId !=null">
-			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
-			</if>
-			<if test="orderId !=null">
-			 and t_rpt_advertiser.order_id=#{orderId}
-			</if>
-			  
-		     <if test="campaignId !=null">
-			 and t_rpt_advertiser.campaign_id=#{campaignId}
-			</if>
-			
-			<if test="adGroupId !=null">
-			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
-			</if>
-		 
-	    <if test="startDate!=null and endDate!=null"> 
-            and date &gt;= #{startDate} and #{endDate} &gt;=date
-	    </if>)/(select sum(t_rpt_advertiser.visit) from t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
-	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
-            and  t_rpt_advertiser.banner_id=t_banner.id 
-            and  t_banner.banner_template_id = t_banner_template.id 
-
-			<if test="advertiserId !=null">
-			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
-			</if>
-			<if test="orderId !=null">
-			 and t_rpt_advertiser.order_id=#{orderId}
-			</if>
-			  
-		     <if test="campaignId !=null">
-			 and t_rpt_advertiser.campaign_id=#{campaignId}
-			</if>
-			
-			<if test="adGroupId !=null">
-			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
-			</if>
-		 
-	    <if test="startDate!=null and endDate!=null"> 
-            and date &gt;= #{startDate} and #{endDate} &gt;=date
-	    </if>) as conversionRatesum
-		
-		from t_rpt_advertiser ad,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template
-           
-           
-           <where>
-	 	    ad.advertiser_id=t_advertiser.id  and  ad.order_id = t_order.id  and ad.campaign_id= t_campaign.id   
-	 	    and  ad.adgroup_id=t_adgroup.id
-            and  ad.banner_id=t_banner.id 
-            and  t_banner.banner_template_id = t_banner_template.id
-
-			<if test="advertiserId !=null">
-			 and ad.advertiser_id=#{advertiserId}
-			</if>
-			
-			<if test="orderId !=null">
-			 and ad.order_id=#{orderId}
-			</if>
-			  
-		     <if test="campaignId !=null">
-			 and ad.campaign_id=#{campaignId}
-			</if>
-			
-			<if test="adGroupId !=null">
-			 and ad.adgroup_id=#{adGroupId}
-			</if>
-		 
-	
-	    <if test="startDate!=null and endDate!=null"> 
-            and date &gt;= #{startDate} and #{endDate} &gt;=date
-	    </if>
-	  
-		  </where> 
-		
-	</select>
-	
-	<select id="findAllArea" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
-		select 
-	    a.id,a.date as reportDate,b.cn,b.cn_city,100*sum(a.pv)/(select sum(pv) from t_rpt_zone_location where date &gt;= #{startDate} and #{endDate} &gt;=date
-		<if test="operatorId!=null">
-		    and operator_id=#{operatorId}
-		</if>) as viewRate,
-	    sum(a.pv) as pv,sum(a.uv) as uv,sum(a.impression) as impression,
-	    sum(uimpression) as uImpression, sum(uclick) as uClick,
-	    100*sum(a.impression)/sum(a.pv) as fillRate,sum(a.click) as click,100*sum(a.click)/sum(a.impression) as clickRate,sum(a.eCpm) as eCpm,sum(a.income) as income
-		from t_rpt_zone_location a,t_location b
-	 	where
-		a.location = b.location  and a.date &gt;= #{startDate} and #{endDate} &gt;=a.date
-		<if test="operatorId!=null">
-		    and operator_id=#{operatorId}
-		</if>
-		group by b.cn 
-		order by b.cn
-	</select>
-	
-	<select id="findByOsForExcel" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
-		select 
-		t_advertiser.name as advertiserName,  t_order.name as orderName, t_campaign.name as campaignName, t_adgroup.name  as adGroupName,
-
-              ros.date as reportDate,
-        ros.impression,ros.click,visit,ros.conversion,os,
-        100*ros.impression/(select sum(impression) from t_rpt_adv_os) as impressionRate,100*ros.click/ros.impression as clickRate ,
-        100*visit/ros.click as visitRate ,100*ros.conversion/visit as conversionRate,ecmp as eCmp,consume   
-        from t_rpt_adv_os ros, t_advertiser, t_order, t_campaign, t_adgroup        
-
-
-            <where>	          
-         
-           ros.advertiser_id = t_advertiser.id  and  ros.order_id =  t_order.id and ros.campaign_id = t_campaign.id  and ros.adgroup_id =  t_adgroup.id
-		     	   
-			<if test="advertiserId !=null">
-			 and ros.advertiser_id=#{advertiserId}
-			</if> 
-			
-			<if test="orderId !=null">
-			 and ros.order_id=#{orderId}
-			</if>
-		     
-		     <if test="campaignId !=null">
-			 and ros.campaign_id=#{campaignId}
-			</if>
-			
-			<if test="adGroupId !=null">
-			 and ros.adgroup_id=#{adGroupId}
-			</if>
-			
-	 		<if test="startDate!=null and endDate!=null"> 
-            and ros.date &gt;= #{startDate} and #{endDate} &gt;=ros.date
-		     </if>
-	
-		   </where> 
-
-	</select>
-	
-	 <select id="findByPlaceNameForExcel" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
-		select 
-	             t_place.name as placeName,	t_advertiser.name as advertiserName,  t_order.name as orderName, 
-	             t_campaign.name as campaignName, t_adgroup.name as adGroupName,
-	             
-	              rp.date as reportDate,
-                  rp.impression,rp.click,visit,rp.conversion,
-              100*rp.impression/(select sum(impression) from t_rpt_adv_place) as impressionRate,100*rp.click/rp.impression as clickRate ,
-              100*visit/rp.click as visitRate ,100*rp.conversion/visit as conversionRate,ecmp as eCmp,consume   
-            from t_rpt_adv_place rp, t_advertiser, t_order, t_campaign, t_adgroup , t_place      
-
-
-              <where>      
-            rp.place_id = t_place.id and  rp.advertiser_id = t_advertiser.id  
-            and  rp.order_id = t_order.id and rp.campaign_id = t_campaign.id  and rp.adgroup_id =  t_adgroup.id
-	   
-			<if test="advertiserId !=null">
-			 and rp.advertiser_id=#{advertiserId}
-			</if> 
-			
-			<if test="orderId !=null">
-			 and rp.order_id=#{orderId}
-			</if>
-		     
-		     <if test="campaignId !=null">
-			 and rp.campaign_id=#{campaignId}
-			</if>
-			
-			<if test="adGroupId !=null">
-			 and rp.adgroup_id=#{adGroupId}
-			</if>
-		 
-	  		 <if test="startDate!=null and endDate!=null"> 
-            and rp.date &gt;= #{startDate} and #{endDate} &gt;=rp.date
-		        </if>
-		     
-		  </where> 
-	</select>
-	
+<?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="adReportSqlMapper">
+	
+	<sql id="base_column">
+		id, 
+		advertiser_id as advertiserId,
+		order_id as orderId,
+		campaign_id as campaignId,
+		adgroup_id  as adGroupId,
+		 banner.id as bannerId,
+		t_banner.banner_template_id as bannerTemplateId,
+		t_advertiser.name as advertiserName,
+		t_order.name as orderName,
+		t_campaign.name as campaignName,
+		t_adgroup.name  as adGroupName,
+		t_banner_template.name as bannerName,
+		date as reportDate,
+		request,
+		impression,
+		impressionRate,
+		click,
+		visit,
+		conversion,
+		conversionRate,
+		clickRate,
+		visitRate,
+		conversionRate,
+		ecmp as eCmp,
+		consume,
+		os,
+		location,
+		impressionSum,
+		clickSum,
+		visitSum,
+		conversionSum,
+		eCmpSum,
+		consumeSum,
+		clickRatesum,
+		visitRatesum,
+		conversionRatesum
+		
+	</sql>
+	<sql id="base_column2">
+		id,
+		zone_id as zoneId,
+		pv,
+		uv,
+		width,
+		height,
+		position,
+		os,
+		device,
+		impression,
+		place,
+		click,
+		clickRate,
+		eCpm,
+		income,
+		t_rpt_zone.date as reportDate
+	</sql>
+	
+	<select id="findCountForDeliverEffectAnalysisAdvertiser" parameterType="map" resultType="int">
+		select count(1) from (
+		select b.name advertiserName,c.name orderName,d.name campaignName,e.name adgroupName,g.name bannerName,a.date reportDate,sum(a.impression) as impression,sum(a.click) as click,100*sum(a.click)/sum(a.impression) as clickRate,sum(a.visit) as visit,100*sum(a.visit)/sum(a.click) as visitRate,sum(a.conversion) as conversion,100*sum(a.conversion)/sum(a.visit) as conversionRate,sum(a.ecmp) as ecmp,sum(a.consume) as consume 
+		from t_rpt_advertiser a,t_advertiser b,t_order c,t_campaign d,t_adgroup e,t_banner f,t_banner_template g
+		where a.advertiser_id=b.id and a.order_id=c.id and a.campaign_id=d.id and a.adgroup_id=e.id and a.banner_id=f.id and f.banner_template_id=g.id
+		<if test="advertiserId != null and advertiserId ">
+			and a.advertiser_id = #{advertiserId}
+		</if>
+		<if test="orderId != null and orderId != ''">
+			and a.order_id = #{orderId}
+		</if>
+		<if test="campaginId != null and campaginId != ''">
+			and a.campagin_id = #{campaginId}
+		</if>
+		<if test="adgroupId != null and adgroupId != ''">
+			and a.adgroup_id = #{adgroupId}
+		</if>
+		<if test="startDate != null and startDate != ''and endDate != nul and endDate != ''">
+			and a.date &gt;=#{startDate} and a.date &lt;=#{endDate}
+		</if>
+		<choose>
+			<when test="dimensionStr != null and dimensionStr != ''">
+				GROUP BY ${dimensionStr}
+			</when>
+			<otherwise>
+				group by reportDate order by reportDate desc
+			</otherwise>
+		</choose>
+		) t	
+	</select>
+	
+	<!-- 创意报表记录总数 -->
+    <select id="findCountForBanner" parameterType="map" resultType="int">
+		select count(1) 
+		from t_rpt_adv_banner rp      
+
+        <where>      
+            <!-- rp.place_id = t_place.id and  rp.advertiser_id = t_advertiser.id  
+            and  rp.order_id = t_order.id and rp.campaign_id = t_campaign.id  and rp.adgroup_id =  t_adgroup.id -->
+			<if test="advertiserId !=null">
+			 and rp.advertiser_id=#{advertiserId}
+			</if>
+			
+			<if test="orderId !=null">
+			 and rp.order_id=#{orderId}
+			</if>
+			  
+		     <if test="campaignId !=null">
+			 and rp.campaign_id=#{campaignId}
+			</if>
+			
+			<if test="adGroupId !=null">
+			 and rp.adgroup_id=#{adGroupId}
+			</if>
+		 
+			<if test="startDate!=null and endDate!=null"> 
+	         and rp.date &gt;= #{startDate} and rp.date &lt;= #{endDate}
+			</if>
+		
+		</where>
+	</select>
+	
+	<!-- 条件查询创意报表 -->
+
+<select id="findBannerList" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
+		select 
+	              bt.name as bannerName,
+	              rp.date as reportDate,
+                  rp.impression,rp.click,rp.visit,rp.conversion,
+              100*rp.impression/(select sum(t_rpt_adv_banner.impression) from t_rpt_adv_banner      
+             where  1=1    
+			<if test="advertiserId !=null">
+			 and t_rpt_adv_banner.advertiser_id=#{advertiserId}
+			</if> 
+			
+			<if test="orderId !=null">
+			 and t_rpt_adv_banner.order_id=#{orderId}
+			</if>
+		     
+		     <if test="campaignId !=null">
+			 and t_rpt_adv_banner.campaign_id=#{campaignId}
+			</if>
+			
+			<if test="adGroupId !=null">
+			 and t_rpt_adv_banner.adgroup_id=#{adGroupId}
+			</if>
+		 
+	  		 <if test="startDate!=null and endDate!=null"> 
+            and t_rpt_adv_banner.date &gt;= #{startDate} and #{endDate} &gt;=t_rpt_adv_banner.date
+		        </if>
+	) as impressionRate,100*rp.click/rp.impression as clickRate ,
+	100*visit/rp.click as visitRate ,100*rp.conversion/visit as
+	conversionRate,ecmp as eCmp,consume
+	from t_rpt_adv_banner rp,
+	t_banner_template bt
+              <where>      
+            rp.banner_id = bt.id
+			<if test="advertiserId !=null">
+			 and rp.advertiser_id=#{advertiserId}
+			</if> 
+			
+			<if test="orderId !=null">
+			 and rp.order_id=#{orderId}
+			</if>
+		     
+		     <if test="campaignId !=null">
+			 and rp.campaign_id=#{campaignId}
+			</if>
+			
+			<if test="adGroupId !=null">
+			 and rp.adgroup_id=#{adGroupId}
+			</if>
+		 
+	  		 <if test="startDate!=null and endDate!=null"> 
+            and rp.date &gt;= #{startDate} and #{endDate} &gt;=rp.date
+		        </if>
+		     
+		  </where> 
+		limit #{pager.offset}, #{pager.limit}
+	</select>
+	
+	<!-- 创意报表导出 -->
+	<select id="exportBannerList" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
+		select 
+	              bt.name as bannerName,
+	              rp.date as reportDate,
+                  rp.impression,rp.click,rp.visit,rp.conversion,
+              100*rp.impression/(select sum(t_rpt_adv_banner.impression) from t_rpt_adv_banner      
+             where  1=1    
+			<if test="advertiserId !=null">
+			 and t_rpt_adv_banner.advertiser_id=#{advertiserId}
+			</if> 
+			
+			<if test="orderId !=null">
+			 and t_rpt_adv_banner.order_id=#{orderId}
+			</if>
+		     
+		     <if test="campaignId !=null">
+			 and t_rpt_adv_banner.campaign_id=#{campaignId}
+			</if>
+			
+			<if test="adGroupId !=null">
+			 and t_rpt_adv_banner.adgroup_id=#{adGroupId}
+			</if>
+		 
+	  		 <if test="startDate!=null and endDate!=null"> 
+            and t_rpt_adv_banner.date &gt;= #{startDate} and #{endDate} &gt;=t_rpt_adv_banner.date
+		        </if>
+	) as impressionRate,100*rp.click/rp.impression as clickRate ,
+	100*visit/rp.click as visitRate ,100*rp.conversion/visit as
+	conversionRate,ecmp as eCmp,consume
+	from t_rpt_adv_banner rp,
+	t_banner_template bt
+              <where>      
+            rp.banner_id = bt.id
+			<if test="advertiserId !=null">
+			 and rp.advertiser_id=#{advertiserId}
+			</if> 
+			
+			<if test="orderId !=null">
+			 and rp.order_id=#{orderId}
+			</if>
+		     
+		     <if test="campaignId !=null">
+			 and rp.campaign_id=#{campaignId}
+			</if>
+			
+			<if test="adGroupId !=null">
+			 and rp.adgroup_id=#{adGroupId}
+			</if>
+		 
+	  		 <if test="startDate!=null and endDate!=null"> 
+            and rp.date &gt;= #{startDate} and #{endDate} &gt;=rp.date
+		        </if>
+		     
+		  </where> 
+	</select>
+	
+	<select id="findCountForDeliverEffectAnalysisBack" parameterType="map" resultType="int">
+		select count(1) 
+		from t_rpt_advertiser ad,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template
+           
+        <where>
+	 	    ad.advertiser_id=t_advertiser.id  and  ad.order_id = t_order.id  and ad.campaign_id= t_campaign.id   
+	 	    and  ad.adgroup_id=t_adgroup.id
+            and  ad.banner_id=t_banner.id 
+            and  t_banner.banner_template_id = t_banner_template.id
+	 	   
+			<if test="advertiserId !=null">
+			 and ad.advertiser_id=#{advertiserId}
+			</if>
+			
+			<if test="orderId !=null">
+			 and ad.order_id=#{orderId}
+			</if>
+			  
+		     <if test="campaignId !=null">
+			 and ad.campaign_id=#{campaignId}
+			</if>
+			
+			<if test="adGroupId !=null">
+			 and ad.adgroup_id=#{adGroupId}
+			</if>
+		 
+			<if test="startDate!=null and endDate!=null"> 
+	            and ad.date &gt;= #{startDate} and #{endDate} &gt;=ad.date
+			</if>
+		
+		</where>
+	</select>
+		<select id="findCountForDeliverEffectAnalysisOperator" parameterType="map" resultType="int">
+		select count(date) from ((
+		select distinct date 
+		from t_rpt_zone  
+		<where>
+		operator_id = #{operatorId} and date &gt;= #{startDate} and #{endDate} &gt;=date
+		<if test="zoneId!=null">
+		and zone_id=#{zoneId}
+		</if>
+		</where>
+		) as a)
+	</select>
+	
+		<select id="findCountForLocationAdvertiser" parameterType="map" resultType="int">
+		select count(location) from ( select location
+		from t_rpt_adv_location a, t_advertiser b
+       	<where>	
+       	a.advertiser_id = b.id and a.date &gt;= #{startDate} and #{endDate} &gt;=a.date
+			<if test="advertiserId ==null">
+			 and b.agent_id=#{agentId}
+			</if>
+			<if test="advertiserId != null">
+			and a.advertiser_id = #{advertiserId}	
+			</if>
+			<if test="orderId !=null">
+			 and a.order_id=#{orderId}
+			</if>
+		     <if test="campaignId !=null">
+			 and a.campaign_id=#{campaignId}
+			</if>
+			<if test="adGroupId !=null">
+			 and a.adgroup_id=#{adGroupId}
+			</if>
+		</where>
+		group by a.location
+		) as c
+	</select>
+	
+		<select id="findCountForLocationBack" parameterType="map" resultType="int">
+		select count(1) 
+		from t_rpt_adv_location rl, t_advertiser, t_order, t_campaign, t_adgroup
+        
+       	<where>	
+            rl.advertiser_id = t_advertiser.id  and  rl.order_id =  t_order.id and rl.campaign_id = t_campaign.id  and rl.adgroup_id =  t_adgroup.id
+	 	   	
+			<if test="advertiserId !=null">
+			 and rl.advertiser_id=#{advertiserId}
+			</if>
+			
+			<if test="orderId !=null">
+			 and rl.order_id=#{orderId}
+			</if>
+			  
+		     <if test="campaignId !=null">
+			 and rl.campaign_id=#{campaignId}
+			</if>
+			
+			<if test="adGroupId !=null">
+			 and rl.adgroup_id=#{adGroupId}
+			</if>
+		 
+			<if test="startDate!=null and endDate!=null"> 
+	            and rl.date &gt;= #{startDate} and #{endDate} &gt;=rl.date
+			</if>
+		
+		</where>
+	</select>
+	
+	<select id="findDeliverEffectAnalysis" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
+		select 
+		zone_id as zoneId,date as reportDate,sum(pv) as pv,sum(uv) as uv,sum(impression) as impression,sum(uimpression) as uImpression,
+		sum(uclick) as uClick,
+		100*sum(impression)/sum(pv) as fillRate,
+        sum(click) as click,100* sum(click)/sum(impression) as clickRate,sum(ecpm) as eCpm,sum(income) as income
+		from t_rpt_zone 
+		<where>
+		operator_id = #{operatorId} and date &gt;= #{startDate} and #{endDate} &gt;=date
+		<if test="zoneId!=null">
+		and zone_id=#{zoneId}
+		</if>
+		</where>
+		group by date
+		limit #{pager.offset}, #{pager.limit}
+	</select>
+	
+	<select id="findSum" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
+		select sum(pv) as pv, sum(uv) as uv, sum(impression) as impression, sum(click) as click, sum(income) as income
+		from t_rpt_zone 
+		<where>
+		operator_id = #{operatorId}
+		<if test="zoneId!=null">
+		and zone_id=#{zoneId}
+		</if>
+		<if test="startDate!=null and endDate!=null"> 
+            and date &gt;= #{startDate} and #{endDate} &gt;=date
+		</if>
+		</where>
+	</select>
+	
+    <select id="findCountForOs" parameterType="map" resultType="int">
+		select count(1) 
+		from t_rpt_adv_os ros, t_advertiser, t_order, t_campaign, t_adgroup        
+        <where>	          
+           ros.advertiser_id = t_advertiser.id  and  ros.order_id =  t_order.id and ros.campaign_id = t_campaign.id  and ros.adgroup_id =  t_adgroup.id
+	 	   
+			<if test="advertiserId !=null">
+			 and ros.advertiser_id=#{advertiserId}
+			</if>
+			
+			<if test="orderId !=null">
+			 and ros.order_id=#{orderId}
+			</if>
+			  
+		     <if test="campaignId !=null">
+			 and ros.campaign_id=#{campaignId}
+			</if>
+			
+			<if test="adGroupId !=null">
+			 and ros.adgroup_id=#{adGroupId}
+			</if>
+		 
+			<if test="startDate!=null and endDate!=null"> 
+	            and ros.date &gt;= #{startDate} and #{endDate} &gt;=ros.date
+			</if>
+		
+		</where>
+	</select>
+	
+		<select id="findDeliverEffectAnalysis1" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
+		select 
+		zone_id as zoneId,date as reportDate,sum(pv) as pv,sum(uv) as uv,sum(impression) as impression,
+		sum(uimpression) as uImpression,
+		sum(uclick) as uClick,100*sum(impression)/sum(pv) as fillRate,
+        sum(click) as click,100* sum(click)/sum(impression) as clickRate,sum(ecpm) as eCpm,sum(income) as income
+		from t_rpt_zone 
+		<where>
+		operator_id = #{operatorId} and date &gt;= #{startDate} and #{endDate} &gt;=date
+		<if test="zoneId!=null">
+		and zone_id=#{zoneId}
+		</if>
+		</where>
+		group by date
+	</select>
+	
+    <select id="findCountForScene" parameterType="map" resultType="int">
+		select count(1) 
+		from t_rpt_adv_place rp, t_advertiser, t_order, t_campaign, t_adgroup , t_place      
+
+        <where>      
+            rp.place_id = t_place.id and  rp.advertiser_id = t_advertiser.id  
+            and  rp.order_id = t_order.id and rp.campaign_id = t_campaign.id  and rp.adgroup_id =  t_adgroup.id
+			<if test="advertiserId !=null">
+			 and rp.advertiser_id=#{advertiserId}
+			</if>
+			
+			<if test="orderId !=null">
+			 and rp.order_id=#{orderId}
+			</if>
+			  
+		     <if test="campaignId !=null">
+			 and rp.campaign_id=#{campaignId}
+			</if>
+			
+			<if test="adGroupId !=null">
+			 and rp.adgroup_id=#{adGroupId}
+			</if>
+		 
+			<if test="startDate!=null and endDate!=null"> 
+	         and rp.date &gt;= #{startDate} and rp.date &lt;= #{endDate}
+			</if>
+		
+		</where>
+	</select>
+	
+	<select id="countBySize" parameterType="map" resultType="int">
+		 select count(height) from ((select distinct width,height from t_rpt_zone_size where 
+		  date &gt;= #{startDate} and #{endDate} &gt;=date
+		    and operator_id=#{operatorId}
+		 ) as a )
+	</select>
+	
+	 <select id="findByTotalReportAdvertiser" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
+		select b.name advertiserName,c.name orderName,d.name campaignName,e.name adgroupName,g.name bannerName,a.date reportDate,sum(a.impression) as impression,sum(a.click) as click,100*sum(a.click)/sum(a.impression) as clickRate,sum(a.visit) as visit,100*sum(a.visit)/sum(a.click) as visitRate,sum(a.conversion) conversion,100*sum(a.conversion)/sum(a.visit) as conversionRate,sum(a.ecmp) ecmp,sum(a.consume) as consume 
+		from t_rpt_advertiser a,t_advertiser b,t_order c,t_campaign d,t_adgroup e,t_banner f,t_banner_template g
+		where a.advertiser_id=b.id and a.order_id=c.id and a.campaign_id=d.id and a.adgroup_id=e.id and a.banner_id=f.id and f.banner_template_id=g.id
+		<if test="advertiserId != null and advertiserId ">
+			and a.advertiser_id = #{advertiserId}
+		</if>
+		<if test="orderId != null and orderId != ''">
+			and a.order_id = #{orderId}
+		</if>
+		<if test="campaginId != null and campaginId != ''">
+			and a.campagin_id = #{campaginId}
+		</if>
+		<if test="adgroupId != null and adgroupId != ''">
+			and a.adgroup_id = #{adgroupId}
+		</if>
+		<if test="startDate != null and startDate != ''and endDate != nul and endDate != ''">
+			and a.date &gt;=#{startDate} and a.date &lt;=#{endDate}
+		</if>
+		<choose>
+			<when test="dimensionStr != null and dimensionStr != ''">
+				GROUP BY ${dimensionStr}
+			</when>
+			<otherwise>
+				group by reportDate
+			</otherwise>
+		</choose>		
+		limit #{pager.offset}, #{pager.limit}
+	</select>
+	
+<select id="findBySize" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
+		select 
+	    id,date as reportDate,width ,height,100*sum(pv)/(select sum(pv) from t_rpt_zone_size 
+	    where
+            date &gt;= #{startDate} and #{endDate} &gt;=date
+		    and operator_id=#{operatorId}
+		) as viewRate,sum(pv) as pv,sum(uv) as uv,sum(impression) as impression,
+		sum(uimpression) as uImpression, sum(uclick) as uClick,
+		100*impression/pv as fillRate,sum(click) as click,100*sum(click)/sum(impression) as clickRate,sum(ecpm) as eCpm,sum(income) as income
+		from t_rpt_zone_size 
+		where
+            date &gt;= #{startDate} and #{endDate} &gt;=date
+		    and operator_id=#{operatorId}
+		group by width,height
+		order by impression desc
+		limit #{pager.offset}, #{pager.limit}
+	</select>
+	
+	 <select id="findByTotalReportBack" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
+		select 
+		t_advertiser.name as advertiserName,  t_order.name as orderName, t_campaign.name as campaignName, t_adgroup.name  as adGroupName, t_banner_template.name as bannerName, 
+        
+         ad.date as reportDate,     
+        (select sum(t_rpt_advertiser.impression) from  t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
+	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
+            and  t_rpt_advertiser.banner_id=t_banner.id 
+            and  t_banner.banner_template_id = t_banner_template.id 
+
+			<if test="advertiserId !=null">
+			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
+			</if>
+			<if test="orderId !=null">
+			 and t_rpt_advertiser.order_id=#{orderId}
+			</if>
+			  
+		     <if test="campaignId !=null">
+			 and t_rpt_advertiser.campaign_id=#{campaignId}
+			</if>
+			
+			<if test="adGroupId !=null">
+			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
+			</if>
+		 
+	    <if test="startDate!=null and endDate!=null"> 
+            and date &gt;= #{startDate} and #{endDate} &gt;=date
+	    </if>) as impressionSum,ad.impression,ad.click,visit,ad.conversion, 
+        100*ad.click/ad.impression as clickRate ,100*visit/ad.click as visitRate ,100*ad.conversion/visit as conversionRate ,ecmp as eCmp,ad.consume,
+		(select sum(t_rpt_advertiser.click) from t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
+	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
+            and  t_rpt_advertiser.banner_id=t_banner.id 
+            and  t_banner.banner_template_id = t_banner_template.id 
+
+			<if test="advertiserId !=null">
+			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
+			</if>
+			<if test="orderId !=null">
+			 and t_rpt_advertiser.order_id=#{orderId}
+			</if>
+			  
+		     <if test="campaignId !=null">
+			 and t_rpt_advertiser.campaign_id=#{campaignId}
+			</if>
+			
+			<if test="adGroupId !=null">
+			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
+			</if>
+		 
+	    <if test="startDate!=null and endDate!=null"> 
+            and date &gt;= #{startDate} and #{endDate} &gt;=date
+	    </if>) as clickSum, (select sum(t_rpt_advertiser.visit) from t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
+	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
+            and  t_rpt_advertiser.banner_id=t_banner.id 
+            and  t_banner.banner_template_id = t_banner_template.id 
+
+			<if test="advertiserId !=null">
+			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
+			</if>
+			<if test="orderId !=null">
+			 and t_rpt_advertiser.order_id=#{orderId}
+			</if>
+			  
+		     <if test="campaignId !=null">
+			 and t_rpt_advertiser.campaign_id=#{campaignId}
+			</if>
+			
+			<if test="adGroupId !=null">
+			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
+			</if>
+		 
+	    <if test="startDate!=null and endDate!=null"> 
+            and date &gt;= #{startDate} and #{endDate} &gt;=date
+	    </if>) as visitSum,
+        (select sum(t_rpt_advertiser.conversion) from t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
+	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
+            and  t_rpt_advertiser.banner_id=t_banner.id 
+            and  t_banner.banner_template_id = t_banner_template.id 
+
+			<if test="advertiserId !=null">
+			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
+			</if>
+			<if test="orderId !=null">
+			 and t_rpt_advertiser.order_id=#{orderId}
+			</if>
+			  
+		     <if test="campaignId !=null">
+			 and t_rpt_advertiser.campaign_id=#{campaignId}
+			</if>
+			
+			<if test="adGroupId !=null">
+			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
+			</if>
+		 
+	    <if test="startDate!=null and endDate!=null"> 
+            and date &gt;= #{startDate} and #{endDate} &gt;=date
+	    </if>) as conversionSum, 
+		(select sum(t_rpt_advertiser.ecmp) from t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
+	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
+            and  t_rpt_advertiser.banner_id=t_banner.id 
+            and  t_banner.banner_template_id = t_banner_template.id 
+
+			<if test="advertiserId !=null">
+			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
+			</if>
+			<if test="orderId !=null">
+			 and t_rpt_advertiser.order_id=#{orderId}
+			</if>
+			  
+		     <if test="campaignId !=null">
+			 and t_rpt_advertiser.campaign_id=#{campaignId}
+			</if>
+			
+			<if test="adGroupId !=null">
+			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
+			</if>
+		 
+	    <if test="startDate!=null and endDate!=null"> 
+            and date &gt;= #{startDate} and #{endDate} &gt;=date
+	    </if>) as eCmpSum, (select sum(t_rpt_advertiser.consume) from t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
+	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
+            and  t_rpt_advertiser.banner_id=t_banner.id 
+            and  t_banner.banner_template_id = t_banner_template.id 
+
+			<if test="advertiserId !=null">
+			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
+			</if>
+			<if test="orderId !=null">
+			 and t_rpt_advertiser.order_id=#{orderId}
+			</if>
+			  
+		     <if test="campaignId !=null">
+			 and t_rpt_advertiser.campaign_id=#{campaignId}
+			</if>
+			
+			<if test="adGroupId !=null">
+			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
+			</if>
+		 
+	    <if test="startDate!=null and endDate!=null"> 
+            and date &gt;= #{startDate} and #{endDate} &gt;=date
+	    </if>) as consumeSum, 
+        100*(select sum(t_rpt_advertiser.click) from t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
+	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
+            and  t_rpt_advertiser.banner_id=t_banner.id 
+            and  t_banner.banner_template_id = t_banner_template.id 
+
+			<if test="advertiserId !=null">
+			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
+			</if>
+			<if test="orderId !=null">
+			 and t_rpt_advertiser.order_id=#{orderId}
+			</if>
+			  
+		     <if test="campaignId !=null">
+			 and t_rpt_advertiser.campaign_id=#{campaignId}
+			</if>
+			
+			<if test="adGroupId !=null">
+			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
+			</if>
+		 
+	    <if test="startDate!=null and endDate!=null"> 
+            and date &gt;= #{startDate} and #{endDate} &gt;=date
+	    </if>)/(select sum(t_rpt_advertiser.impression) from t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
+	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
+            and  t_rpt_advertiser.banner_id=t_banner.id 
+            and  t_banner.banner_template_id = t_banner_template.id 
+
+			<if test="advertiserId !=null">
+			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
+			</if>
+			<if test="orderId !=null">
+			 and t_rpt_advertiser.order_id=#{orderId}
+			</if>
+			  
+		     <if test="campaignId !=null">
+			 and t_rpt_advertiser.campaign_id=#{campaignId}
+			</if>
+			
+			<if test="adGroupId !=null">
+			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
+			</if>
+		 
+	    <if test="startDate!=null and endDate!=null"> 
+            and date &gt;= #{startDate} and #{endDate} &gt;=date
+	    </if>) as clickRatesum, 
+		100*(select sum(t_rpt_advertiser.visit) from t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
+	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
+            and  t_rpt_advertiser.banner_id=t_banner.id 
+            and  t_banner.banner_template_id = t_banner_template.id 
+
+			<if test="advertiserId !=null">
+			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
+			</if>
+			<if test="orderId !=null">
+			 and t_rpt_advertiser.order_id=#{orderId}
+			</if>
+			  
+		     <if test="campaignId !=null">
+			 and t_rpt_advertiser.campaign_id=#{campaignId}
+			</if>
+			
+			<if test="adGroupId !=null">
+			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
+			</if>
+		 
+	    <if test="startDate!=null and endDate!=null"> 
+            and date &gt;= #{startDate} and #{endDate} &gt;=date
+	    </if>)/(select sum(t_rpt_advertiser.click) from t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
+	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
+            and  t_rpt_advertiser.banner_id=t_banner.id 
+            and  t_banner.banner_template_id = t_banner_template.id 
+
+			<if test="advertiserId !=null">
+			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
+			</if>
+			<if test="orderId !=null">
+			 and t_rpt_advertiser.order_id=#{orderId}
+			</if>
+			  
+		     <if test="campaignId !=null">
+			 and t_rpt_advertiser.campaign_id=#{campaignId}
+			</if>
+			
+			<if test="adGroupId !=null">
+			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
+			</if>
+		 
+	    <if test="startDate!=null and endDate!=null"> 
+            and date &gt;= #{startDate} and #{endDate} &gt;=date
+	    </if>) as visitRatesum,
+		100*(select sum(t_rpt_advertiser.conversion) from t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
+	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
+            and  t_rpt_advertiser.banner_id=t_banner.id 
+            and  t_banner.banner_template_id = t_banner_template.id 
+
+			<if test="advertiserId !=null">
+			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
+			</if>
+			<if test="orderId !=null">
+			 and t_rpt_advertiser.order_id=#{orderId}
+			</if>
+			  
+		     <if test="campaignId !=null">
+			 and t_rpt_advertiser.campaign_id=#{campaignId}
+			</if>
+			
+			<if test="adGroupId !=null">
+			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
+			</if>
+		 
+	    <if test="startDate!=null and endDate!=null"> 
+            and date &gt;= #{startDate} and #{endDate} &gt;=date
+	    </if>)/(select sum(t_rpt_advertiser.visit) from t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
+	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
+            and  t_rpt_advertiser.banner_id=t_banner.id 
+            and  t_banner.banner_template_id = t_banner_template.id 
+
+			<if test="advertiserId !=null">
+			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
+			</if>
+			<if test="orderId !=null">
+			 and t_rpt_advertiser.order_id=#{orderId}
+			</if>
+			  
+		     <if test="campaignId !=null">
+			 and t_rpt_advertiser.campaign_id=#{campaignId}
+			</if>
+			
+			<if test="adGroupId !=null">
+			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
+			</if>
+		 
+	    <if test="startDate!=null and endDate!=null"> 
+            and date &gt;= #{startDate} and #{endDate} &gt;=date
+	    </if>) as conversionRatesum
+		
+		from t_rpt_advertiser ad,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template
+           
+           
+           <where>
+	 	    ad.advertiser_id=t_advertiser.id  and  ad.order_id = t_order.id  and ad.campaign_id= t_campaign.id   
+	 	    and  ad.adgroup_id=t_adgroup.id
+            and  ad.banner_id=t_banner.id 
+            and  t_banner.banner_template_id = t_banner_template.id
+
+			<if test="advertiserId !=null">
+			 and ad.advertiser_id=#{advertiserId}
+			</if>
+			
+			<if test="orderId !=null">
+			 and ad.order_id=#{orderId}
+			</if>
+			  
+		     <if test="campaignId !=null">
+			 and ad.campaign_id=#{campaignId}
+			</if>
+			
+			<if test="adGroupId !=null">
+			 and ad.adgroup_id=#{adGroupId}
+			</if>
+		 
+	
+	    <if test="startDate!=null and endDate!=null"> 
+            and date &gt;= #{startDate} and #{endDate} &gt;=date
+	    </if>
+	  
+		  </where> 
+		
+		  limit #{pager.offset}, #{pager.limit}
+	</select>
+	
+	<!-- 系统报表 -->
+	<select id="countBySystem" parameterType="map" resultType="int">
+         select count(os) from ((select distinct os from t_rpt_zone_os where 
+		  date &gt;= #{startDate} and #{endDate} &gt;=date
+		    and operator_id=#{operatorId}
+		  ) as a)
+	</select>
+	
+		<select id="findByPosition" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
+		select 
+	    id,date as reportDate,position,100*sum(pv)/(select sum(pv) from t_rpt_zone_position where 
+		 date &gt;= #{startDate} and #{endDate} &gt;=date
+		    and operator_id=#{operatorId}
+		 ) as viewRate,sum(pv) as pv,sum(uv) as uv,sum(impression) as impression ,
+		 sum(uimpression) as uImpression, sum(uclick) as uClick,
+		 100*sum(impression)/sum(pv) as fillRate,sum(click) as click ,100*sum(click)/sum(impression) as clickRate,sum(eCpm) as eCpm,sum(income) as income 
+		from t_rpt_zone_position
+		where 
+		 date &gt;= #{startDate} and #{endDate} &gt;=date
+		    and operator_id=#{operatorId}
+		group by position 
+		order by impression desc 
+	</select>
+	
+	<select id="findBySize1" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
+		select 
+	    id,date as reportDate,width ,height,100*sum(pv)/(select sum(pv) from t_rpt_zone_size 
+	    where
+            date &gt;= #{startDate} and #{endDate} &gt;=date
+		    and operator_id=#{operatorId}
+		) as viewRate,sum(pv) as pv,sum(uv) as uv,sum(impression) as impression,
+		sum(uimpression) as uImpression, sum(uclick) as uClick,
+		100*impression/pv as fillRate,sum(click) as click,100*sum(click)/sum(impression) as clickRate,sum(ecpm) as eCpm,sum(income) as income
+		from t_rpt_zone_size 
+		where
+            date &gt;= #{startDate} and #{endDate} &gt;=date
+		    and operator_id=#{operatorId}
+		group by width,height
+		order by impression desc
+	</select>
+	
+	<select id="findByTotalReport2" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
+		select 
+		t_advertiser.name as advertiserName,  t_order.name as orderName, t_campaign.name as campaignName, t_adgroup.name  as adGroupName, t_banner_template.name as bannerName, 
+        
+         ad.date as reportDate,   ad.hour as hour,  
+        (select sum(impression) from t_rpt_advertiser_hour) as impressionSum,ad.impression,ad.click,visit,ad.conversion, 
+        100*ad.click/ad.impression as clickRate ,100*visit/ad.click as visitRate ,100*ad.conversion/visit as conversionRate ,ecmp as eCmp,ad.consume,
+		(select sum(click) from t_rpt_advertiser_hour) as clickSum, (select sum(visit) from t_rpt_advertiser_hour) as visitSum,
+        (select sum(conversion) from t_rpt_advertiser_hour) as conversionSum, 
+		(select sum(ecmp) from t_rpt_advertiser_hour) as eCmpSum, (select sum(consume) from t_rpt_advertiser_hour) as consumeSum, 
+        100*(select sum(click) from t_rpt_advertiser_hour)/(select sum(impression) from t_rpt_advertiser_hour) as clickRatesum, 
+		100*(select sum(visit) from t_rpt_advertiser_hour)/(select sum(click) from t_rpt_advertiser_hour) as visitRatesum,
+		100*(select sum(conversion) from t_rpt_advertiser_hour)/(select sum(visit) from t_rpt_advertiser_hour) as conversionRatesum
+		
+		from t_rpt_advertiser_hour ad,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template
+           
+           
+           <where>
+	 	    ad.advertiser_id=t_advertiser.id  and  ad.order_id = t_order.id  and ad.campaign_id= t_campaign.id   
+	 	    and  ad.adgroup_id=t_adgroup.id
+            and  ad.banner_id=t_banner.id 
+            and  t_banner.banner_template_id = t_banner_template.id
+
+			<if test="advertiserId !=null">
+			 and ad.advertiser_id=#{advertiserId}
+			</if>
+			
+			<if test="orderId !=null">
+			 and ad.order_id=#{orderId}
+			</if>
+			  
+		     <if test="campaignId !=null">
+			 and ad.campaign_id=#{campaignId}
+			</if>
+			
+			<if test="adGroupId !=null">
+			 and ad.adgroup_id=#{adGroupId}
+			</if>
+		 
+		 <if test="startDate!=null and endDate!=null"> 
+            and date &gt;= #{startDate} and #{endDate} &gt;=date
+		</if>
+		 
+		  </where> 
+		
+		  limit #{pager.offset}, #{pager.limit}
+	</select>
+	
+		<select id="findBySystem" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
+	   select 
+	    os as system,100*(sum(pv)/(select sum(pv) from t_rpt_zone_os
+		where date &gt;= #{startDate} and #{endDate} &gt;=date
+		    and operator_id=#{operatorId}
+		   )) as viewRate,
+		sum(pv) as pv,sum(uv) as uv,sum(impression) as impression,
+		sum(uimpression) as uImpression, sum(uclick) as uClick,
+		100*(sum(impression)/sum(pv)) as fillRate,
+        sum(click) as click,100*(sum(click)/sum(impression)) as clickRate,sum(ecpm) as eCpm,sum(income) as income
+		from t_rpt_zone_os 
+		where date &gt;= #{startDate} and #{endDate} &gt;=date
+		    and operator_id=#{operatorId}
+		group by os
+		order by impression desc
+	</select>
+	
+	<select id="findByLocationAdvertiser" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
+		select t_location.cn_city as location, 100 * sum(impression) /(select sum(impression) from t_rpt_adv_location a1,t_advertiser b1	
+		<where>	
+       	a1.advertiser_id = b1.id and a1.date &gt;= #{startDate} and #{endDate} &gt;=a1.date
+			<if test="advertiserId ==null">
+			 and b1.agent_id=#{agentId}
+			</if>
+			<if test="advertiserId != null">
+			and a1.advertiser_id = #{advertiserId}	
+			</if>
+			<if test="orderId !=null">
+			 and a1.order_id=#{orderId}
+			</if>
+		     <if test="campaignId !=null">
+			 and a1.campaign_id=#{campaignId}
+			</if>
+			<if test="adGroupId !=null">
+			 and a1.adgroup_id=#{adGroupId}
+			</if>
+		</where>
+		) as impressionRate, sum(impression) as impression, sum(click) as click, 100 * sum(click) / sum(impression) as clickRate,
+		sum(visit) as visit, 100 * sum(visit) / sum(click) as visitRate, 100 * sum(conversion) / sum(visit) as conversionRate,
+		sum(conversion) as conversion, sum(ecmp) as eCmp, sum(consume) as consume from t_rpt_adv_location a, t_advertiser b,t_location
+		 	<where>	
+       	a.advertiser_id = b.id and a.location = t_location.location and a.date &gt;= #{startDate} and #{endDate} &gt;=a.date
+			<if test="advertiserId ==null">
+			 and b.agent_id=#{agentId}
+			</if>
+			<if test="advertiserId != null">
+			and a.advertiser_id = #{advertiserId}	
+			</if>
+			<if test="orderId !=null">
+			 and a.order_id=#{orderId}
+			</if>
+		     <if test="campaignId !=null">
+			 and a.campaign_id=#{campaignId}
+			</if>
+			<if test="adGroupId !=null">
+			 and a.adgroup_id=#{adGroupId}
+			</if>
+		</where>
+		group by a.location
+		limit #{pager.offset}, #{pager.limit}
+	   </select>
+	   
+		<select id="findBySystem1" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
+	    select 
+	    os as system,100*(sum(pv)/(select sum(pv) from t_rpt_zone_os
+		where date &gt;= #{startDate} and #{endDate} &gt;=date
+		    and operator_id=#{operatorId}
+		   )) as viewRate,
+		sum(pv) as pv,sum(uv) as uv,sum(impression) as impression,
+		sum(uimpression) as uImpression, sum(uclick) as uClick,
+		100*(sum(impression)/sum(pv)) as fillRate,
+        sum(click) as click,100*(sum(click)/sum(impression)) as clickRate,sum(ecpm) as eCpm,sum(income) as income
+		from t_rpt_zone_os 
+		where date &gt;= #{startDate} and #{endDate} &gt;=date
+		    and operator_id=#{operatorId}
+		group by os
+		order by impression desc
+	</select>
+	
+	<select id="findByLocationBack" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
+		select 
+		t_advertiser.name as advertiserName,  t_order.name as orderName, t_campaign.name as campaignName, t_adgroup.name  as adGroupName,
+
+               rl.date as reportDate,
+        rl.impression,rl.click,visit,rl.conversion,location,
+        100*rl.impression/(select sum(t_rpt_adv_location.impression) from t_rpt_adv_location , t_advertiser, t_order, t_campaign, t_adgroup
+        
+           where	
+            t_rpt_adv_location.advertiser_id = t_advertiser.id  and  t_rpt_adv_location.order_id =  t_order.id and t_rpt_adv_location.campaign_id = t_campaign.id  and t_rpt_adv_location.adgroup_id =  t_adgroup.id
+         	   
+			<if test="advertiserId !=null">
+			 and t_rpt_adv_location.advertiser_id=#{advertiserId}
+			</if> 
+			
+			<if test="orderId !=null">
+			 and t_rpt_adv_location.order_id=#{orderId}
+			</if>
+		     
+		     <if test="campaignId !=null">
+			 and t_rpt_adv_location.campaign_id=#{campaignId}
+			</if>
+			
+			<if test="adGroupId !=null">
+			 and t_rpt_adv_location.adgroup_id=#{adGroupId}
+			</if>
+		
+	  	 <if test="startDate!=null and endDate!=null"> 
+            and t_rpt_adv_location.date &gt;= #{startDate} and #{endDate} &gt;=t_rpt_adv_location.date
+		 </if>) as impressionRate,100*rl.click/rl.impression as clickRate ,
+        100*visit/rl.click as visitRate ,100*rl.conversion/visit as conversionRate,ecmp as eCmp,consume   
+        from t_rpt_adv_location rl, t_advertiser, t_order, t_campaign, t_adgroup
+        
+           <where>	
+            rl.advertiser_id = t_advertiser.id  and  rl.order_id =  t_order.id and rl.campaign_id = t_campaign.id  and rl.adgroup_id =  t_adgroup.id
+         	   
+			<if test="advertiserId !=null">
+			 and rl.advertiser_id=#{advertiserId}
+			</if> 
+			
+			<if test="orderId !=null">
+			 and rl.order_id=#{orderId}
+			</if>
+		     
+		     <if test="campaignId !=null">
+			 and rl.campaign_id=#{campaignId}
+			</if>
+			
+			<if test="adGroupId !=null">
+			 and rl.adgroup_id=#{adGroupId}
+			</if>
+		
+	  	 <if test="startDate!=null and endDate!=null"> 
+            and rl.date &gt;= #{startDate} and #{endDate} &gt;=rl.date
+		      </if>
+	    
+		    </where> 
+		    
+		limit #{pager.offset}, #{pager.limit}
+	   </select>
+	
+	<select id="findByOs" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
+		select 
+		t_advertiser.name as advertiserName,  t_order.name as orderName, t_campaign.name as campaignName, t_adgroup.name  as adGroupName,
+
+              ros.date as reportDate,
+        ros.impression,ros.click,visit,ros.conversion,os,
+        100*ros.impression/(select sum(t_rpt_adv_os.impression) from t_rpt_adv_os, t_advertiser, t_order, t_campaign, t_adgroup        
+
+
+            where	          
+         
+           t_rpt_adv_os.advertiser_id = t_advertiser.id  and  t_rpt_adv_os.order_id =  t_order.id and t_rpt_adv_os.campaign_id = t_campaign.id  and t_rpt_adv_os.adgroup_id =  t_adgroup.id
+		     	   
+			<if test="advertiserId !=null">
+			 and t_rpt_adv_os.advertiser_id=#{advertiserId}
+			</if> 
+			
+			<if test="orderId !=null">
+			 and t_rpt_adv_os.order_id=#{orderId}
+			</if>
+		     
+		     <if test="campaignId !=null">
+			 and t_rpt_adv_os.campaign_id=#{campaignId}
+			</if>
+			
+			<if test="adGroupId !=null">
+			 and t_rpt_adv_os.adgroup_id=#{adGroupId}
+			</if>
+			
+	 		<if test="startDate!=null and endDate!=null"> 
+            and t_rpt_adv_os.date &gt;= #{startDate} and #{endDate} &gt;=t_rpt_adv_os.date
+		     </if>
+	) as impressionRate,100*ros.click/ros.impression as clickRate ,
+        100*visit/ros.click as visitRate ,100*ros.conversion/visit as conversionRate,ecmp as eCmp,consume   
+        from t_rpt_adv_os ros, t_advertiser, t_order, t_campaign, t_adgroup        
+
+
+            <where>	          
+         
+           ros.advertiser_id = t_advertiser.id  and  ros.order_id =  t_order.id and ros.campaign_id = t_campaign.id  and ros.adgroup_id =  t_adgroup.id
+		     	   
+			<if test="advertiserId !=null">
+			 and ros.advertiser_id=#{advertiserId}
+			</if> 
+			
+			<if test="orderId !=null">
+			 and ros.order_id=#{orderId}
+			</if>
+		     
+		     <if test="campaignId !=null">
+			 and ros.campaign_id=#{campaignId}
+			</if>
+			
+			<if test="adGroupId !=null">
+			 and ros.adgroup_id=#{adGroupId}
+			</if>
+			
+	 		<if test="startDate!=null and endDate!=null"> 
+            and ros.date &gt;= #{startDate} and #{endDate} &gt;=ros.date
+		     </if>
+	
+		   </where> 
+
+		limit #{pager.offset}, #{pager.limit}
+	</select>
+	
+		<select id="countByAllAreal" parameterType="map" resultType="int">
+		select count(cn) from ((select distinct cn from t_rpt_zone_location a,t_location b 
+  		where
+		a.location = b.location and date &gt;= #{startDate} and #{endDate} &gt;=date
+		    and operator_id=#{operatorId}
+		) as t)
+		
+	</select>
+	
+		<select id="findByAllAreal" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
+		 select 
+	    a.id,a.date as reportDate,b.cn,b.cn_city,100*sum(a.pv)/(select sum(pv) from t_rpt_zone_location where date &gt;= #{startDate} and #{endDate} &gt;=date
+		    and operator_id=#{operatorId}
+		) as viewRate,
+	    sum(a.pv) as pv,sum(a.uv) as uv,sum(a.impression) as impression,
+	    sum(uimpression) as uImpression, sum(uclick) as uClick,100*sum(a.impression)/sum(a.pv) as fillRate,sum(a.click) as click,100*sum(a.click)/sum(a.impression) as clickRate,sum(a.eCpm) as eCpm,sum(a.income) as income
+		from t_rpt_zone_location a,t_location b
+	 	where
+		a.location = b.location  and a.date &gt;= #{startDate} and #{endDate} &gt;=a.date
+		    and operator_id=#{operatorId}
+		group by b.cn 
+		order by b.cn 
+		limit #{pager.offset}, #{pager.limit}
+	</select>
+	
+<select id="findByDevice" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
+		
+		select 
+	    id,date as reportDate,device,100*sum(pv)/
+	    (select sum(pv) from t_rpt_zone_device where operator_id = #{operatorId} and date &gt;= #{startDate} and #{endDate} &gt;=date) as viewRate,
+	    sum(pv) as pv,sum(uv) as uv,sum(impression) as impression ,
+	    sum(uimpression) as uImpression,
+		sum(uclick) as uClick,100*sum(impression)/sum(pv) as fillRate,sum(click) as click ,100*sum(click)/sum(impression) as clickRate,sum(eCpm) as eCpm,sum(income) as income
+        from t_rpt_zone_device
+		where operator_id = #{operatorId} and date &gt;= #{startDate} and #{endDate} &gt;=date
+		group by device 
+		order by impression desc
+	</select>
+	
+	
+	 <select id="findByPlaceName" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
+		select 
+	             t_place.name as placeName,	t_advertiser.name as advertiserName,  t_order.name as orderName, 
+	             t_campaign.name as campaignName, t_adgroup.name as adGroupName,
+	             
+	              rp.date as reportDate,
+                  rp.impression,rp.click,visit,rp.conversion,
+              100*rp.impression/(select sum(t_rpt_adv_place.impression) from t_rpt_adv_place , t_advertiser, t_order, t_campaign, t_adgroup , t_place      
+
+
+             where      
+            t_rpt_adv_place.place_id = t_place.id and  t_rpt_adv_place.advertiser_id = t_advertiser.id  
+            and  t_rpt_adv_place.order_id = t_order.id and t_rpt_adv_place.campaign_id = t_campaign.id  and t_rpt_adv_place.adgroup_id =  t_adgroup.id
+	   
+			<if test="advertiserId !=null">
+			 and t_rpt_adv_place.advertiser_id=#{advertiserId}
+			</if> 
+			
+			<if test="orderId !=null">
+			 and t_rpt_adv_place.order_id=#{orderId}
+			</if>
+		     
+		     <if test="campaignId !=null">
+			 and t_rpt_adv_place.campaign_id=#{campaignId}
+			</if>
+			
+			<if test="adGroupId !=null">
+			 and t_rpt_adv_place.adgroup_id=#{adGroupId}
+			</if>
+		 
+	  		 <if test="startDate!=null and endDate!=null"> 
+            and t_rpt_adv_place.date &gt;= #{startDate} and #{endDate} &gt;=t_rpt_adv_place.date
+		        </if>) as impressionRate,100*rp.click/rp.impression as clickRate ,
+              100*visit/rp.click as visitRate ,100*rp.conversion/visit as conversionRate,ecmp as eCmp,consume   
+            from t_rpt_adv_place rp, t_advertiser, t_order, t_campaign, t_adgroup , t_place      
+
+
+              <where>      
+            rp.place_id = t_place.id and  rp.advertiser_id = t_advertiser.id  
+            and  rp.order_id = t_order.id and rp.campaign_id = t_campaign.id  and rp.adgroup_id =  t_adgroup.id
+	   
+			<if test="advertiserId !=null">
+			 and rp.advertiser_id=#{advertiserId}
+			</if> 
+			
+			<if test="orderId !=null">
+			 and rp.order_id=#{orderId}
+			</if>
+		     
+		     <if test="campaignId !=null">
+			 and rp.campaign_id=#{campaignId}
+			</if>
+			
+			<if test="adGroupId !=null">
+			 and rp.adgroup_id=#{adGroupId}
+			</if>
+		 
+	  		 <if test="startDate!=null and endDate!=null"> 
+            and rp.date &gt;= #{startDate} and #{endDate} &gt;=rp.date
+		        </if>
+		     
+		  </where> 
+		limit #{pager.offset}, #{pager.limit}
+	</select>
+	
+
+		<select id="findByArealCity" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
+		 select 
+	    b.cn,b.cn_city,100*sum(a.pv)/(select sum(pv) from t_rpt_zone_location where date &gt;= #{startDate} and #{endDate} &gt;=date
+		    and operator_id=#{operatorId}
+		) as viewRate,
+	    sum(a.pv) as pv,sum(a.uv) as uv,sum(a.impression),
+	    sum(uimpression) as uImpression, sum(uclick) as uClick,
+	    100*sum(a.impression)/sum(a.pv) as fillRate,sum(a.click),100*sum(a.click)/sum(a.impression) as clickRate,sum(a.eCpm) as eCpm,sum(a.income) as income
+		from t_rpt_zone_location a,t_location b
+		where
+		a.location=b.location and b.cn=#{cn} and date &gt;= #{startDate} and #{endDate} &gt;=date
+		    and operator_id=#{operatorId}
+       group by b.cn_city
+	</select>
+	
+	<!--<select id="findByOrderName" parameterType="map" resultType="DeliverAnalysis">
+		select 
+		t_order.name as orderName,impression,click,visit,conversion,click/impression as clickRate ,visit/click as visitRate ,conversion/visit as conversionRate,eCmp,income
+		from t_rpt_daily
+		left join t_order
+		ON t_rpt_daily.order_id=t_order.id
+		order by order_id desc
+		limit #{pager.offset}, #{pager.limit}
+	</select>
+	
+	<select id="findByCampaignName" parameterType="map" resultType="DeliverAnalysis">
+		select 
+		t_campaign.name as campaignName,impression,click,visit,conversion,click/impression as clickRate ,visit/click as visitRate ,conversion/visit as conversionRate ,eCmp,income
+		from t_rpt_daily
+		left join t_campaign
+		ON t_rpt_daily.campaign_id=t_campaign.id
+		order by campaign_id desc
+		limit #{pager.offset}, #{pager.limit}
+	</select>
+	
+	<select id="findByAdGroupName" parameterType="map" resultType="DeliverAnalysis">
+		select 
+		t_adgroup.name as adGroupName,impression,click,visit,conversion,click/impression as clickRate ,visit/click as visitRate ,conversion/visit as conversionRate ,eCmp,income
+		from t_rpt_daily
+		left join t_adgroup
+		ON t_rpt_daily.adgroup_id=t_adgroup.id
+		order by adgroup_id desc
+		limit #{pager.offset}, #{pager.limit}
+	</select>
+	
+	<select id="findByBannerName" parameterType="map" resultType="DeliverAnalysis">
+		select 
+		t_banner.name as bannerName,impression,click,visit,conversion,click/impression as clickRate ,visit/click as visitRate ,conversion/visit as conversionRate ,eCmp,income
+		from t_rpt_daily
+		left join t_banner
+		ON t_rpt_daily.banner_id=t_banner.id
+		order by banner_id desc
+		limit #{pager.offset}, #{pager.limit}
+	</select>  -->
+	
+	
+	
+	
+	<select id="findByAdvertiser" parameterType="map" resultType="map">
+		select ad.name as advertiserName,date as reportDate,sum(a.consume) as totalConsume,sum(a.impression) as totalImpression,
+sum(click) as totalClick, if(sum(a.impression) > 0,sum(a.click)/sum(a.impression),0)
+		as clickRate from t_rpt_advertiser as a left join t_advertiser ad on a.advertiser_id=ad.id
+		where a.advertiser_id=#{advertiserId}
+		and a.date >= #{startDate} and a.date &lt;=#{endDate}
+		group by date(a.date)
+	</select>
+	
+	<select id="findByAdvertiser3" parameterType="map" resultType="map">
+		select ad.name as advertiserName,date as reportDate,sum(a.consume) as totalConsume,sum(a.impression) as totalImpression,
+sum(click) as totalClick, if(sum(a.impression) > 0,sum(a.click)/sum(a.impression),0)
+		as clickRate from t_rpt_advertiser as a left join t_advertiser ad on a.advertiser_id=ad.id
+		where a.advertiser_id=#{advertiserId}
+		and a.date >= #{startDate} and a.date &lt;=#{endDate}
+		group by date(a.date)
+		limit #{pager.offset}, #{pager.limit} 
+	</select>
+	
+	<select id="findByAreal" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
+		select 
+	    b.cn,b.cn_city,100*sum(a.pv)/(select sum(pv) from t_rpt_zone_location where date &gt;= #{startDate} and #{endDate} &gt;=date
+		    and operator_id=#{operatorId}
+		) as viewRate,
+	    sum(a.pv) as pv,sum(a.uv) as uv,sum(a.impression),
+	    sum(uimpression) as uImpression, sum(uclick) as uClick,
+	    100*sum(a.impression)/sum(a.pv) as fillRate,sum(a.click),100*sum(a.click)/sum(a.impression) as clickRate,sum(a.eCpm) as eCpm,sum(a.income) as income
+		from t_rpt_zone_location a,t_location b
+		where
+		a.location=b.location and b.cn=#{cn} and date &gt;= #{startDate} and #{endDate} &gt;=date
+		    and operator_id=#{operatorId}
+       group by b.cn_city
+	</select>
+	
+	<select id="findByAdvertiser1" parameterType="map" resultType="map">
+		select ad.name as advertiserName,date as reportDate, a.hour as hour,sum(a.consume) as totalConsume,sum(a.impression) as totalImpression,
+sum(click) as totalClick, if(sum(a.impression) > 0,sum(a.click)/sum(a.impression),0)
+		as clickRate from t_rpt_advertiser_hour as a left join t_advertiser ad on a.advertiser_id=ad.id
+		where a.advertiser_id=#{advertiserId} and a.date = #{startDate}
+		group by a.hour
+	</select>
+	
+	<select id="countByPlace" parameterType="map" resultType="int">
+		select count(place_id) from ((select distinct place_id from t_rpt_zone_place where 
+		operator_id = #{operatorId} and date &gt;= #{startDate} and date &lt;= #{endDate}) as a) 
+	</select>
+	
+	
+	<select id="findByAdvertiser2" parameterType="map" resultType="map">
+		select ad.name as advertiserName,date as reportDate, a.hour as hour,sum(a.consume) as totalConsume,sum(a.impression) as totalImpression,
+sum(click) as totalClick, if(sum(a.impression) > 0,sum(a.click)/sum(a.impression),0)
+		as clickRate from t_rpt_advertiser_hour as a left join t_advertiser ad on a.advertiser_id=ad.id
+		where a.advertiser_id=#{advertiserId} and a.date = #{startDate}
+		group by a.hour
+		limit #{pager.offset}, #{pager.limit} 
+	</select>
+	
+	
+		<select id="findByPlace" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
+		select t_place.name as place,sum(p.pv) as pv, sum(p.uv) as uv, sum(p.impression) as impression, 
+		sum(uimpression) as uImpression,
+		sum(uclick) as uClick,sum(p.click) as click, sum(p.ecpm) as eCpm,
+    sum(p.income) as income, 100 * sum(p.pv) / (select sum(pv) from t_rpt_zone_place where operator_id = #{operatorId} and date &gt;= #{startDate} and date &lt;= #{endDate}) as viewRate, 
+    100 * sum(p.impression) / sum(p.pv) as fillRate, 100 * sum(p.click) / sum(p.impression) as clickRate
+    from ((select distinct place_id from t_rpt_zone_place where operator_id = #{operatorId} and date &gt;= #{startDate} and date &lt;= #{endDate}) as a ), 
+    t_rpt_zone_place as p, t_place where a.place_id = p.place_id and a.place_id = t_place.id
+    and operator_id = #{operatorId} and date &gt;= #{startDate} and date &lt;= #{endDate}
+    group by p.place_id
+    order by p.impression desc
+	limit #{pager.offset}, #{pager.limit}
+	</select>
+	
+	<select id="findCountForChart" parameterType="map" resultType="int">
+	select count(date) from((select distinct date from t_rpt_advertiser where advertiser_id=#{advertiserId}
+		and date >= #{startDate} and date &lt;=#{endDate}) as a)
+	</select>
+	
+		<select id="findByPlace1" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
+		select t_place.name as place,sum(p.pv) as pv, sum(p.uv) as uv, sum(p.impression) as impression, 
+		sum(uimpression) as uImpression,
+		sum(uclick) as uClick,sum(p.click) as click, sum(p.ecpm) as eCpm,
+    sum(p.income) as income, 100 * sum(p.pv) / (select sum(pv) from t_rpt_zone_place where operator_id = #{operatorId} and date &gt;= #{startDate} and date &lt;= #{endDate}) as viewRate, 
+    100 * sum(p.impression) / sum(p.pv) as fillRate, 100 * sum(p.click) / sum(p.impression) as clickRate
+    from ((select distinct place_id from t_rpt_zone_place where operator_id = #{operatorId} and date &gt;= #{startDate} and date &lt;= #{endDate}) as a ), 
+    t_rpt_zone_place as p, t_place where a.place_id = p.place_id and a.place_id = t_place.id
+    and operator_id = #{operatorId} and date &gt;= #{startDate} and date &lt;= #{endDate}
+    group by p.place_id
+     order by p.impression desc
+	</select>
+	
+	<select id="findCountForChart1" parameterType="map" resultType="int">
+		select count(hour) from ((select distinct hour from t_rpt_advertiser_hour where advertiser_id=#{advertiserId} and date = #{startDate}) as a) 
+	</select>
+	
+	<select id="findTotalImpressionAndClickByAdvertiserId" parameterType="map" resultType="map">
+		select sum(impression) as totalImpression, sum(click) as totalClick
+		from t_rpt_advertiser 
+		where advertiser_id = #{advertiserId} and date = #{date}
+	</select>
+	
+	<select id="countByApmac" parameterType="map" resultType="int">
+			select count(apmac) from ((select distinct apmac from t_rpt_zone_ap where 
+		operator_id = #{operatorId} and date &gt;= #{startDate} and date &lt;= #{endDate}) as a) 
+	</select>
+	
+	<select id="findTotalImpressionAndClickByAgentId" parameterType="map" resultType="map">
+		select sum(a.impression) as totalImpression, sum(a.click) as totalClick
+		from t_rpt_advertiser  a,t_advertiser b
+		where b.id = a.advertiser_id and b.agent_id = #{agentId}
+		and a.date = #{date}
+	
+	</select>
+	
+	<!--数据报表 导出excel -->
+	<select id="findByTotalForExcelAdvertiser" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
+		select b.name advertiserName,c.name orderName,d.name campaignName,e.name adgroupName,g.name bannerName,a.date reportDate,sum(a.impression) as impression,sum(a.click) as click,100*sum(a.click)/sum(a.impression) as clickRate,sum(a.visit) as visit,100*sum(a.visit)/sum(a.click) as visitRate,sum(a.conversion) conversion,100*sum(a.conversion)/sum(a.visit) as conversionRate,sum(a.ecmp) ecmp,sum(a.consume) as consume 
+		from t_rpt_advertiser a,t_advertiser b,t_order c,t_campaign d,t_adgroup e,t_banner f,t_banner_template g
+		where a.advertiser_id=b.id and a.order_id=c.id and a.campaign_id=d.id and a.adgroup_id=e.id and a.banner_id=f.id and f.banner_template_id=g.id
+		<if test="advertiserId != null and advertiserId ">
+			and a.advertiser_id = #{advertiserId}
+		</if>
+		<if test="orderId != null and orderId != ''">
+			and a.order_id = #{orderId}
+		</if>
+		<if test="campaginId != null and campaginId != ''">
+			and a.campagin_id = #{campaginId}
+		</if>
+		<if test="adgroupId != null and adgroupId != ''">
+			and a.adgroup_id = #{adgroupId}
+		</if>
+		<if test="startDate != null and startDate != ''and endDate != nul and endDate != ''">
+			and a.date &gt;=#{startDate} and a.date &lt;=#{endDate}
+		</if>
+		<choose>
+			<when test="dimensionStr != null and dimensionStr != ''">
+				GROUP BY ${dimensionStr}
+			</when>
+			<otherwise>
+				group by reportDate 
+			</otherwise>
+		</choose>		
+	</select>
+	
+	<select id="findByApmac" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
+		select apmac, sum(pv) as pv, sum(uv) as uv, sum(impression) as impression, 
+		sum(uimpression) as uImpression,
+		sum(uclick) as uClick,sum(click) as click, sum(ecpm) as eCpm,
+    sum(income) as income, 100 * sum(pv) / (select sum(pv) from t_rpt_zone_ap where operator_id = #{operatorId} and date &gt;= #{startDate} and date &lt;= #{endDate}) as viewRate, 
+    100 * sum(impression) / sum(pv) as fillRate, 100 * sum(click) / sum(impression) as clickRate
+    from  t_rpt_zone_ap  where 
+    operator_id = #{operatorId} and date &gt;= #{startDate} and date &lt;= #{endDate}
+    group by apmac
+    order by impression desc
+	limit #{pager.offset}, #{pager.limit}
+	</select>
+	
+	<select id="findByLocationForExcel" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
+		select t_location.cn_city as location, 100 * sum(impression) /(select sum(impression) from t_rpt_adv_location a1,t_advertiser b1	
+		<where>	
+       	a1.advertiser_id = b1.id and a1.date &gt;= #{startDate} and #{endDate} &gt;=a1.date
+			<if test="advertiserId ==null">
+			 and b1.agent_id=#{agentId}
+			</if>
+			<if test="advertiserId != null">
+			and a1.advertiser_id = #{advertiserId}	
+			</if>
+			<if test="orderId !=null">
+			 and a1.order_id=#{orderId}
+			</if>
+		     <if test="campaignId !=null">
+			 and a1.campaign_id=#{campaignId}
+			</if>
+			<if test="adGroupId !=null">
+			 and a1.adgroup_id=#{adGroupId}
+			</if>
+		</where>
+		) as impressionRate, sum(impression) as impression, sum(click) as click, 100 * sum(click) / sum(impression) as clickRate,
+		sum(visit) as visit, 100 * sum(visit) / sum(click) as visitRate, 100 * sum(conversion) / sum(visit) as conversionRate,
+		sum(conversion) as conversion, sum(ecmp) as eCmp, sum(consume) as consume from t_rpt_adv_location a, t_advertiser b,t_location
+		 	<where>	
+       	a.advertiser_id = b.id and a.location = t_location.location and a.date &gt;= #{startDate} and #{endDate} &gt;=a.date
+			<if test="advertiserId ==null">
+			 and b.agent_id=#{agentId}
+			</if>
+			<if test="advertiserId != null">
+			and a.advertiser_id = #{advertiserId}	
+			</if>
+			<if test="orderId !=null">
+			 and a.order_id=#{orderId}
+			</if>
+		     <if test="campaignId !=null">
+			 and a.campaign_id=#{campaignId}
+			</if>
+			<if test="adGroupId !=null">
+			 and a.adgroup_id=#{adGroupId}
+			</if>
+		</where>
+		group by a.location
+	   </select>
+	
+		<select id="findByApmac1" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
+			select apmac, sum(pv) as pv, sum(uv) as uv, sum(impression) as impression, 
+		sum(uimpression) as uImpression,
+		sum(uclick) as uClick,sum(click) as click, sum(ecpm) as eCpm,
+    sum(income) as income, 100 * sum(pv) / (select sum(pv) from t_rpt_zone_ap where operator_id = #{operatorId} and date &gt;= #{startDate} and date &lt;= #{endDate}) as viewRate, 
+    100 * sum(impression) / sum(pv) as fillRate, 100 * sum(click) / sum(impression) as clickRate
+    from  t_rpt_zone_ap  where 
+    operator_id = #{operatorId} and date &gt;= #{startDate} and date &lt;= #{endDate}
+    group by apmac
+    order by impression desc
+	</select>
+	
+	<!-- 导出excel -->
+	<select id="findByTotalForExcelBack" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
+		select 
+		t_advertiser.name as advertiserName,  t_order.name as orderName, t_campaign.name as campaignName, t_adgroup.name  as adGroupName, t_banner_template.name as bannerName, 
+        
+         ad.date as reportDate,     
+        (select sum(t_rpt_advertiser.impression) from  t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
+	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
+            and  t_rpt_advertiser.banner_id=t_banner.id 
+            and  t_banner.banner_template_id = t_banner_template.id 
+
+			<if test="advertiserId !=null">
+			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
+			</if>
+			<if test="orderId !=null">
+			 and t_rpt_advertiser.order_id=#{orderId}
+			</if>
+			  
+		     <if test="campaignId !=null">
+			 and t_rpt_advertiser.campaign_id=#{campaignId}
+			</if>
+			
+			<if test="adGroupId !=null">
+			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
+			</if>
+		 
+	    <if test="startDate!=null and endDate!=null"> 
+            and date &gt;= #{startDate} and #{endDate} &gt;=date
+	    </if>) as impressionSum,ad.impression,ad.click,visit,ad.conversion, 
+        100*ad.click/ad.impression as clickRate ,100*visit/ad.click as visitRate ,100*ad.conversion/visit as conversionRate ,ecmp as eCmp,ad.consume,
+		(select sum(t_rpt_advertiser.click) from t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
+	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
+            and  t_rpt_advertiser.banner_id=t_banner.id 
+            and  t_banner.banner_template_id = t_banner_template.id 
+
+			<if test="advertiserId !=null">
+			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
+			</if>
+			<if test="orderId !=null">
+			 and t_rpt_advertiser.order_id=#{orderId}
+			</if>
+			  
+		     <if test="campaignId !=null">
+			 and t_rpt_advertiser.campaign_id=#{campaignId}
+			</if>
+			
+			<if test="adGroupId !=null">
+			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
+			</if>
+		 
+	    <if test="startDate!=null and endDate!=null"> 
+            and date &gt;= #{startDate} and #{endDate} &gt;=date
+	    </if>) as clickSum, (select sum(t_rpt_advertiser.visit) from t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
+	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
+            and  t_rpt_advertiser.banner_id=t_banner.id 
+            and  t_banner.banner_template_id = t_banner_template.id 
+
+			<if test="advertiserId !=null">
+			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
+			</if>
+			<if test="orderId !=null">
+			 and t_rpt_advertiser.order_id=#{orderId}
+			</if>
+			  
+		     <if test="campaignId !=null">
+			 and t_rpt_advertiser.campaign_id=#{campaignId}
+			</if>
+			
+			<if test="adGroupId !=null">
+			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
+			</if>
+		 
+	    <if test="startDate!=null and endDate!=null"> 
+            and date &gt;= #{startDate} and #{endDate} &gt;=date
+	    </if>) as visitSum,
+        (select sum(t_rpt_advertiser.conversion) from t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
+	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
+            and  t_rpt_advertiser.banner_id=t_banner.id 
+            and  t_banner.banner_template_id = t_banner_template.id 
+
+			<if test="advertiserId !=null">
+			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
+			</if>
+			<if test="orderId !=null">
+			 and t_rpt_advertiser.order_id=#{orderId}
+			</if>
+			  
+		     <if test="campaignId !=null">
+			 and t_rpt_advertiser.campaign_id=#{campaignId}
+			</if>
+			
+			<if test="adGroupId !=null">
+			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
+			</if>
+		 
+	    <if test="startDate!=null and endDate!=null"> 
+            and date &gt;= #{startDate} and #{endDate} &gt;=date
+	    </if>) as conversionSum, 
+		(select sum(t_rpt_advertiser.ecmp) from t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
+	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
+            and  t_rpt_advertiser.banner_id=t_banner.id 
+            and  t_banner.banner_template_id = t_banner_template.id 
+
+			<if test="advertiserId !=null">
+			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
+			</if>
+			<if test="orderId !=null">
+			 and t_rpt_advertiser.order_id=#{orderId}
+			</if>
+			  
+		     <if test="campaignId !=null">
+			 and t_rpt_advertiser.campaign_id=#{campaignId}
+			</if>
+			
+			<if test="adGroupId !=null">
+			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
+			</if>
+		 
+	    <if test="startDate!=null and endDate!=null"> 
+            and date &gt;= #{startDate} and #{endDate} &gt;=date
+	    </if>) as eCmpSum, (select sum(t_rpt_advertiser.consume) from t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
+	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
+            and  t_rpt_advertiser.banner_id=t_banner.id 
+            and  t_banner.banner_template_id = t_banner_template.id 
+
+			<if test="advertiserId !=null">
+			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
+			</if>
+			<if test="orderId !=null">
+			 and t_rpt_advertiser.order_id=#{orderId}
+			</if>
+			  
+		     <if test="campaignId !=null">
+			 and t_rpt_advertiser.campaign_id=#{campaignId}
+			</if>
+			
+			<if test="adGroupId !=null">
+			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
+			</if>
+		 
+	    <if test="startDate!=null and endDate!=null"> 
+            and date &gt;= #{startDate} and #{endDate} &gt;=date
+	    </if>) as consumeSum, 
+        100*(select sum(t_rpt_advertiser.click) from t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
+	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
+            and  t_rpt_advertiser.banner_id=t_banner.id 
+            and  t_banner.banner_template_id = t_banner_template.id 
+
+			<if test="advertiserId !=null">
+			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
+			</if>
+			<if test="orderId !=null">
+			 and t_rpt_advertiser.order_id=#{orderId}
+			</if>
+			  
+		     <if test="campaignId !=null">
+			 and t_rpt_advertiser.campaign_id=#{campaignId}
+			</if>
+			
+			<if test="adGroupId !=null">
+			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
+			</if>
+		 
+	    <if test="startDate!=null and endDate!=null"> 
+            and date &gt;= #{startDate} and #{endDate} &gt;=date
+	    </if>)/(select sum(t_rpt_advertiser.impression) from t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
+	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
+            and  t_rpt_advertiser.banner_id=t_banner.id 
+            and  t_banner.banner_template_id = t_banner_template.id 
+
+			<if test="advertiserId !=null">
+			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
+			</if>
+			<if test="orderId !=null">
+			 and t_rpt_advertiser.order_id=#{orderId}
+			</if>
+			  
+		     <if test="campaignId !=null">
+			 and t_rpt_advertiser.campaign_id=#{campaignId}
+			</if>
+			
+			<if test="adGroupId !=null">
+			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
+			</if>
+		 
+	    <if test="startDate!=null and endDate!=null"> 
+            and date &gt;= #{startDate} and #{endDate} &gt;=date
+	    </if>) as clickRatesum, 
+		100*(select sum(t_rpt_advertiser.visit) from t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
+	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
+            and  t_rpt_advertiser.banner_id=t_banner.id 
+            and  t_banner.banner_template_id = t_banner_template.id 
+
+			<if test="advertiserId !=null">
+			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
+			</if>
+			<if test="orderId !=null">
+			 and t_rpt_advertiser.order_id=#{orderId}
+			</if>
+			  
+		     <if test="campaignId !=null">
+			 and t_rpt_advertiser.campaign_id=#{campaignId}
+			</if>
+			
+			<if test="adGroupId !=null">
+			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
+			</if>
+		 
+	    <if test="startDate!=null and endDate!=null"> 
+            and date &gt;= #{startDate} and #{endDate} &gt;=date
+	    </if>)/(select sum(t_rpt_advertiser.click) from t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
+	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
+            and  t_rpt_advertiser.banner_id=t_banner.id 
+            and  t_banner.banner_template_id = t_banner_template.id 
+
+			<if test="advertiserId !=null">
+			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
+			</if>
+			<if test="orderId !=null">
+			 and t_rpt_advertiser.order_id=#{orderId}
+			</if>
+			  
+		     <if test="campaignId !=null">
+			 and t_rpt_advertiser.campaign_id=#{campaignId}
+			</if>
+			
+			<if test="adGroupId !=null">
+			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
+			</if>
+		 
+	    <if test="startDate!=null and endDate!=null"> 
+            and date &gt;= #{startDate} and #{endDate} &gt;=date
+	    </if>) as visitRatesum,
+		100*(select sum(t_rpt_advertiser.conversion) from t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
+	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
+            and  t_rpt_advertiser.banner_id=t_banner.id 
+            and  t_banner.banner_template_id = t_banner_template.id 
+
+			<if test="advertiserId !=null">
+			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
+			</if>
+			<if test="orderId !=null">
+			 and t_rpt_advertiser.order_id=#{orderId}
+			</if>
+			  
+		     <if test="campaignId !=null">
+			 and t_rpt_advertiser.campaign_id=#{campaignId}
+			</if>
+			
+			<if test="adGroupId !=null">
+			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
+			</if>
+		 
+	    <if test="startDate!=null and endDate!=null"> 
+            and date &gt;= #{startDate} and #{endDate} &gt;=date
+	    </if>)/(select sum(t_rpt_advertiser.visit) from t_rpt_advertiser ,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template where  t_rpt_advertiser.advertiser_id=t_advertiser.id  and  t_rpt_advertiser.order_id = t_order.id  and t_rpt_advertiser.campaign_id= t_campaign.id   
+	 	    and  t_rpt_advertiser.adgroup_id=t_adgroup.id
+            and  t_rpt_advertiser.banner_id=t_banner.id 
+            and  t_banner.banner_template_id = t_banner_template.id 
+
+			<if test="advertiserId !=null">
+			 and t_rpt_advertiser.advertiser_id=#{advertiserId}
+			</if>
+			<if test="orderId !=null">
+			 and t_rpt_advertiser.order_id=#{orderId}
+			</if>
+			  
+		     <if test="campaignId !=null">
+			 and t_rpt_advertiser.campaign_id=#{campaignId}
+			</if>
+			
+			<if test="adGroupId !=null">
+			 and t_rpt_advertiser.adgroup_id=#{adGroupId}
+			</if>
+		 
+	    <if test="startDate!=null and endDate!=null"> 
+            and date &gt;= #{startDate} and #{endDate} &gt;=date
+	    </if>) as conversionRatesum
+		
+		from t_rpt_advertiser ad,t_advertiser,t_order, t_campaign, t_banner, t_adgroup, t_banner_template
+           
+           
+           <where>
+	 	    ad.advertiser_id=t_advertiser.id  and  ad.order_id = t_order.id  and ad.campaign_id= t_campaign.id   
+	 	    and  ad.adgroup_id=t_adgroup.id
+            and  ad.banner_id=t_banner.id 
+            and  t_banner.banner_template_id = t_banner_template.id
+
+			<if test="advertiserId !=null">
+			 and ad.advertiser_id=#{advertiserId}
+			</if>
+			
+			<if test="orderId !=null">
+			 and ad.order_id=#{orderId}
+			</if>
+			  
+		     <if test="campaignId !=null">
+			 and ad.campaign_id=#{campaignId}
+			</if>
+			
+			<if test="adGroupId !=null">
+			 and ad.adgroup_id=#{adGroupId}
+			</if>
+		 
+	
+	    <if test="startDate!=null and endDate!=null"> 
+            and date &gt;= #{startDate} and #{endDate} &gt;=date
+	    </if>
+	  
+		  </where> 
+		
+	</select>
+	
+	<select id="findAllArea" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
+		select 
+	    a.id,a.date as reportDate,b.cn,b.cn_city,100*sum(a.pv)/(select sum(pv) from t_rpt_zone_location where date &gt;= #{startDate} and #{endDate} &gt;=date
+		<if test="operatorId!=null">
+		    and operator_id=#{operatorId}
+		</if>) as viewRate,
+	    sum(a.pv) as pv,sum(a.uv) as uv,sum(a.impression) as impression,
+	    sum(uimpression) as uImpression, sum(uclick) as uClick,
+	    100*sum(a.impression)/sum(a.pv) as fillRate,sum(a.click) as click,100*sum(a.click)/sum(a.impression) as clickRate,sum(a.eCpm) as eCpm,sum(a.income) as income
+		from t_rpt_zone_location a,t_location b
+	 	where
+		a.location = b.location  and a.date &gt;= #{startDate} and #{endDate} &gt;=a.date
+		<if test="operatorId!=null">
+		    and operator_id=#{operatorId}
+		</if>
+		group by b.cn 
+		order by b.cn
+	</select>
+	
+	<select id="findByOsForExcel" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
+		select 
+		t_advertiser.name as advertiserName,  t_order.name as orderName, t_campaign.name as campaignName, t_adgroup.name  as adGroupName,
+
+              ros.date as reportDate,
+        ros.impression,ros.click,visit,ros.conversion,os,
+        100*ros.impression/(select sum(impression) from t_rpt_adv_os) as impressionRate,100*ros.click/ros.impression as clickRate ,
+        100*visit/ros.click as visitRate ,100*ros.conversion/visit as conversionRate,ecmp as eCmp,consume   
+        from t_rpt_adv_os ros, t_advertiser, t_order, t_campaign, t_adgroup        
+
+
+            <where>	          
+         
+           ros.advertiser_id = t_advertiser.id  and  ros.order_id =  t_order.id and ros.campaign_id = t_campaign.id  and ros.adgroup_id =  t_adgroup.id
+		     	   
+			<if test="advertiserId !=null">
+			 and ros.advertiser_id=#{advertiserId}
+			</if> 
+			
+			<if test="orderId !=null">
+			 and ros.order_id=#{orderId}
+			</if>
+		     
+		     <if test="campaignId !=null">
+			 and ros.campaign_id=#{campaignId}
+			</if>
+			
+			<if test="adGroupId !=null">
+			 and ros.adgroup_id=#{adGroupId}
+			</if>
+			
+	 		<if test="startDate!=null and endDate!=null"> 
+            and ros.date &gt;= #{startDate} and #{endDate} &gt;=ros.date
+		     </if>
+	
+		   </where> 
+
+	</select>
+	
+	 <select id="findByPlaceNameForExcel" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
+		select 
+	             t_place.name as placeName,	t_advertiser.name as advertiserName,  t_order.name as orderName, 
+	             t_campaign.name as campaignName, t_adgroup.name as adGroupName,
+	             
+	              rp.date as reportDate,
+                  rp.impression,rp.click,visit,rp.conversion,
+              100*rp.impression/(select sum(impression) from t_rpt_adv_place) as impressionRate,100*rp.click/rp.impression as clickRate ,
+              100*visit/rp.click as visitRate ,100*rp.conversion/visit as conversionRate,ecmp as eCmp,consume   
+            from t_rpt_adv_place rp, t_advertiser, t_order, t_campaign, t_adgroup , t_place      
+
+
+              <where>      
+            rp.place_id = t_place.id and  rp.advertiser_id = t_advertiser.id  
+            and  rp.order_id = t_order.id and rp.campaign_id = t_campaign.id  and rp.adgroup_id =  t_adgroup.id
+	   
+			<if test="advertiserId !=null">
+			 and rp.advertiser_id=#{advertiserId}
+			</if> 
+			
+			<if test="orderId !=null">
+			 and rp.order_id=#{orderId}
+			</if>
+		     
+		     <if test="campaignId !=null">
+			 and rp.campaign_id=#{campaignId}
+			</if>
+			
+			<if test="adGroupId !=null">
+			 and rp.adgroup_id=#{adGroupId}
+			</if>
+		 
+	  		 <if test="startDate!=null and endDate!=null"> 
+            and rp.date &gt;= #{startDate} and #{endDate} &gt;=rp.date
+		        </if>
+		     
+		  </where> 
+	</select>
+	
 </mapper>

+ 154 - 135
src/main/java/com/cloudcross/ssp/service/IAdReportService.java

@@ -1,135 +1,154 @@
-package com.cloudcross.ssp.service;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.cloudcross.ssp.base.service.IGenericService;
-import com.cloudcross.ssp.common.utils.Pager;
-import com.cloudcross.ssp.model.DeliverAnalysis;
-
-/**
- * 报表服务
- * @author chenyou
- *
- */
-public interface IAdReportService extends IGenericService<DeliverAnalysis>{
-	
-    int findCountForDeliverEffectAnalysisAdvertiser(Map<String, Object> paramMap);
-    int findCountForDeliverEffectAnalysisOperator(Map<String, Object> paramMap);
-    int findCountForDeliverEffectAnalysisBack(Map<String, Object> paramMap);
-    
-    int findCountForDeliverEffectAnalysis2(Map<String, Object> paramMap);
-	
-	int findCountForLocationAdvertiser(Map<String, Object> paramMap);
-	int findCountForLocationBack(Map<String, Object> paramMap);
-	
-	int findCountForOs(Map<String, Object> paramMap);
-	
-	int findCountForScene(Map<String, Object> paramMap);
-	
-
-	
-	List<DeliverAnalysis> findByTotalReportAdvertiser(Map<String, Object> paramMap, Pager pager);
-	List<DeliverAnalysis> findByTotalReportBack(Map<String, Object> paramMap, Pager pager);
-	
-	
-	List<DeliverAnalysis> findByTotalReport2(Map<String, Object> paramMap, Pager pager);
-	
-	
-    List<DeliverAnalysis> findByPlaceName(Map<String, Object> paramMap, Pager pager);
-    List<DeliverAnalysis> findByLocationAdvertiser(Map<String, Object> paramMap, Pager pager);
-    List<DeliverAnalysis> findByLocationBack(Map<String, Object> paramMap, Pager pager);
-    
-    List<DeliverAnalysis> findByOs(Map<String, Object> paramMap, Pager pager);
-
-	
-	//首页顶部统计数据查询
-	Map<String,Object> findCompare(Map<String, Object> paramMap);
-	
-	//查询首页图表
-	List<HashMap<String, Object>> findChart(String startDate, String endDate, Long advertiserId);
-	
-	int findCountForChart(String startDate, String endDate, Long advertiserId);
-	
-	List<HashMap<String, Object>> findChart(String startDate, String endDate, Long advertiserId, Pager pager);
-	/**
-	 * 根据广告主id和时间查询它的总的曝光数和点击数
-	 */
-	HashMap<String, Object> findTotalImpressionAndClickByAdvertiserId(Map<String, Object> paramMap);
-	
-	/**
-	 * 根据代理商id查询该代理商下的所有广告主的曝光数和点击数的总和
-	 */
-	HashMap<String, Object> findTotalImpressionAndClickByAgentId(Map<String, Object> paramMap);
-	
-	/**
-	 * 导出excel报表
-	 */
-	List<DeliverAnalysis> findByTotalForExcelAdvertiser(Map<String, Object> paramMap);
-	List<DeliverAnalysis> findByTotalForExcelBack(Map<String, Object> paramMap);
-	List<DeliverAnalysis> findByTotalForExcelOperator(Map<String, Object> paramMap);
-	
-    List<DeliverAnalysis> findByPlaceName(Map<String, Object> paramMap);
-    
-    List<DeliverAnalysis> findByLocation(Map<String, Object> paramMap);
-    
-    List<DeliverAnalysis> findByOs(Map<String, Object> paramMap);
-    
-    List<DeliverAnalysis> findDeliverEffectAnalysisOperator(
-			Map<String, Object> paramMap, Pager pager);
-	List<DeliverAnalysis> findDeliverEffectAnalysisOperator(
-			Map<String, Object> paramMap);
-	
-	int countBySizeOperator(Map<String, Object> paramMap);
-	List<DeliverAnalysis> findBySizeOperator(
-			Map<String, Object> paramMap, Pager pager);
-	List<DeliverAnalysis> findBySizeOperator(
-			Map<String, Object> paramMap);
-	
-	List<DeliverAnalysis> findByPositionOperator(
-			Map<String, Object> paramMap);
-	
-	int countBySystemOperator(Map<String, Object> paramMap);
-	
-	List<DeliverAnalysis> findBySystemOperator(
-			Map<String, Object> paramMap, Pager pager);
-	
-	List<DeliverAnalysis> findBySystemOperator(
-			Map<String, Object> paramMap);
-	
-	List<DeliverAnalysis> findByDeviceOperator(
-			Map<String, Object> paramMap);
-	
-	List<DeliverAnalysis> findByArealCityOperator(
-			Map<String, Object> paramMap);
-	
-	List<DeliverAnalysis> findByArealOperator(
-			Map<String, Object> paramMap);
-	
-	int countByPlaceOperator(Map<String, Object> paramMap);
-	
-	List<DeliverAnalysis> findByPlaceOperator(
-			Map<String, Object> paramMap, Pager pager);
-	
-	List<DeliverAnalysis> findByPlaceOperator(
-			Map<String, Object> paramMap);
-	
-	int countByApmacOperator(Map<String, Object> paramMap);
-	
-	List<DeliverAnalysis> findByApmacOperator(
-			Map<String, Object> paramMap, Pager pager);
-	
-	List<DeliverAnalysis> findByApmacOperator(
-			Map<String, Object> paramMap);
-	
-	int countByAllArealOperator(Map<String, Object> paramMap);
-	
-	List<DeliverAnalysis> findByAllArealOperator(
-			Map<String, Object> paramMap, Pager pager);
-	
-	 //根据查询条件查询总的pv,uv,曝光数等等
-    DeliverAnalysis findSumOperator(Map<String, Object> paramMap);
-    
-    List<DeliverAnalysis> findAllAreaOperator(Map<String, Object> paramMap);
-}
+package com.cloudcross.ssp.service;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.cloudcross.ssp.base.service.IGenericService;
+import com.cloudcross.ssp.common.utils.Pager;
+import com.cloudcross.ssp.model.DeliverAnalysis;
+
+/**
+ * 报表服务
+ * @author chenyou
+ *
+ */
+public interface IAdReportService extends IGenericService<DeliverAnalysis>{
+	
+    int findCountForDeliverEffectAnalysisAdvertiser(Map<String, Object> paramMap);
+    int findCountForDeliverEffectAnalysisOperator(Map<String, Object> paramMap);
+    int findCountForDeliverEffectAnalysisBack(Map<String, Object> paramMap);
+    /**
+	 * 查询创意报表总数
+	 * @param paramMap 条件
+	 * @return
+	 */
+	int findCountForBanner(Map<String, Object> paramMap);
+	/**
+	 * 根据条件查询创意报表
+	 * @param paramMap
+	 * @param pager
+	 * @return
+	 */
+	List<DeliverAnalysis> findBannerByConditions(Map<String, Object> paramMap);
+	
+	/**
+	 * 创意报表导出
+	 * @param paramMap
+	 * @return
+	 */
+	List<DeliverAnalysis> exportBannerListList(Map<String, Object> paramMap);
+    int findCountForDeliverEffectAnalysis2(Map<String, Object> paramMap);
+	
+	int findCountForLocationAdvertiser(Map<String, Object> paramMap);
+	int findCountForLocationBack(Map<String, Object> paramMap);
+	
+	int findCountForOs(Map<String, Object> paramMap);
+	
+	int findCountForScene(Map<String, Object> paramMap);
+	
+
+	
+	List<DeliverAnalysis> findByTotalReportAdvertiser(Map<String, Object> paramMap, Pager pager);
+	List<DeliverAnalysis> findByTotalReportBack(Map<String, Object> paramMap, Pager pager);
+	
+	
+	List<DeliverAnalysis> findByTotalReport2(Map<String, Object> paramMap, Pager pager);
+	
+	
+    List<DeliverAnalysis> findByPlaceName(Map<String, Object> paramMap, Pager pager);
+    List<DeliverAnalysis> findByLocationAdvertiser(Map<String, Object> paramMap, Pager pager);
+    List<DeliverAnalysis> findByLocationBack(Map<String, Object> paramMap, Pager pager);
+    
+    List<DeliverAnalysis> findByOs(Map<String, Object> paramMap, Pager pager);
+
+	
+	//首页顶部统计数据查询
+	Map<String,Object> findCompare(Map<String, Object> paramMap);
+	
+	//查询首页图表
+	List<HashMap<String, Object>> findChart(String startDate, String endDate, Long advertiserId);
+	
+	int findCountForChart(String startDate, String endDate, Long advertiserId);
+	
+	List<HashMap<String, Object>> findChart(String startDate, String endDate, Long advertiserId, Pager pager);
+	/**
+	 * 根据广告主id和时间查询它的总的曝光数和点击数
+	 */
+	HashMap<String, Object> findTotalImpressionAndClickByAdvertiserId(Map<String, Object> paramMap);
+	
+	/**
+	 * 根据代理商id查询该代理商下的所有广告主的曝光数和点击数的总和
+	 */
+	HashMap<String, Object> findTotalImpressionAndClickByAgentId(Map<String, Object> paramMap);
+	
+	/**
+	 * 导出excel报表
+	 */
+	List<DeliverAnalysis> findByTotalForExcelAdvertiser(Map<String, Object> paramMap);
+	List<DeliverAnalysis> findByTotalForExcelBack(Map<String, Object> paramMap);
+	List<DeliverAnalysis> findByTotalForExcelOperator(Map<String, Object> paramMap);
+	
+    List<DeliverAnalysis> findByPlaceName(Map<String, Object> paramMap);
+    
+    List<DeliverAnalysis> findByLocation(Map<String, Object> paramMap);
+    
+    List<DeliverAnalysis> findByOs(Map<String, Object> paramMap);
+    
+    List<DeliverAnalysis> findDeliverEffectAnalysisOperator(
+			Map<String, Object> paramMap, Pager pager);
+	List<DeliverAnalysis> findDeliverEffectAnalysisOperator(
+			Map<String, Object> paramMap);
+	
+	int countBySizeOperator(Map<String, Object> paramMap);
+	List<DeliverAnalysis> findBySizeOperator(
+			Map<String, Object> paramMap, Pager pager);
+	List<DeliverAnalysis> findBySizeOperator(
+			Map<String, Object> paramMap);
+	
+	List<DeliverAnalysis> findByPositionOperator(
+			Map<String, Object> paramMap);
+	
+	int countBySystemOperator(Map<String, Object> paramMap);
+	
+	List<DeliverAnalysis> findBySystemOperator(
+			Map<String, Object> paramMap, Pager pager);
+	
+	List<DeliverAnalysis> findBySystemOperator(
+			Map<String, Object> paramMap);
+	
+	List<DeliverAnalysis> findByDeviceOperator(
+			Map<String, Object> paramMap);
+	
+	List<DeliverAnalysis> findByArealCityOperator(
+			Map<String, Object> paramMap);
+	
+	List<DeliverAnalysis> findByArealOperator(
+			Map<String, Object> paramMap);
+	
+	int countByPlaceOperator(Map<String, Object> paramMap);
+	
+	List<DeliverAnalysis> findByPlaceOperator(
+			Map<String, Object> paramMap, Pager pager);
+	
+	List<DeliverAnalysis> findByPlaceOperator(
+			Map<String, Object> paramMap);
+	
+	int countByApmacOperator(Map<String, Object> paramMap);
+	
+	List<DeliverAnalysis> findByApmacOperator(
+			Map<String, Object> paramMap, Pager pager);
+	
+	List<DeliverAnalysis> findByApmacOperator(
+			Map<String, Object> paramMap);
+	
+	int countByAllArealOperator(Map<String, Object> paramMap);
+	
+	List<DeliverAnalysis> findByAllArealOperator(
+			Map<String, Object> paramMap, Pager pager);
+	
+	 //根据查询条件查询总的pv,uv,曝光数等等
+    DeliverAnalysis findSumOperator(Map<String, Object> paramMap);
+    
+    List<DeliverAnalysis> findAllAreaOperator(Map<String, Object> paramMap);
+}

+ 593 - 575
src/main/java/com/cloudcross/ssp/service/impl/AdReportService.java

@@ -1,575 +1,593 @@
-package com.cloudcross.ssp.service.impl;
-
-import java.text.DecimalFormat;
-import java.text.NumberFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import com.cloudcross.ssp.base.dao.GenericIBatisDao;
-import com.cloudcross.ssp.common.utils.MapBuilder;
-import com.cloudcross.ssp.common.utils.Pager;
-import com.cloudcross.ssp.model.Advertiser;
-import com.cloudcross.ssp.model.DeliverAnalysis;
-import com.cloudcross.ssp.service.IAccountService;
-import com.cloudcross.ssp.service.IAdReportService;
-import com.cloudcross.ssp.service.IAdvertiserService;
-
-
-@Service
-public class AdReportService implements IAdReportService {
-	@Autowired
-	private GenericIBatisDao iBatisDao;
-	@Autowired
-	private IAdvertiserService advertiserService;
-	@Autowired
-	private IAccountService accountService;
-	
-	@Override
-	public DeliverAnalysis findById(Long id) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	@Override
-	public int countByParams(Map<String, Object> paramMap) {
-		// TODO Auto-generated method stub
-		return 0;
-	}
-
-	@Override
-	public List<DeliverAnalysis> findByParams(Map<String, Object> paramMap,
-			Pager pager) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	@Override
-	public boolean add(DeliverAnalysis t) {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-	@Override
-	public boolean edit(DeliverAnalysis t) {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-	@Override
-	public boolean updateStatus(List<Long> idList, int status) {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-	@Override
-	public int findCountForDeliverEffectAnalysisAdvertiser(Map<String, Object> paramMap) {
-		return iBatisDao.get("adReportSqlMapper.findCountForDeliverEffectAnalysisAdvertiser", paramMap);
-	}
-
-	@Override
-	public int findCountForDeliverEffectAnalysis2(Map<String, Object> paramMap) {
-		// TODO Auto-generated method stub
-		return 0;
-	}
-
-	@Override
-	public int findCountForLocationAdvertiser(Map<String, Object> paramMap) {
-		return iBatisDao.get("adReportSqlMapper.findCountForLocationAdvertiser", paramMap);
-	}
-
-	@Override
-	public int findCountForOs(Map<String, Object> paramMap) {
-		return iBatisDao.get("adReportSqlMapper.findCountForOs", paramMap);
-	}
-
-	@Override
-	public int findCountForScene(Map<String, Object> paramMap) {
-		return iBatisDao.get("adReportSqlMapper.findCountForScene", paramMap);
-	}
-
-	@Override
-	public List<DeliverAnalysis> findByTotalReportAdvertiser(
-			Map<String, Object> paramMap, Pager pager) {
-		paramMap.put("pager", pager);
-		return iBatisDao.getList("adReportSqlMapper.findByTotalReportAdvertiser", paramMap);
-	}
-
-	@Override
-	public List<DeliverAnalysis> findByTotalReport2(
-			Map<String, Object> paramMap, Pager pager) {
-		paramMap.put("pager", pager);
-		return iBatisDao.getList("adReportSqlMapper.findByTotalReport2", paramMap);
-	}
-
-	@Override
-	public List<DeliverAnalysis> findByPlaceName(Map<String, Object> paramMap,
-			Pager pager) {
-		paramMap.put("pager", pager);
-		return iBatisDao.getList("adReportSqlMapper.findByPlaceName", paramMap);
-	}
-
-	@Override
-	public List<DeliverAnalysis> findByLocationAdvertiser(Map<String, Object> paramMap,
-			Pager pager) {
-		paramMap.put("pager", pager);
-		return iBatisDao.getList("adReportSqlMapper.findByLocationAdvertiser", paramMap);
-	}
-
-	@Override
-	public List<DeliverAnalysis> findByOs(Map<String, Object> paramMap,
-			Pager pager) {
-		paramMap.put("pager", pager);
-		return iBatisDao.getList("adReportSqlMapper.findByOs", paramMap);
-	}
-
-	@Override
-	public Map<String, Object> findCompare(Map<String, Object> paramMap) {
-		Long advertiserId = null;
-		Long agentId = null;
-		
-		/**
-		 * 判断下是广告主,还是代理商
-		 */
-		if (!paramMap.containsKey("advertiserId")) {
-			advertiserId = null;
-		} else {
-			if (paramMap.get("advertiserId") != null
-					&& !"".equals(paramMap.get("advertiserId"))) {
-				advertiserId = Long.parseLong((String) paramMap
-						.get("advertiserId"));
-			} else {
-				advertiserId = null;
-			}
-		}
-		
-		
-		if (!paramMap.containsKey("agentId")) {
-			agentId = null;
-		} else {
-			if (paramMap.get("agentId") != null
-					&& !"".equals(paramMap.get("agentId"))) {
-				agentId = Long.parseLong(String.valueOf(paramMap.get("agentId")));
-			} else {
-				agentId = null;
-			}
-		}
-		
-		//查询用户当前余额
-		//格式化
-		DecimalFormat df = (DecimalFormat)NumberFormat.getInstance(Locale.CHINESE);
-		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
-		df.applyPattern("0.00");
-		Map<String,Object> compareMap = new HashMap<String,Object>();
-		/**
-		 * 先判断传递进来的是一个广告主id,还是代理商id
-		 * 如果广告主id不为空,则为广告主账号,如果是代理商id不为空则为代理商账号
-		 */
-		if(null != advertiserId) {
-			Map<String, Object> map = null;
-			paramMap.put("advertiserId", advertiserId);
-			Advertiser advertiser = advertiserService.findById(advertiserId);
-			
-			/**
-			 * 下面是查找该广告主下的昨天和前天的曝光数和点击数
-			 */
-			paramMap.put("date", sdf.format(new Date().getTime() - 24 * 60 * 60 * 1000));
-			Long yesterdayImpressionSum = null;
-			Long yesterdayClickSum = null;
-			
-			map = findTotalImpressionAndClickByAdvertiserId(paramMap);
-			
-			/**
-			 * 对于查询的结果进行判断,如果没找到的结果是空的,则两个值都设为0
-			 * 如果找到其中的一个值为空就把这个值设为0
-			 */
-			if(null == map) {
-				yesterdayClickSum = new Long(0);
-				yesterdayImpressionSum = new Long(0);
-			} else {
-				yesterdayClickSum = Long.parseLong(map.get("totalClick").toString());
-				yesterdayImpressionSum = Long.parseLong(map.get("totalImpression").toString());
-			}
-			
-			compareMap.put("totalImpression", yesterdayImpressionSum);
-			compareMap.put("totalClick", yesterdayClickSum);
-			
-			paramMap.put("date", sdf.format(new Date().getTime() - 2 * 24 * 60 * 60 * 1000));
-			Long beforeYesterdayImpressionSum = null;
-			Long beforeYesterdayClickSum = null;
-			map = findTotalImpressionAndClickByAdvertiserId(paramMap);
-			
-			/**
-			 * 对于查询的结果进行判断,如果m找到的结果是空的,则两个值都设为0
-			 * 如果找到其中的一个值为空就把这个值设为0
-			 */
-			if(null == map) {
-				beforeYesterdayClickSum = new Long(0);
-				beforeYesterdayImpressionSum = new Long(0);
-			} else {
-				beforeYesterdayClickSum = Long.parseLong(map.get("totalClick").toString());
-				beforeYesterdayImpressionSum = Long.parseLong(map.get("totalImpression").toString());
-			}
-			
-			/**
-			 * 通过比对昨天和前天的数据大小判断箭头
-			 */
-			if((yesterdayImpressionSum - beforeYesterdayImpressionSum) > 0) {
-				compareMap.put("impressionStatus", "up");
-			} else if((yesterdayImpressionSum == beforeYesterdayImpressionSum)) {
-				compareMap.put("impressionStatus", "equal");
-			} else {
-				compareMap.put("impressionStatus", "down");
-			}
-			
-			if((yesterdayClickSum - beforeYesterdayClickSum) > 0) {
-				compareMap.put("clickStatus", "up");
-			} else if((yesterdayClickSum == beforeYesterdayClickSum)) {
-				compareMap.put("clickStatus", "equal");
-			} else {
-				compareMap.put("clickStatus", "down");
-			}
-			
-			
-			compareMap.put("balance",df.format(advertiser.getBalance()));
-		}
-		
-		if(null != agentId) {
-			paramMap.put("agentId", agentId);
-			Double balance = advertiserService.sumBalanceById(paramMap);
-			
-			//如果找到的余额为空则余额为0
-			if(null == balance) {
-				balance = new Double(0);
-			}
-			
-			Map<String, Object> map = null;
-			/**
-			 * 下面是查找该代理商下的所有广告主的昨天和前天的曝光数和点击数
-			 */
-			paramMap.put("date", sdf.format(new Date().getTime() - 24 * 60 * 60 * 1000));
-			
-			Long yesterdayImpressionSum = null;
-			Long yesterdayClickSum = null;
-			map = findTotalImpressionAndClickByAgentId(paramMap);
-			
-			/**
-			 * 对于查询的结果进行判断,如果没找到的结果是空的,则两个值都设为0
-			 * 如果找到其中的一个值为空就把这个值设为0
-			 */
-			if(null == map) {
-				yesterdayClickSum = new Long(0);
-				yesterdayImpressionSum = new Long(0);
-			} else {
-				yesterdayClickSum = Long.parseLong(map.get("totalClick").toString());
-				yesterdayImpressionSum = Long.parseLong(map.get("totalImpression").toString());
-			}
-			
-			compareMap.put("totalImpression", yesterdayImpressionSum);
-			compareMap.put("totalClick", yesterdayClickSum);
-			
-			paramMap.put("date", sdf.format(new Date().getTime() - 2 * 24 * 60 * 60 * 1000));
-			Long beforeYesterdayImpressionSum = null;
-			Long beforeYesterdayClickSum = null;
-			map = findTotalImpressionAndClickByAgentId(paramMap);
-			
-			/**
-			 * 对于查询的结果进行判断,如果m找到的结果是空的,则两个值都设为0
-			 * 如果找到其中的一个值为空就把这个值设为0
-			 */
-			if(null == map) {
-				beforeYesterdayClickSum = new Long(0);
-				beforeYesterdayImpressionSum = new Long(0);
-			} else {
-				beforeYesterdayClickSum = Long.parseLong(map.get("totalClick").toString());
-				beforeYesterdayImpressionSum = Long.parseLong(map.get("totalImpression").toString());
-			}
-			
-			
-			/**
-			 * 通过比对昨天和前天的数据大小判断箭头
-			 */
-			if((yesterdayImpressionSum - beforeYesterdayImpressionSum) > 0) {
-				compareMap.put("impressionStatus", "up");
-			} else if((yesterdayImpressionSum == beforeYesterdayImpressionSum)) {
-				compareMap.put("impressionStatus", "equal");
-			} else {
-				compareMap.put("impressionStatus", "down");
-			}
-			
-			if((yesterdayClickSum - beforeYesterdayClickSum) > 0) {
-				compareMap.put("clickStatus", "up");
-			} else if((yesterdayClickSum == beforeYesterdayClickSum)) {
-				compareMap.put("clickStatus", "equal");
-			} else {
-				compareMap.put("clickStatus", "down");
-			}
-			
-			
-			compareMap.put("balance",df.format(balance));
-		}
-		
-		return compareMap;
-	}
-
-	@Override
-	public List<HashMap<String, Object>> findChart(String startDate,
-			String endDate, Long advertiserId) {
-		/**
-    	 * 这里查询分为是一段时间和某一天时间
-    	 */
-    	if(startDate.equals(endDate)){
-    		return iBatisDao.getList("adReportSqlMapper.findByAdvertiser1", MapBuilder.create(HashMap.class).add("startDate", startDate)
-                     .add("advertiserId", advertiserId).map());
-    	} else {
-    		 return iBatisDao.getList("adReportSqlMapper.findByAdvertiser", MapBuilder.create(HashMap.class).add("startDate", startDate)
-                     .add("endDate", endDate).add("advertiserId", advertiserId).map());      
-    	}
-		
-	}
-
-	@Override
-	public int findCountForChart(String startDate, String endDate,
-			Long advertiserId) {
-		/**
-    	 * 这里查询分为如果是一段时间或者是一天时间
-    	 */
-    	if(startDate.equals(endDate)){
-    		return iBatisDao.get("adReportSqlMapper.findCountForChart1", MapBuilder.create(HashMap.class).add("startDate", startDate)
-                     .add("advertiserId", advertiserId).map());
-    	} else {
-    		 return iBatisDao.get("adReportSqlMapper.findCountForChart", MapBuilder.create(HashMap.class).add("startDate", startDate)
-                     .add("endDate", endDate).add("advertiserId", advertiserId).map());      
-    	}
-	}
-
-	@Override
-	public List<HashMap<String, Object>> findChart(String startDate,
-			String endDate, Long advertiserId, Pager pager) {
-		/**
-    	 * 这里查询分为一段时间和某一天时间
-    	 */
-    	if(startDate.equals(endDate)){
-    		return iBatisDao.getList("adReportSqlMapper.findByAdvertiser2", MapBuilder.create(HashMap.class).add("startDate", startDate)
-                     .add("advertiserId", advertiserId).add("pager", pager).map());
-    	} else {
-    		 return iBatisDao.getList("adReportSqlMapper.findByAdvertiser3", MapBuilder.create(HashMap.class).add("startDate", startDate)
-                     .add("endDate", endDate).add("advertiserId", advertiserId).add("pager", pager).map());      
-    	}
-	}
-
-	@Override
-	public HashMap<String, Object> findTotalImpressionAndClickByAdvertiserId(
-			Map<String, Object> paramMap) {
-		return iBatisDao.get("adReportSqlMapper.findTotalImpressionAndClickByAdvertiserId", paramMap);
-	}
-
-	@Override
-	public HashMap<String, Object> findTotalImpressionAndClickByAgentId(
-			Map<String, Object> paramMap) {
-		return iBatisDao.get("adReportSqlMapper.findTotalImpressionAndClickByAgentId", paramMap);
-	}
-
-	@Override
-	public List<DeliverAnalysis> findByTotalForExcelAdvertiser(Map<String, Object> paramMap) {
-		return iBatisDao.getList("adReportSqlMapper.findByTotalForExcelAdvertiser", paramMap);
-	}
-
-	@Override
-	public List<DeliverAnalysis> findByPlaceName(Map<String, Object> paramMap) {
-		return iBatisDao.getList("adReportSqlMapper.findByPlaceNameForExcel", paramMap);
-	}
-
-	@Override
-	public List<DeliverAnalysis> findByLocation(Map<String, Object> paramMap) {
-		return iBatisDao.getList("adReportSqlMapper.findByLocationForExcel", paramMap);
-	}
-
-	@Override
-	public List<DeliverAnalysis> findByOs(Map<String, Object> paramMap) {
-		return iBatisDao.getList("adReportSqlMapper.findByOsForExcel", paramMap);
-	}
-
-	@Override
-	public List<DeliverAnalysis> findDeliverEffectAnalysisOperator(
-			Map<String, Object> paramMap, Pager pager) {
-		paramMap.put("pager", pager);
-		return iBatisDao.getList("adReportSqlMapper.findDeliverEffectAnalysis", paramMap);
-	}
-
-	@Override
-	public List<DeliverAnalysis> findDeliverEffectAnalysisOperator(
-			Map<String, Object> paramMap) {
-		return iBatisDao.getList("adReportSqlMapper.findDeliverEffectAnalysis1", paramMap);
-
-	}
-
-	@Override
-	public int countBySizeOperator(Map<String, Object> paramMap) {
-		return iBatisDao.get("adReportSqlMapper.countBySize", paramMap);
-	}
-
-	@Override
-	public List<DeliverAnalysis> findBySizeOperator(
-			Map<String, Object> paramMap, Pager pager) {
-		paramMap.put("pager", pager);
-		return iBatisDao.getList("adReportSqlMapper.findBySize", paramMap);
-	}
-
-	@Override
-	public List<DeliverAnalysis> findBySizeOperator(Map<String, Object> paramMap) {
-		return iBatisDao.getList("adReportSqlMapper.findBySize1", paramMap);
-	}
-
-	@Override
-	public List<DeliverAnalysis> findByPositionOperator(
-			Map<String, Object> paramMap) {
-		return iBatisDao.getList("adReportSqlMapper.findByPosition", paramMap);
-	}
-
-	@Override
-	public int countBySystemOperator(Map<String, Object> paramMap) {
-		return iBatisDao.get("adReportSqlMapper.countBySystem", paramMap);
-	}
-
-	@Override
-	public List<DeliverAnalysis> findBySystemOperator(
-			Map<String, Object> paramMap, Pager pager) {
-		paramMap.put("pager", pager);
-		return iBatisDao.getList("adReportSqlMapper.findBySystem", paramMap);
-	}
-
-	@Override
-	public List<DeliverAnalysis> findBySystemOperator(
-			Map<String, Object> paramMap) {
-		return iBatisDao.getList("adReportSqlMapper.findBySystem1", paramMap);
-	}
-
-	@Override
-	public List<DeliverAnalysis> findByDeviceOperator(
-			Map<String, Object> paramMap) {
-		return iBatisDao.getList("adReportSqlMapper.findByDevice", paramMap);
-	}
-
-	@Override
-	public List<DeliverAnalysis> findByArealCityOperator(
-			Map<String, Object> paramMap) {
-		return iBatisDao.getList("adReportSqlMapper.findByArealCity", paramMap);
-	}
-
-	@Override
-	public List<DeliverAnalysis> findByArealOperator(
-			Map<String, Object> paramMap) {
-		return iBatisDao.getList("adReportSqlMapper.findByAreal", paramMap);
-	}
-
-	@Override
-	public int countByPlaceOperator(Map<String, Object> paramMap) {
-		return iBatisDao.get("adReportSqlMapper.countByPlace", paramMap);
-	}
-
-	@Override
-	public List<DeliverAnalysis> findByPlaceOperator(
-			Map<String, Object> paramMap, Pager pager) {
-		paramMap.put("pager", pager);
-		return iBatisDao.getList("adReportSqlMapper.findByPlace", paramMap);
-	}
-
-	@Override
-	public List<DeliverAnalysis> findByPlaceOperator(
-			Map<String, Object> paramMap) {
-		return iBatisDao.getList("adReportSqlMapper.findByPlace1", paramMap);
-	}
-
-	@Override
-	public int countByApmacOperator(Map<String, Object> paramMap) {
-		return iBatisDao.get("adReportSqlMapper.countByApmac", paramMap);
-	}
-
-	@Override
-	public List<DeliverAnalysis> findByApmacOperator(
-			Map<String, Object> paramMap, Pager pager) {
-		paramMap.put("pager", pager);
-		return iBatisDao.getList("adReportSqlMapper.findByApmac", paramMap);
-	}
-
-	@Override
-	public List<DeliverAnalysis> findByApmacOperator(
-			Map<String, Object> paramMap) {
-		return iBatisDao.getList("adReportSqlMapper.findByApmac1", paramMap);
-	}
-
-	@Override
-	public int countByAllArealOperator(Map<String, Object> paramMap) {
-		return iBatisDao.get("adReportSqlMapper.countByAllAreal", paramMap);
-	}
-
-	@Override
-	public List<DeliverAnalysis> findByAllArealOperator(
-			Map<String, Object> paramMap, Pager pager) {
-		paramMap.put("pager", pager);
-		return iBatisDao.getList("adReportSqlMapper.findByAllAreal", paramMap);
-	}
-
-	@Override
-	public DeliverAnalysis findSumOperator(Map<String, Object> paramMap) {
-		return iBatisDao.get("adReportSqlMapper.findSum", paramMap);	}
-
-	@Override
-	public List<DeliverAnalysis> findAllAreaOperator(
-			Map<String, Object> paramMap) {
-		return iBatisDao.getList("adReportSqlMapper.findAllArea", paramMap);
-	}
-
-	@Override
-	public int findCountForDeliverEffectAnalysisOperator(
-			Map<String, Object> paramMap) {
-		return iBatisDao.get("adReportSqlMapper.findCountForDeliverEffectAnalysisOperator", paramMap);
-	}
-
-	@Override
-	public int findCountForDeliverEffectAnalysisBack(
-			Map<String, Object> paramMap) {
-		return iBatisDao.get("adReportSqlMapper.findCountForDeliverEffectAnalysisBack", paramMap);
-	}
-
-	@Override
-	public int findCountForLocationBack(Map<String, Object> paramMap) {
-		return iBatisDao.get("adReportSqlMapper.findCountForLocationBack", paramMap);
-	}
-
-	@Override
-	public List<DeliverAnalysis> findByTotalReportBack(
-			Map<String, Object> paramMap, Pager pager) {
-		paramMap.put("pager", pager);
-		return iBatisDao.getList("adReportSqlMapper.findByTotalReportBack", paramMap);
-	}
-
-	@Override
-	public List<DeliverAnalysis> findByLocationBack(
-			Map<String, Object> paramMap, Pager pager) {
-		paramMap.put("pager", pager);
-		return iBatisDao.getList("adReportSqlMapper.findByLocationBack", paramMap);
-	}
-
-	@Override
-	public List<DeliverAnalysis> findByTotalForExcelBack(
-			Map<String, Object> paramMap) {
-		return iBatisDao.getList("adReportSqlMapper.findByTotalForExcelBack", paramMap);
-	}
-
-	@Override
-	public List<DeliverAnalysis> findByTotalForExcelOperator(
-			Map<String, Object> paramMap) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	
-}
+package com.cloudcross.ssp.service.impl;
+
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.cloudcross.ssp.base.dao.GenericIBatisDao;
+import com.cloudcross.ssp.common.utils.MapBuilder;
+import com.cloudcross.ssp.common.utils.Pager;
+import com.cloudcross.ssp.model.Advertiser;
+import com.cloudcross.ssp.model.DeliverAnalysis;
+import com.cloudcross.ssp.service.IAccountService;
+import com.cloudcross.ssp.service.IAdReportService;
+import com.cloudcross.ssp.service.IAdvertiserService;
+
+
+@Service
+public class AdReportService implements IAdReportService {
+	@Autowired
+	private GenericIBatisDao iBatisDao;
+	@Autowired
+	private IAdvertiserService advertiserService;
+	@Autowired
+	private IAccountService accountService;
+	
+	@Override
+	public DeliverAnalysis findById(Long id) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public int countByParams(Map<String, Object> paramMap) {
+		// TODO Auto-generated method stub
+		return 0;
+	}
+
+	@Override
+	public List<DeliverAnalysis> findByParams(Map<String, Object> paramMap,
+			Pager pager) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public boolean add(DeliverAnalysis t) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public boolean edit(DeliverAnalysis t) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public boolean updateStatus(List<Long> idList, int status) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public int findCountForDeliverEffectAnalysisAdvertiser(Map<String, Object> paramMap) {
+		return iBatisDao.get("adReportSqlMapper.findCountForDeliverEffectAnalysisAdvertiser", paramMap);
+	}
+
+	@Override
+	public int findCountForDeliverEffectAnalysis2(Map<String, Object> paramMap) {
+		// TODO Auto-generated method stub
+		return 0;
+	}
+
+	@Override
+	public int findCountForLocationAdvertiser(Map<String, Object> paramMap) {
+		return iBatisDao.get("adReportSqlMapper.findCountForLocationAdvertiser", paramMap);
+	}
+
+	@Override
+	public int findCountForOs(Map<String, Object> paramMap) {
+		return iBatisDao.get("adReportSqlMapper.findCountForOs", paramMap);
+	}
+
+	@Override
+	public int findCountForScene(Map<String, Object> paramMap) {
+		return iBatisDao.get("adReportSqlMapper.findCountForScene", paramMap);
+	}
+
+	@Override
+	public List<DeliverAnalysis> findByTotalReportAdvertiser(
+			Map<String, Object> paramMap, Pager pager) {
+		paramMap.put("pager", pager);
+		return iBatisDao.getList("adReportSqlMapper.findByTotalReportAdvertiser", paramMap);
+	}
+
+	@Override
+	public List<DeliverAnalysis> findByTotalReport2(
+			Map<String, Object> paramMap, Pager pager) {
+		paramMap.put("pager", pager);
+		return iBatisDao.getList("adReportSqlMapper.findByTotalReport2", paramMap);
+	}
+
+	@Override
+	public List<DeliverAnalysis> findByPlaceName(Map<String, Object> paramMap,
+			Pager pager) {
+		paramMap.put("pager", pager);
+		return iBatisDao.getList("adReportSqlMapper.findByPlaceName", paramMap);
+	}
+
+	@Override
+	public List<DeliverAnalysis> findByLocationAdvertiser(Map<String, Object> paramMap,
+			Pager pager) {
+		paramMap.put("pager", pager);
+		return iBatisDao.getList("adReportSqlMapper.findByLocationAdvertiser", paramMap);
+	}
+
+	@Override
+	public List<DeliverAnalysis> findByOs(Map<String, Object> paramMap,
+			Pager pager) {
+		paramMap.put("pager", pager);
+		return iBatisDao.getList("adReportSqlMapper.findByOs", paramMap);
+	}
+
+	@Override
+	public int findCountForBanner(Map<String, Object> paramMap) {
+		return iBatisDao.get("adReportSqlMapper.findCountForBanner", paramMap);
+	}
+
+
+	@Override
+	public List<DeliverAnalysis> findBannerByConditions(
+			Map<String, Object> paramMap) {
+		return iBatisDao.getList("adReportSqlMapper.findBannerList", paramMap);
+	}
+
+
+	@Override
+	public List<DeliverAnalysis> exportBannerListList(
+			Map<String, Object> paramMap) {
+		return iBatisDao.getList("adReportSqlMapper.exportBannerList", paramMap);
+	}
+	@Override
+	public Map<String, Object> findCompare(Map<String, Object> paramMap) {
+		Long advertiserId = null;
+		Long agentId = null;
+		
+		/**
+		 * 判断下是广告主,还是代理商
+		 */
+		if (!paramMap.containsKey("advertiserId")) {
+			advertiserId = null;
+		} else {
+			if (paramMap.get("advertiserId") != null
+					&& !"".equals(paramMap.get("advertiserId"))) {
+				advertiserId = Long.parseLong((String) paramMap
+						.get("advertiserId"));
+			} else {
+				advertiserId = null;
+			}
+		}
+		
+		
+		if (!paramMap.containsKey("agentId")) {
+			agentId = null;
+		} else {
+			if (paramMap.get("agentId") != null
+					&& !"".equals(paramMap.get("agentId"))) {
+				agentId = Long.parseLong(String.valueOf(paramMap.get("agentId")));
+			} else {
+				agentId = null;
+			}
+		}
+		
+		//查询用户当前余额
+		//格式化
+		DecimalFormat df = (DecimalFormat)NumberFormat.getInstance(Locale.CHINESE);
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+		df.applyPattern("0.00");
+		Map<String,Object> compareMap = new HashMap<String,Object>();
+		/**
+		 * 先判断传递进来的是一个广告主id,还是代理商id
+		 * 如果广告主id不为空,则为广告主账号,如果是代理商id不为空则为代理商账号
+		 */
+		if(null != advertiserId) {
+			Map<String, Object> map = null;
+			paramMap.put("advertiserId", advertiserId);
+			Advertiser advertiser = advertiserService.findById(advertiserId);
+			
+			/**
+			 * 下面是查找该广告主下的昨天和前天的曝光数和点击数
+			 */
+			paramMap.put("date", sdf.format(new Date().getTime() - 24 * 60 * 60 * 1000));
+			Long yesterdayImpressionSum = null;
+			Long yesterdayClickSum = null;
+			
+			map = findTotalImpressionAndClickByAdvertiserId(paramMap);
+			
+			/**
+			 * 对于查询的结果进行判断,如果没找到的结果是空的,则两个值都设为0
+			 * 如果找到其中的一个值为空就把这个值设为0
+			 */
+			if(null == map) {
+				yesterdayClickSum = new Long(0);
+				yesterdayImpressionSum = new Long(0);
+			} else {
+				yesterdayClickSum = Long.parseLong(map.get("totalClick").toString());
+				yesterdayImpressionSum = Long.parseLong(map.get("totalImpression").toString());
+			}
+			
+			compareMap.put("totalImpression", yesterdayImpressionSum);
+			compareMap.put("totalClick", yesterdayClickSum);
+			
+			paramMap.put("date", sdf.format(new Date().getTime() - 2 * 24 * 60 * 60 * 1000));
+			Long beforeYesterdayImpressionSum = null;
+			Long beforeYesterdayClickSum = null;
+			map = findTotalImpressionAndClickByAdvertiserId(paramMap);
+			
+			/**
+			 * 对于查询的结果进行判断,如果m找到的结果是空的,则两个值都设为0
+			 * 如果找到其中的一个值为空就把这个值设为0
+			 */
+			if(null == map) {
+				beforeYesterdayClickSum = new Long(0);
+				beforeYesterdayImpressionSum = new Long(0);
+			} else {
+				beforeYesterdayClickSum = Long.parseLong(map.get("totalClick").toString());
+				beforeYesterdayImpressionSum = Long.parseLong(map.get("totalImpression").toString());
+			}
+			
+			/**
+			 * 通过比对昨天和前天的数据大小判断箭头
+			 */
+			if((yesterdayImpressionSum - beforeYesterdayImpressionSum) > 0) {
+				compareMap.put("impressionStatus", "up");
+			} else if((yesterdayImpressionSum == beforeYesterdayImpressionSum)) {
+				compareMap.put("impressionStatus", "equal");
+			} else {
+				compareMap.put("impressionStatus", "down");
+			}
+			
+			if((yesterdayClickSum - beforeYesterdayClickSum) > 0) {
+				compareMap.put("clickStatus", "up");
+			} else if((yesterdayClickSum == beforeYesterdayClickSum)) {
+				compareMap.put("clickStatus", "equal");
+			} else {
+				compareMap.put("clickStatus", "down");
+			}
+			
+			
+			compareMap.put("balance",df.format(advertiser.getBalance()));
+		}
+		
+		if(null != agentId) {
+			paramMap.put("agentId", agentId);
+			Double balance = advertiserService.sumBalanceById(paramMap);
+			
+			//如果找到的余额为空则余额为0
+			if(null == balance) {
+				balance = new Double(0);
+			}
+			
+			Map<String, Object> map = null;
+			/**
+			 * 下面是查找该代理商下的所有广告主的昨天和前天的曝光数和点击数
+			 */
+			paramMap.put("date", sdf.format(new Date().getTime() - 24 * 60 * 60 * 1000));
+			
+			Long yesterdayImpressionSum = null;
+			Long yesterdayClickSum = null;
+			map = findTotalImpressionAndClickByAgentId(paramMap);
+			
+			/**
+			 * 对于查询的结果进行判断,如果没找到的结果是空的,则两个值都设为0
+			 * 如果找到其中的一个值为空就把这个值设为0
+			 */
+			if(null == map) {
+				yesterdayClickSum = new Long(0);
+				yesterdayImpressionSum = new Long(0);
+			} else {
+				yesterdayClickSum = Long.parseLong(map.get("totalClick").toString());
+				yesterdayImpressionSum = Long.parseLong(map.get("totalImpression").toString());
+			}
+			
+			compareMap.put("totalImpression", yesterdayImpressionSum);
+			compareMap.put("totalClick", yesterdayClickSum);
+			
+			paramMap.put("date", sdf.format(new Date().getTime() - 2 * 24 * 60 * 60 * 1000));
+			Long beforeYesterdayImpressionSum = null;
+			Long beforeYesterdayClickSum = null;
+			map = findTotalImpressionAndClickByAgentId(paramMap);
+			
+			/**
+			 * 对于查询的结果进行判断,如果m找到的结果是空的,则两个值都设为0
+			 * 如果找到其中的一个值为空就把这个值设为0
+			 */
+			if(null == map) {
+				beforeYesterdayClickSum = new Long(0);
+				beforeYesterdayImpressionSum = new Long(0);
+			} else {
+				beforeYesterdayClickSum = Long.parseLong(map.get("totalClick").toString());
+				beforeYesterdayImpressionSum = Long.parseLong(map.get("totalImpression").toString());
+			}
+			
+			
+			/**
+			 * 通过比对昨天和前天的数据大小判断箭头
+			 */
+			if((yesterdayImpressionSum - beforeYesterdayImpressionSum) > 0) {
+				compareMap.put("impressionStatus", "up");
+			} else if((yesterdayImpressionSum == beforeYesterdayImpressionSum)) {
+				compareMap.put("impressionStatus", "equal");
+			} else {
+				compareMap.put("impressionStatus", "down");
+			}
+			
+			if((yesterdayClickSum - beforeYesterdayClickSum) > 0) {
+				compareMap.put("clickStatus", "up");
+			} else if((yesterdayClickSum == beforeYesterdayClickSum)) {
+				compareMap.put("clickStatus", "equal");
+			} else {
+				compareMap.put("clickStatus", "down");
+			}
+			
+			
+			compareMap.put("balance",df.format(balance));
+		}
+		
+		return compareMap;
+	}
+
+	@Override
+	public List<HashMap<String, Object>> findChart(String startDate,
+			String endDate, Long advertiserId) {
+		/**
+    	 * 这里查询分为是一段时间和某一天时间
+    	 */
+    	if(startDate.equals(endDate)){
+    		return iBatisDao.getList("adReportSqlMapper.findByAdvertiser1", MapBuilder.create(HashMap.class).add("startDate", startDate)
+                     .add("advertiserId", advertiserId).map());
+    	} else {
+    		 return iBatisDao.getList("adReportSqlMapper.findByAdvertiser", MapBuilder.create(HashMap.class).add("startDate", startDate)
+                     .add("endDate", endDate).add("advertiserId", advertiserId).map());      
+    	}
+		
+	}
+
+	@Override
+	public int findCountForChart(String startDate, String endDate,
+			Long advertiserId) {
+		/**
+    	 * 这里查询分为如果是一段时间或者是一天时间
+    	 */
+    	if(startDate.equals(endDate)){
+    		return iBatisDao.get("adReportSqlMapper.findCountForChart1", MapBuilder.create(HashMap.class).add("startDate", startDate)
+                     .add("advertiserId", advertiserId).map());
+    	} else {
+    		 return iBatisDao.get("adReportSqlMapper.findCountForChart", MapBuilder.create(HashMap.class).add("startDate", startDate)
+                     .add("endDate", endDate).add("advertiserId", advertiserId).map());      
+    	}
+	}
+
+	@Override
+	public List<HashMap<String, Object>> findChart(String startDate,
+			String endDate, Long advertiserId, Pager pager) {
+		/**
+    	 * 这里查询分为一段时间和某一天时间
+    	 */
+    	if(startDate.equals(endDate)){
+    		return iBatisDao.getList("adReportSqlMapper.findByAdvertiser2", MapBuilder.create(HashMap.class).add("startDate", startDate)
+                     .add("advertiserId", advertiserId).add("pager", pager).map());
+    	} else {
+    		 return iBatisDao.getList("adReportSqlMapper.findByAdvertiser3", MapBuilder.create(HashMap.class).add("startDate", startDate)
+                     .add("endDate", endDate).add("advertiserId", advertiserId).add("pager", pager).map());      
+    	}
+	}
+
+	@Override
+	public HashMap<String, Object> findTotalImpressionAndClickByAdvertiserId(
+			Map<String, Object> paramMap) {
+		return iBatisDao.get("adReportSqlMapper.findTotalImpressionAndClickByAdvertiserId", paramMap);
+	}
+
+	@Override
+	public HashMap<String, Object> findTotalImpressionAndClickByAgentId(
+			Map<String, Object> paramMap) {
+		return iBatisDao.get("adReportSqlMapper.findTotalImpressionAndClickByAgentId", paramMap);
+	}
+
+	@Override
+	public List<DeliverAnalysis> findByTotalForExcelAdvertiser(Map<String, Object> paramMap) {
+		return iBatisDao.getList("adReportSqlMapper.findByTotalForExcelAdvertiser", paramMap);
+	}
+
+	@Override
+	public List<DeliverAnalysis> findByPlaceName(Map<String, Object> paramMap) {
+		return iBatisDao.getList("adReportSqlMapper.findByPlaceNameForExcel", paramMap);
+	}
+
+	@Override
+	public List<DeliverAnalysis> findByLocation(Map<String, Object> paramMap) {
+		return iBatisDao.getList("adReportSqlMapper.findByLocationForExcel", paramMap);
+	}
+
+	@Override
+	public List<DeliverAnalysis> findByOs(Map<String, Object> paramMap) {
+		return iBatisDao.getList("adReportSqlMapper.findByOsForExcel", paramMap);
+	}
+
+	@Override
+	public List<DeliverAnalysis> findDeliverEffectAnalysisOperator(
+			Map<String, Object> paramMap, Pager pager) {
+		paramMap.put("pager", pager);
+		return iBatisDao.getList("adReportSqlMapper.findDeliverEffectAnalysis", paramMap);
+	}
+
+	@Override
+	public List<DeliverAnalysis> findDeliverEffectAnalysisOperator(
+			Map<String, Object> paramMap) {
+		return iBatisDao.getList("adReportSqlMapper.findDeliverEffectAnalysis1", paramMap);
+
+	}
+
+	@Override
+	public int countBySizeOperator(Map<String, Object> paramMap) {
+		return iBatisDao.get("adReportSqlMapper.countBySize", paramMap);
+	}
+
+	@Override
+	public List<DeliverAnalysis> findBySizeOperator(
+			Map<String, Object> paramMap, Pager pager) {
+		paramMap.put("pager", pager);
+		return iBatisDao.getList("adReportSqlMapper.findBySize", paramMap);
+	}
+
+	@Override
+	public List<DeliverAnalysis> findBySizeOperator(Map<String, Object> paramMap) {
+		return iBatisDao.getList("adReportSqlMapper.findBySize1", paramMap);
+	}
+
+	@Override
+	public List<DeliverAnalysis> findByPositionOperator(
+			Map<String, Object> paramMap) {
+		return iBatisDao.getList("adReportSqlMapper.findByPosition", paramMap);
+	}
+
+	@Override
+	public int countBySystemOperator(Map<String, Object> paramMap) {
+		return iBatisDao.get("adReportSqlMapper.countBySystem", paramMap);
+	}
+
+	@Override
+	public List<DeliverAnalysis> findBySystemOperator(
+			Map<String, Object> paramMap, Pager pager) {
+		paramMap.put("pager", pager);
+		return iBatisDao.getList("adReportSqlMapper.findBySystem", paramMap);
+	}
+
+	@Override
+	public List<DeliverAnalysis> findBySystemOperator(
+			Map<String, Object> paramMap) {
+		return iBatisDao.getList("adReportSqlMapper.findBySystem1", paramMap);
+	}
+
+	@Override
+	public List<DeliverAnalysis> findByDeviceOperator(
+			Map<String, Object> paramMap) {
+		return iBatisDao.getList("adReportSqlMapper.findByDevice", paramMap);
+	}
+
+	@Override
+	public List<DeliverAnalysis> findByArealCityOperator(
+			Map<String, Object> paramMap) {
+		return iBatisDao.getList("adReportSqlMapper.findByArealCity", paramMap);
+	}
+
+	@Override
+	public List<DeliverAnalysis> findByArealOperator(
+			Map<String, Object> paramMap) {
+		return iBatisDao.getList("adReportSqlMapper.findByAreal", paramMap);
+	}
+
+	@Override
+	public int countByPlaceOperator(Map<String, Object> paramMap) {
+		return iBatisDao.get("adReportSqlMapper.countByPlace", paramMap);
+	}
+
+	@Override
+	public List<DeliverAnalysis> findByPlaceOperator(
+			Map<String, Object> paramMap, Pager pager) {
+		paramMap.put("pager", pager);
+		return iBatisDao.getList("adReportSqlMapper.findByPlace", paramMap);
+	}
+
+	@Override
+	public List<DeliverAnalysis> findByPlaceOperator(
+			Map<String, Object> paramMap) {
+		return iBatisDao.getList("adReportSqlMapper.findByPlace1", paramMap);
+	}
+
+	@Override
+	public int countByApmacOperator(Map<String, Object> paramMap) {
+		return iBatisDao.get("adReportSqlMapper.countByApmac", paramMap);
+	}
+
+	@Override
+	public List<DeliverAnalysis> findByApmacOperator(
+			Map<String, Object> paramMap, Pager pager) {
+		paramMap.put("pager", pager);
+		return iBatisDao.getList("adReportSqlMapper.findByApmac", paramMap);
+	}
+
+	@Override
+	public List<DeliverAnalysis> findByApmacOperator(
+			Map<String, Object> paramMap) {
+		return iBatisDao.getList("adReportSqlMapper.findByApmac1", paramMap);
+	}
+
+	@Override
+	public int countByAllArealOperator(Map<String, Object> paramMap) {
+		return iBatisDao.get("adReportSqlMapper.countByAllAreal", paramMap);
+	}
+
+	@Override
+	public List<DeliverAnalysis> findByAllArealOperator(
+			Map<String, Object> paramMap, Pager pager) {
+		paramMap.put("pager", pager);
+		return iBatisDao.getList("adReportSqlMapper.findByAllAreal", paramMap);
+	}
+
+	@Override
+	public DeliverAnalysis findSumOperator(Map<String, Object> paramMap) {
+		return iBatisDao.get("adReportSqlMapper.findSum", paramMap);	}
+
+	@Override
+	public List<DeliverAnalysis> findAllAreaOperator(
+			Map<String, Object> paramMap) {
+		return iBatisDao.getList("adReportSqlMapper.findAllArea", paramMap);
+	}
+
+	@Override
+	public int findCountForDeliverEffectAnalysisOperator(
+			Map<String, Object> paramMap) {
+		return iBatisDao.get("adReportSqlMapper.findCountForDeliverEffectAnalysisOperator", paramMap);
+	}
+
+	@Override
+	public int findCountForDeliverEffectAnalysisBack(
+			Map<String, Object> paramMap) {
+		return iBatisDao.get("adReportSqlMapper.findCountForDeliverEffectAnalysisBack", paramMap);
+	}
+
+	@Override
+	public int findCountForLocationBack(Map<String, Object> paramMap) {
+		return iBatisDao.get("adReportSqlMapper.findCountForLocationBack", paramMap);
+	}
+
+	@Override
+	public List<DeliverAnalysis> findByTotalReportBack(
+			Map<String, Object> paramMap, Pager pager) {
+		paramMap.put("pager", pager);
+		return iBatisDao.getList("adReportSqlMapper.findByTotalReportBack", paramMap);
+	}
+
+	@Override
+	public List<DeliverAnalysis> findByLocationBack(
+			Map<String, Object> paramMap, Pager pager) {
+		paramMap.put("pager", pager);
+		return iBatisDao.getList("adReportSqlMapper.findByLocationBack", paramMap);
+	}
+
+	@Override
+	public List<DeliverAnalysis> findByTotalForExcelBack(
+			Map<String, Object> paramMap) {
+		return iBatisDao.getList("adReportSqlMapper.findByTotalForExcelBack", paramMap);
+	}
+
+	@Override
+	public List<DeliverAnalysis> findByTotalForExcelOperator(
+			Map<String, Object> paramMap) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	
+}

+ 168 - 1
src/main/java/com/cloudcross/ssp/web/advertiser/main/ad/report/AdvertiserReportController.java

@@ -311,7 +311,174 @@ public class AdvertiserReportController extends SimpleController {
 	}
 	
 	
-	
+	// 创意报表
+		@RequestMapping("/ideaReport")
+		public String idealReport(Model model,
+				@RequestParam HashMap<String, Object> paramMap,
+				@RequestParam(defaultValue = "1") int page) {
+			initParams(paramMap);
+			// 查询搜索对应的数据
+			int totalRow = adReportService.findCountForBanner(paramMap);
+			Pager pager = new Pager();
+			pager.setPage(page);
+			pager.setTotalRow(totalRow);
+			paramMap.put("pager", pager);
+			List<DeliverAnalysis> reportList = adReportService.findBannerByConditions(paramMap);
+//			if (reportList.size() == 0) {
+//				DeliverAnalysis map = new DeliverAnalysis();
+//				DeliverAnalysis deliver = new DeliverAnalysis();
+//				deliver.setImpression(0);
+//				deliver.setClick(0);
+//				deliver.setVisit(0);
+//				deliver.setConversion(0);
+//				deliver.setConsume(0);
+//				deliver.seteCmp(0);
+//				deliver.setClickRate(0);
+//				deliver.setVisitRate(0);
+//				deliver.setConversionRate(0);
+//				map = deliver;
+//				model.addAttribute("reportMap", map);
+//			} else {
+//				// 数据报表中第一栏 全部 的显示
+//				HashMap<String, Double> map = new HashMap<String, Double>();
+//				map.put("impressionSum", reportList.get(0).getImpressionSum());
+//				map.put("clickSum", reportList.get(0).getClickSum());
+//				map.put("visitSum", reportList.get(0).getVisitSum());
+//				map.put("conversionSum", reportList.get(0).getConversionSum());
+//				map.put("consumeSum", reportList.get(0).getConsumeSum());
+//				map.put("eCmpSum", reportList.get(0).geteCmpSum());
+//				map.put("clickRatesum", reportList.get(0).getClickRatesum());
+//				map.put("visitRatesum", reportList.get(0).getVisitRatesum());
+//				map.put("conversionRatesum", reportList.get(0)
+//						.getConversionRatesum());
+//				model.addAttribute("reportMap", map);
+//			}
+
+			model.addAllAttributes(paramMap);
+			model.addAttribute("pager", pager);
+			model.addAttribute("reportList", reportList);
+			return page("ideaReport");
+		}
+
+		/**
+		 * 初始化条件数据
+		 * 
+		 * @param paramMap
+		 */
+		private void initParams(HashMap<String, Object> paramMap) {
+			// 日期
+			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+			String startDate = null;
+			String endDate = null;
+
+			// 广告主,订单,活动,投放
+			Long advertiserId = null;
+			Long orderId = null;
+			Long campaignId = null;
+			Long adGroupId = null;
+
+			String advertiserName = "全部广告主";
+			String orderName = "全部订单";
+			String campaignName = "全部活动";
+			String adGroupName = "全部投放";
+			/**
+			 * 下面对下拉框中传进来的值进行判断,若是未操作,则为空值,前端设置时默认为全部(-1)
+			 * 注意前后层次关系,同时要考虑到登录帐号权限问题,此时暂未考虑 下拉框传值Id需要同步
+			 */
+
+			// 广告主选择与否
+			if (null == paramMap.get("selectedadvertiserId")
+					|| "".equals(paramMap.get("selectedadvertiserId"))) {
+				advertiserId = null;
+				advertiserName = "全部广告主";
+			} else {
+				// 如果要查询的是所有广告主则让广告主id为空
+				if (-1 == Long.parseLong((String) paramMap
+						.get("selectedadvertiserId"))) {
+					advertiserId = null;
+					advertiserName = "全部广告主";
+				} else {
+					advertiserId = Long.parseLong((String) paramMap
+							.get("selectedadvertiserId"));
+					advertiserName = (String) paramMap
+							.get("selectedadvertiserName");
+				}
+			}
+
+			// 订单选择与否
+			if (null == paramMap.get("selectedorderId")
+					|| "".equals(paramMap.get("selectedorderId"))) {
+				orderId = null;
+				orderName = "全部订单";
+			} else {
+				if (-1 == Long.parseLong((String) paramMap.get("selectedorderId"))) {
+					orderId = null;
+					orderName = "全部订单";
+				} else {
+					orderId = Long.parseLong((String) paramMap
+							.get("selectedorderId"));
+					orderName = (String) paramMap.get("selectedorderName");
+				}
+			}
+
+			// 活动选择与否
+			if (null == paramMap.get("selectedcampaignId")
+					|| "".equals(paramMap.get("selectedcampaignId"))) {
+				campaignId = null;
+				campaignName = "全部活动";
+			} else {
+				if (-1 == Long.parseLong((String) paramMap
+						.get("selectedcampaignId"))) {
+					campaignId = null;
+					campaignName = "全部活动";
+				} else {
+					campaignId = Long.parseLong((String) paramMap
+							.get("selectedcampaignId"));
+					campaignName = (String) paramMap.get("selectedcampaignName");
+				}
+			}
+
+			// 投放选择与否
+			if (null == paramMap.get("selectedadGroupId")
+					|| "".equals(paramMap.get("selectedadGroupId"))) {
+				adGroupId = null;
+				adGroupName = "全部投放";
+			} else {
+				if (-1 == Long
+						.parseLong((String) paramMap.get("selectedadGroupId"))) {
+					adGroupId = null;
+					adGroupName = "全部投放";
+				} else {
+					adGroupId = Long.parseLong((String) paramMap
+							.get("selectedadGroupId"));
+					adGroupName = (String) paramMap.get("selectedadGroupName");
+				}
+			}
+
+			// 判断日期是否为默认值昨天,日期格式与上面相统一,用 to 分割
+			if (null == paramMap.get("dateRangePicker")
+					|| "".equals(paramMap.get("dateRangePicker"))) {
+				startDate = endDate = sdf.format(new Date((new Date()).getTime()
+						- 24 * 60 * 60 * 1000));
+			} else {
+				String[] choosedDate = ((String) paramMap.get("dateRangePicker"))
+						.split("to");
+				startDate = choosedDate[0].trim();
+				endDate = choosedDate[1].trim();
+			}
+
+			paramMap.put("advertiserId", advertiserId);
+			paramMap.put("orderId", orderId);
+			paramMap.put("campaignId", campaignId);
+			paramMap.put("adGroupId", adGroupId);
+			paramMap.put("selectedadvertiserName", advertiserName);
+			paramMap.put("selectedorderName", orderName);
+			paramMap.put("selectedcampaignName", campaignName);
+			paramMap.put("selectedadGroupName", adGroupName);
+			paramMap.put("startDate", startDate);
+			paramMap.put("endDate", endDate);
+		}
+
 	
 	
 	

+ 1 - 1
src/main/resources/application.properties

@@ -6,7 +6,7 @@ global.encoding=UTF-8
 jdbc.driver=com.mysql.jdbc.Driver
 jdbc.username=ssp_test
 jdbc.password=1q2w3e4r
-jdbc.url=jdbc:mysql://inner.datacross.cn:3306/ssp?useUnicode=true&amp;characterEncoding=UTF-8
+jdbc.url=jdbc:mysql://10.0.1.200:3306/ssp?useUnicode=true&amp;characterEncoding=UTF-8
 
 #mail server setting
 mail.server=smtp.163.com

+ 1 - 0
src/main/webapp/WEB-INF/pages/advertiser/main/ad/report/advertiser-report.ftl

@@ -37,6 +37,7 @@
 					<li class="report6 re"><a href="${ctx}/advertiser/main/ad/report/advertiser-report/regionReport" style="text-decoration:none"><span class="baobiao11cj ab" id="baobiao11cj">地域报表</span></a></li>
 					<li class="report6 re"><a href="${ctx}/advertiser/main/ad/report/advertiser-report/osReport" style="text-decoration:none"><span class="baobiao11 ab">系统报表</span></a></li>
 					<li class="report6 re"><a href="${ctx}/advertiser/main/ad/report/advertiser-report/sceneReport" style="text-decoration:none"><span class="baobiao11 ab">场景报表</span></a></li>
+					<li class="report6 re"><a href="${ctx}/main/ad/report/advertiser-report/ideaReport" style="text-decoration:none"><span class="baobiao11 ab">创意报表</span></a></li>
 				</ul>
 			</div>
 	   		<div id="third">

+ 171 - 0
src/main/webapp/WEB-INF/pages/advertiser/main/ad/report/advertiser-report/ideaReport.ftl

@@ -0,0 +1,171 @@
+<@override name="head">
+	<title>创意报表</title>
+	<link rel="stylesheet" href="${ctx}/assets/css/public-head.css"/>
+	<link rel="stylesheet" href="${ctx}/assets/css/zbone.css"/>
+	<link rel="stylesheet" type="text/css" href="${ctx}/assets/css/regionReport.css">
+	<link rel="stylesheet" type="text/css" href="${ctx}/assets/css/report_size.css">
+	<link rel="stylesheet" href="${ctx}/assets/css/font-awesome.min.css"/>
+	<link rel="stylesheet" href="${ctx}/assets/css/daterangepicker.css" />
+	<link rel="stylesheet" href="${ctx}/assets/css/bootstrap.min.css"/>
+	
+	<script type="text/javascript" src="${ctx}/assets/js/lib/jquery-1.9.1.min.js"></script>
+	<script type="text/javascript" src="${ctx}/assets/js/lib/jquery.min.js"></script>
+	<script type="text/javascript" src="${ctx}/assets/js/lib/moment.min.js"></script>
+	<script type="text/javascript" src="${ctx}/assets/js/lib/jquery.daterangepicker.js"></script>
+	<script type="text/javascript" src="${ctx}/assets/js/lib/date.js"></script>
+	<script type="text/javascript" src="${ctx}/assets/js/divselect.js"></script>
+	<script type="text/javascript" src="${ctx}/assets/js/dropDownList.js"></script>
+	<script type="text/javascript" src="${ctx}/assets/js/shortcutkey_datePicker.js"></script>
+	<script type="text/javascript" src="${ctx}/assets/js/report_advertiser.js"></script>
+	<style>
+	#date-radio input {	
+		opacity: 1 !important;
+		position: relative !important;
+	}
+	</style>
+</@override>
+
+<@override name="body">
+   <div id=content_bg>
+	<#include "/advertiser/main/public-head.ftl">
+    <div id="pagecontent">
+		<div id="content">
+			<div id="second">
+				<ul style="margin:0px;">
+					<li class="report6 re"><a href="${ctx}/advertiser/main/ad/report/advertiser-report" style="text-decoration:none"><span class="baobiao11xt ab">总体报表</span></a></li>
+					<li class="report6 re"><a href="${ctx}/advertiser/main/ad/report/advertiser-report/regionReport" style="text-decoration:none"><span class="baobiao11cj ab" id="baobiao11cj">地域报表</span></a></li>
+					<li class="report6 re"><a href="${ctx}/advertiser/main/ad/report/advertiser-report/osReport" style="text-decoration:none"><span class="baobiao11 ab">系统报表</span></a></li>
+					<li class="report6 re"><a href="${ctx}/advertiser/main/ad/report/advertiser-report/sceneReport" style="text-decoration:none"><span class="baobiao11 ab">场景报表</span></a></li>
+					<li class="report6all re"><a href="${ctx}/advertiser/main/ad/report/advertiser-report/ideaReport" style="text-decoration:none"><span class="baobiao11 ab">创意报表</span></a></li>
+				</ul>
+			</div>
+	   		<div id="third">
+				 <ul style="margin:0px;">
+				 	<li class="size1"><i class="icon-home" style="background-image:none;"></i> <a href="#" style="text-decoration:none">首页</a>
+					<span class="divider1"><i class="icon-angle-right"></i></span></li>
+				    <li class="size2"><a href="${ctx}/advertiser/main/ad/report/advertiser-report" style="text-decoration:none">数据报表</a></li>
+				    <span class="divider2"><i class="icon-angle-right"></i></span></li>
+				    <li class="size3">创意报表</li>
+				 </ul>  
+	 		</div>
+	 		<form id="formPage" action="${ctx}/advertiser/main/ad/report/advertiser-report/ideaReport" method="post">
+	 		<input type="hidden" id="page" name="page" value="${pager.page}">
+	 		<input type="hidden" id="dateTab" name="dateTab" value="${dateTab!}">
+	 		<div id="selectuls">
+				<ul id="main_advertiserul">
+					<li class="select_box" id="advertiserul_box">
+						<span id="advertiserul_span">${selectedadvertiserName!}</span>
+						<ul class="son_ul" id="advertiser_son_ul"></ul>
+					</li>
+				</ul>
+				<input type="hidden" name="selectedadvertiserId" id="advertiserId" value="${advertiserId!}">
+				<input type="hidden" name="selectedadvertiserName" id="advertiserName" value="${selectedadvertiserName!}">
+				<ul id="main_orderul">
+					<li class="select_box" id="orderul_box">
+						<span id="orderul_span">${selectedorderName!}</span>
+						<ul class="son_ul" id="orderul_son_ul"></ul>
+					</li>
+				</ul>
+				<input type="hidden" name="selectedorderId" id="orderId" value="${orderId!}">
+				<input type="hidden" name="selectedorderName" id="orderName" value="${selectedorderName!}">
+				<ul id="main_campaignul">
+					<li class="select_box" id="campaignul_box">
+						<span id="campaignul_span">${selectedcampaignName!}</span>
+						<ul class="son_ul" id="campaignul_son_ul"></ul>
+					</li>
+				</ul>
+				<input type="hidden" name="selectedcampaignId" id="campaignId" value="${campaignId!}">
+				<input type="hidden" name="selectedcampaignName" id="campaignName" value="${selectedcampaignName!}">
+				<ul id="main_adGroupul">
+					<li class="select_box" id="adGroupul_box">
+						<span id="adGroupul_span">${selectedadGroupName!}</span>
+						<ul class="son_ul" id="adGroupul_son_ul"></ul>
+					</li>
+				</ul>
+				<input type="hidden" name="selectedadGroupId" id="adGroupId" value="${adGroupId!}">
+				<input type="hidden" name="selectedadGroupName" id="adGroupName" value="${selectedadGroupName!}">
+	 		</div>
+	
+			<div id="date">
+				<span id="date-one">
+					<a class="today da" value="today">今天</a> |
+					<a id="yesterday" class="yesterday da" value="yesterday">昨天</a> |
+					<a class="lastSevenDays da" value="lastSevenDays">前七天</a> |
+					<a class="lastWeek da" value="lastWeek">上周</a> |
+					<a class="thisMonth da" value="thisMonth">本月</a> |
+					<a class="lastMonth da" value="lastMonth">上月</a>
+				</span>
+				<span id="tex"><i class="icon-calendar" style="background-image:none;"></i>
+				<input type="text" name="dateRangePicker" id="dateRangePicker" value="${dateRangePicker!}"/>
+		   		</span>
+		   		<input id="sign" type="submit" value="查询"/>
+		   		<div id="date-radio">
+		   			<span>显示列(此项可多选)</span>
+					<input type="checkbox" name="item" value="impression" checked onclick="hideImpression()"/><span>曝光</span>
+					<input type="checkbox" name="item" value="visit" checked onclick="hideVisit()"/><span>到达</span>
+					<input type="checkbox" name="item" value="conversion" checked onclick="hideConversion()"/><span>转化</span>
+					<input type="checkbox" name="item" value="consume" checked onclick="hideConsume()"/><span>花费</span>
+				</div>
+		  	</div>
+		   		
+			<div id="table">
+				<table border="1" class="tablefig" id="tablefig">
+					<thead>
+						<tr class="tr1"  id ='tr11'>
+							<th style="text-align:center; width:10%"></th>
+		                    <th style="text-align:center; width:18%" class="hidden-impression" colspan=2>曝光</th>
+		                    <th style="text-align:center; width:18%" class="hidden-click" colspan=2>点击</th>
+		                    <th style="text-align:center; width:18%" class="hidden-visit" colspan=2>到达</th>
+		                    <th style="text-align:center; width:18%" class="hidden-conversion" colspan=2>转化</th>
+		                    <th style="text-align:center; width:18%" class="hidden-consume" colspan=2>花费</th>
+						</tr>
+						<tr>
+			               	<td style="text-align:center; width:10%"></td>     
+			                <td style="text-align:center; width:9%" class="hidden-impression">曝光占比</td>
+			                <td style="text-align:center; width:9%" class="hidden-impression">曝光数</td>
+			                <td style="text-align:center; width:9%" class="hidden-click">点击数</td>
+			                <td style="text-align:center; width:9%" class="hidden-click">点击率</td> 
+			                <td style="text-align:center; width:9%" class="hidden-visit">到达数</td>
+			                <td style="text-align:center; width:9%" class="hidden-visit">到达率</td>   
+			                <td style="text-align:center; width:9%" class="hidden-conversion">转化数</td>
+			                <td style="text-align:center; width:9%" class="hidden-conversion">转化率</td>  
+			                <td style="text-align:center; width:9%" class="hidden-consume">eCPM</td>
+			                <td style="text-align:center; width:9%" class="hidden-consume">花费</td>
+			            </tr>
+					</thead>
+					<tbody>
+					<#if reportList ??>
+		            <#list reportList as report>
+						<tr id="tr22">
+			            	<td id="tdriqi" style="text-align:center;">${report.bannerName!}</td> 
+			                <td id="tdriqi" style="text-align:center;" class="hidden-impression">${report.impressionRate!}%</td>
+			                <td id="tdriqi" style="text-align:center;" class="hidden-impression">${report.impression!}</td>
+			                <td id="tdriqi" style="text-align:center;" class="hidden-click">${report.click!}</td>
+			                <td id="tdriqi" style="text-align:center;" class="hidden-click">${report.clickRate!}%</td>  
+			                <td id="tdriqi" style="text-align:center;" class="hidden-visit">${report.visit!}</td>
+			                <td id="tdriqi" style="text-align:center;" class="hidden-visit">${report.visitRate!}%</td> 
+			                <td id="tdriqi" style="text-align:center;" class="hidden-conversion">${report.conversion!}</td>
+			                <td id="tdriqi" style="text-align:center;" class="hidden-conversion">${report.conversionRate!}%</td>
+			                <td id="tdriqi" style="text-align:center;" class="hidden-consume">${report.eCmp!}</td>
+			                <td id="tdriqi" style="text-align:center;" class="hidden-consume">${report.consume!}</td>
+			            </tr>
+					</#list>
+					</#if>
+					</tbody>
+				</table>
+	        </div>
+	        
+			<div id="daochu" style="margin-left:20px;">
+				<a class="ljbtn2" id="exportExcel" href="javascript:void(0);" onClick="exportExcel('place','${ctx}/advertiser/main/ad/report/advertiser-report/exportOtherReportExcel')">导出Excel</a>
+			</div>
+						
+			<div id="pageDiv">
+               	<#include "/common/pagination/simple.ftl"/>
+            </div>
+		</div>
+		</form>
+    </div>
+</div>
+</@override>
+<@extends name="/common/simple.ftl"/>
+

+ 1 - 0
src/main/webapp/WEB-INF/pages/advertiser/main/ad/report/advertiser-report/osReport.ftl

@@ -37,6 +37,7 @@
 					<li class="report6 re"><a href="${ctx}/advertiser/main/ad/report/advertiser-report/regionReport" style="text-decoration:none"><span class="baobiao11cj ab" id="baobiao11cj">地域报表</span></a></li>
 					<li class="report6all re"><a href="${ctx}/advertiser/main/ad/report/advertiser-report/osReport" style="text-decoration:none"><span class="baobiao11 ab">系统报表</span></a></li>
 					<li class="report6 re"><a href="${ctx}/advertiser/main/ad/report/advertiser-report/sceneReport" style="text-decoration:none"><span class="baobiao11 ab">场景报表</span></a></li>
+					<li class="report6 re"><a href="${ctx}/advertiser/main/ad/report/advertiser-report/ideaReport" style="text-decoration:none"><span class="baobiao11 ab">创意报表</span></a></li>
 				</ul>
 			</div>
 	   		<div id="third">

+ 1 - 0
src/main/webapp/WEB-INF/pages/advertiser/main/ad/report/advertiser-report/regionReport.ftl

@@ -37,6 +37,7 @@
 					<li class="report6all re"><a href="${ctx}/advertiser/main/ad/report/advertiser-report/regionReport" style="text-decoration:none"><span class="baobiao11cj ab" id="baobiao11cj">地域报表</span></a></li>
 					<li class="report6 re"><a href="${ctx}/advertiser/main/ad/report/advertiser-report/osReport" style="text-decoration:none"><span class="baobiao11 ab">系统报表</span></a></li>
 					<li class="report6 re"><a href="${ctx}/advertiser/main/ad/report/advertiser-report/sceneReport" style="text-decoration:none"><span class="baobiao11 ab">场景报表</span></a></li>
+					<li class="report6 re"><a href="${ctx}/advertiser/main/ad/report/advertiser-report/ideaReport" style="text-decoration:none"><span class="baobiao11 ab">创意报表</span></a></li>
 				</ul>
 			</div>
 	   		<div id="third">

+ 1 - 0
src/main/webapp/WEB-INF/pages/advertiser/main/ad/report/advertiser-report/sceneReport.ftl

@@ -37,6 +37,7 @@
 					<li class="report6 re"><a href="${ctx}/advertiser/main/ad/report/advertiser-report/regionReport" style="text-decoration:none"><span class="baobiao11cj ab" id="baobiao11cj">地域报表</span></a></li>
 					<li class="report6 re"><a href="${ctx}/advertiser/main/ad/report/advertiser-report/osReport" style="text-decoration:none"><span class="baobiao11 ab">系统报表</span></a></li>
 					<li class="report6all re"><a href="${ctx}/advertiser/main/ad/report/advertiser-report/sceneReport" style="text-decoration:none"><span class="baobiao11 ab">场景报表</span></a></li>
+					<li class="report6 re"><a href="${ctx}/advertiser/main/ad/report/advertiser-report/ideaReport" style="text-decoration:none"><span class="baobiao11 ab">创意报表</span></a></li>
 				</ul>
 			</div>
 	   		<div id="third">