|
@@ -123,16 +123,16 @@
|
|
</where>
|
|
</where>
|
|
</select>
|
|
</select>
|
|
<select id="findCountForDeliverEffectAnalysisOperator" parameterType="map" resultType="int">
|
|
<select id="findCountForDeliverEffectAnalysisOperator" parameterType="map" resultType="int">
|
|
- select count(date) from ((
|
|
|
|
- select distinct date
|
|
|
|
|
|
+ select count(date)
|
|
from t_rpt_zone
|
|
from t_rpt_zone
|
|
<where>
|
|
<where>
|
|
- operator_id = #{operatorId} and date >= #{startDate} and #{endDate} >=date
|
|
|
|
|
|
+ <if test="zoneId==null">
|
|
|
|
+ operator_id = #{operatorId} and zone_id = 0 and date >= #{startDate} and #{endDate} >=date
|
|
|
|
+ </if>
|
|
<if test="zoneId!=null">
|
|
<if test="zoneId!=null">
|
|
- and zone_id=#{zoneId}
|
|
|
|
|
|
+ zone_id=#{zoneId} and operator_id = #{operatorId} and date >= #{startDate} and #{endDate} >=date
|
|
</if>
|
|
</if>
|
|
</where>
|
|
</where>
|
|
- ) as a)
|
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
|
|
@@ -193,20 +193,21 @@
|
|
</where>
|
|
</where>
|
|
</select>
|
|
</select>
|
|
|
|
|
|
-<select id="findDeliverEffectAnalysis" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
|
|
|
|
|
|
+ <select id="findDeliverEffectAnalysis" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
|
|
select
|
|
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
|
|
|
|
|
|
+ zone_id as zoneId,date as reportDate,pv,uv,impression,uImpression,
|
|
|
|
+ uClick,
|
|
|
|
+ 100*impression/pv as fillRate,
|
|
|
|
+ click as click,100* click/impression as clickRate,ecpm as eCpm,income as income
|
|
from t_rpt_zone
|
|
from t_rpt_zone
|
|
<where>
|
|
<where>
|
|
- operator_id = #{operatorId} and date >= #{startDate} and #{endDate} >=date
|
|
|
|
|
|
+ <if test="zoneId==null">
|
|
|
|
+ operator_id = #{operatorId} and zone_id = 0 and date >= #{startDate} and #{endDate} >=date
|
|
|
|
+ </if>
|
|
<if test="zoneId!=null">
|
|
<if test="zoneId!=null">
|
|
- and zone_id=#{zoneId}
|
|
|
|
|
|
+ operator_id = #{operatorId} and zone_id=#{zoneId} and date >= #{startDate} and #{endDate} >=date
|
|
</if>
|
|
</if>
|
|
</where>
|
|
</where>
|
|
- group by date
|
|
|
|
limit #{pager.offset}, #{pager.limit}
|
|
limit #{pager.offset}, #{pager.limit}
|
|
</select>
|
|
</select>
|
|
|
|
|
|
@@ -214,13 +215,11 @@
|
|
select sum(pv) as pv, sum(uv) as uv, sum(impression) as impression, sum(click) as click, sum(income) as income
|
|
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
|
|
from t_rpt_zone
|
|
<where>
|
|
<where>
|
|
- operator_id = #{operatorId}
|
|
|
|
- <if test="zoneId!=null">
|
|
|
|
- and zone_id=#{zoneId}
|
|
|
|
|
|
+ <if test="zoneId==null">
|
|
|
|
+ operator_id = #{operatorId} and zone_id = 0 and date >= #{startDate} and #{endDate} >=date
|
|
</if>
|
|
</if>
|
|
-
|
|
|
|
- <if test="startDate!=null and endDate!=null">
|
|
|
|
- and date >= #{startDate} and #{endDate} >=date
|
|
|
|
|
|
+ <if test="zoneId!=null">
|
|
|
|
+ operator_id = #{operatorId} and zone_id=#{zoneId} and date >= #{startDate} and #{endDate} >=date
|
|
</if>
|
|
</if>
|
|
</where>
|
|
</where>
|
|
</select>
|
|
</select>
|
|
@@ -1128,22 +1127,21 @@
|
|
|
|
|
|
|
|
|
|
<select id="findByAdvertiser" parameterType="map" resultType="map">
|
|
<select id="findByAdvertiser" parameterType="map" resultType="map">
|
|
- select ad.name as advertiserName,date as reportDate,a.consume as totalConsume,a.impression as totalImpression,
|
|
|
|
-click as totalClick, if(a.impression > 0,a.click/a.impression,0)
|
|
|
|
|
|
+ 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
|
|
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.order_id = 0 and a.campaign_id = 0
|
|
|
|
- and a.adgroup_id = 0 and a.banner_id = 0
|
|
|
|
|
|
+ where a.advertiser_id=#{advertiserId}
|
|
and a.date >= #{startDate} and a.date <=#{endDate}
|
|
and a.date >= #{startDate} and a.date <=#{endDate}
|
|
|
|
+ group by date(a.date)
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="findByAdvertiser3" parameterType="map" resultType="map">
|
|
<select id="findByAdvertiser3" parameterType="map" resultType="map">
|
|
- select ad.name as advertiserName,date as reportDate,a.consume as totalConsume,a.impression as totalImpression,
|
|
|
|
-click as totalClick, if(a.impression > 0,a.click/a.impression,0)
|
|
|
|
|
|
+ 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
|
|
as clickRate from t_rpt_advertiser as a left join t_advertiser ad on a.advertiser_id=ad.id
|
|
where a.advertiser_id=#{advertiserId}
|
|
where a.advertiser_id=#{advertiserId}
|
|
- and a.order_id = 0 and a.campaign_id = 0
|
|
|
|
- and a.adgroup_id = 0 and a.banner_id = 0
|
|
|
|
and a.date >= #{startDate} and a.date <=#{endDate}
|
|
and a.date >= #{startDate} and a.date <=#{endDate}
|
|
|
|
+ group by date(a.date)
|
|
limit #{pager.offset}, #{pager.limit}
|
|
limit #{pager.offset}, #{pager.limit}
|
|
</select>
|
|
</select>
|
|
|
|
|
|
@@ -1163,11 +1161,11 @@ click as totalClick, if(a.impression > 0,a.click/a.impression,0)
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="findByAdvertiser1" parameterType="map" resultType="map">
|
|
<select id="findByAdvertiser1" parameterType="map" resultType="map">
|
|
- select ad.name as advertiserName,date as reportDate, a.hour as hour,a.consume as totalConsume,a.impression as totalImpression,
|
|
|
|
-click as totalClick, if(a.impression > 0,a.click/a.impression,0)
|
|
|
|
|
|
+ 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
|
|
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} and a.order_id = 0 and a.campaign_id = 0
|
|
|
|
- and a.adgroup_id = 0 and a.banner_id = 0
|
|
|
|
|
|
+ where a.advertiser_id=#{advertiserId} and a.date = #{startDate}
|
|
|
|
+ group by a.hour
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="countByPlace" parameterType="map" resultType="int">
|
|
<select id="countByPlace" parameterType="map" resultType="int">
|
|
@@ -1177,12 +1175,11 @@ click as totalClick, if(a.impression > 0,a.click/a.impression,0)
|
|
|
|
|
|
|
|
|
|
<select id="findByAdvertiser2" parameterType="map" resultType="map">
|
|
<select id="findByAdvertiser2" parameterType="map" resultType="map">
|
|
- select ad.name as advertiserName,date as reportDate, a.hour as hour,a.consume as totalConsume,a.impression as totalImpression,
|
|
|
|
-click as totalClick, if(a.impression > 0,a.click/a.impression,0)
|
|
|
|
|
|
+ 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
|
|
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}
|
|
where a.advertiser_id=#{advertiserId} and a.date = #{startDate}
|
|
- and a.order_id = 0 and a.campaign_id = 0
|
|
|
|
- and a.adgroup_id = 0 and a.banner_id = 0
|
|
|
|
|
|
+ group by a.hour
|
|
limit #{pager.offset}, #{pager.limit}
|
|
limit #{pager.offset}, #{pager.limit}
|
|
</select>
|
|
</select>
|
|
|
|
|
|
@@ -1202,9 +1199,8 @@ click as totalClick, if(a.impression > 0,a.click/a.impression,0)
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="findCountForChart" parameterType="map" resultType="int">
|
|
<select id="findCountForChart" parameterType="map" resultType="int">
|
|
- select count(date) from t_rpt_advertiser where advertiser_id=#{advertiserId} and
|
|
|
|
- order_id = 0 and campaign_id = 0 and adgroup_id = 0 and banner_id = 0
|
|
|
|
- and date >= #{startDate} and date <=#{endDate}
|
|
|
|
|
|
+ select count(date) from((select distinct date from t_rpt_advertiser where advertiser_id=#{advertiserId}
|
|
|
|
+ and date >= #{startDate} and date <=#{endDate}) as a)
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="findByPlace1" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
|
|
<select id="findByPlace1" parameterType="map" resultType="com.cloudcross.ssp.model.DeliverAnalysis">
|
|
@@ -1221,16 +1217,13 @@ click as totalClick, if(a.impression > 0,a.click/a.impression,0)
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="findCountForChart1" parameterType="map" resultType="int">
|
|
<select id="findCountForChart1" parameterType="map" resultType="int">
|
|
- select count(hour) from t_rpt_advertiser_hour where advertiser_id=#{advertiserId} and
|
|
|
|
- order_id = 0 and campaign_id = 0 and adgroup_id = 0 and banner_id = 0
|
|
|
|
- and date = #{startDate}
|
|
|
|
|
|
+ select count(hour) from ((select distinct hour from t_rpt_advertiser_hour where advertiser_id=#{advertiserId} and date = #{startDate}) as a)
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="findTotalImpressionAndClickByAdvertiserId" parameterType="map" resultType="map">
|
|
<select id="findTotalImpressionAndClickByAdvertiserId" parameterType="map" resultType="map">
|
|
- select impression as totalImpression, click as totalClick
|
|
|
|
|
|
+ select sum(impression) as totalImpression, sum(click) as totalClick
|
|
from t_rpt_advertiser
|
|
from t_rpt_advertiser
|
|
- where advertiser_id = #{advertiserId} and date = #{date} and order_id = 0 and campaign_id = 0
|
|
|
|
- and adgroup_id = 0 and banner_id = 0
|
|
|
|
|
|
+ where advertiser_id = #{advertiserId} and date = #{date}
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="countByApmac" parameterType="map" resultType="int">
|
|
<select id="countByApmac" parameterType="map" resultType="int">
|
|
@@ -1242,8 +1235,7 @@ click as totalClick, if(a.impression > 0,a.click/a.impression,0)
|
|
select sum(a.impression) as totalImpression, sum(a.click) as totalClick
|
|
select sum(a.impression) as totalImpression, sum(a.click) as totalClick
|
|
from t_rpt_advertiser a,t_advertiser b
|
|
from t_rpt_advertiser a,t_advertiser b
|
|
where b.id = a.advertiser_id and b.agent_id = #{agentId}
|
|
where b.id = a.advertiser_id and b.agent_id = #{agentId}
|
|
- and a.date = #{date} and a.advertiser_id != 0 and a.order_id = 0 and a.campaign_id = 0
|
|
|
|
- and a.adgroup_id = 0 and a.banner_id = 0
|
|
|
|
|
|
+ and a.date = #{date}
|
|
|
|
|
|
</select>
|
|
</select>
|
|
|
|
|