|
@@ -0,0 +1,1275 @@
|
|
|
+<?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="back.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>
|
|
|
+
|
|
|
+ <select id="findCountForDeliverEffectAnalysis" 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 >= #{startDate} and #{endDate} >=ad.date
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <select id="findCountForLocation" 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 >= #{startDate} and #{endDate} >=rl.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 >= #{startDate} and #{endDate} >=ros.date
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </where>
|
|
|
+ </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 >= #{startDate} and rp.date <= #{endDate}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+ <select id="findByTotalReport" parameterType="map" resultType="com.cloudcross.ssp.back.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 >= #{startDate} and #{endDate} >=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 >= #{startDate} and #{endDate} >=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 >= #{startDate} and #{endDate} >=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 >= #{startDate} and #{endDate} >=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 >= #{startDate} and #{endDate} >=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 >= #{startDate} and #{endDate} >=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 >= #{startDate} and #{endDate} >=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 >= #{startDate} and #{endDate} >=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 >= #{startDate} and #{endDate} >=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 >= #{startDate} and #{endDate} >=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 >= #{startDate} and #{endDate} >=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 >= #{startDate} and #{endDate} >=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 >= #{startDate} and #{endDate} >=date
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </where>
|
|
|
+
|
|
|
+ limit #{pager.offset}, #{pager.limit}
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <select id="findByTotalReport2" parameterType="map" resultType="com.cloudcross.ssp.back.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 >= #{startDate} and #{endDate} >=date
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </where>
|
|
|
+
|
|
|
+ limit #{pager.offset}, #{pager.limit}
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+ <select id="findByLocation" parameterType="map" resultType="com.cloudcross.ssp.back.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 >= #{startDate} and #{endDate} >=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 >= #{startDate} and #{endDate} >=rl.date
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </where>
|
|
|
+
|
|
|
+ limit #{pager.offset}, #{pager.limit}
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <select id="findByOs" parameterType="map" resultType="com.cloudcross.ssp.back.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 >= #{startDate} and #{endDate} >=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 >= #{startDate} and #{endDate} >=ros.date
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </where>
|
|
|
+
|
|
|
+ limit #{pager.offset}, #{pager.limit}
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <select id="findByPlaceName" parameterType="map" resultType="com.cloudcross.ssp.back.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 >= #{startDate} and #{endDate} >=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 >= #{startDate} and #{endDate} >=rp.date
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </where>
|
|
|
+ limit #{pager.offset}, #{pager.limit}
|
|
|
+ </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 <=#{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 <=#{endDate}
|
|
|
+ group by date(a.date)
|
|
|
+ limit #{pager.offset}, #{pager.limit}
|
|
|
+ </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="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="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 <=#{endDate}) as a)
|
|
|
+ </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="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="findByTotalForExcel" parameterType="map" resultType="com.cloudcross.ssp.back.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 >= #{startDate} and #{endDate} >=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 >= #{startDate} and #{endDate} >=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 >= #{startDate} and #{endDate} >=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 >= #{startDate} and #{endDate} >=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 >= #{startDate} and #{endDate} >=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 >= #{startDate} and #{endDate} >=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 >= #{startDate} and #{endDate} >=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 >= #{startDate} and #{endDate} >=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 >= #{startDate} and #{endDate} >=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 >= #{startDate} and #{endDate} >=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 >= #{startDate} and #{endDate} >=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 >= #{startDate} and #{endDate} >=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 >= #{startDate} and #{endDate} >=date
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </where>
|
|
|
+
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="findByLocationForExcel" parameterType="map" resultType="com.cloudcross.ssp.back.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(impression) from t_rpt_adv_location) 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 >= #{startDate} and #{endDate} >=rl.date
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </where>
|
|
|
+
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <select id="findByOsForExcel" parameterType="map" resultType="com.cloudcross.ssp.back.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 >= #{startDate} and #{endDate} >=ros.date
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </where>
|
|
|
+
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="findByPlaceNameForExcel" parameterType="map" resultType="com.cloudcross.ssp.back.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 >= #{startDate} and #{endDate} >=rp.date
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+</mapper>
|