|
|
@@ -1255,4 +1255,188 @@
|
|
|
AND order_create_time <= #{endLong}
|
|
|
)t2 ON 1=1
|
|
|
</select>
|
|
|
+
|
|
|
+
|
|
|
+ <select id="bdReportList" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
+ select
|
|
|
+ t1.collectSampleId,
|
|
|
+ t1.collectSampleName,
|
|
|
+ t2.promoterCount,
|
|
|
+ t3.sampleCount,
|
|
|
+ round(t3.sampleCount / promoterCount * 100, 3) as 'sampleRate',
|
|
|
+ t2.promoterCount - t3.sampleCount as 'notSampleCount',
|
|
|
+ t1.orderNum,
|
|
|
+ t1.validOrderNum,
|
|
|
+ t1.validOrderRate,
|
|
|
+ t1.orderAmount,
|
|
|
+ t1.regimentalPromotionAmount,
|
|
|
+ t1.totalRegimentalSettleAmount
|
|
|
+ from (
|
|
|
+ select collect_sample_id as 'collectSampleId',
|
|
|
+ collect_sample_name as 'collectSampleName',
|
|
|
+ sum(order_num) as 'orderNum',
|
|
|
+ sum(valid_order_num) as 'validOrderNum',
|
|
|
+ round(sum(valid_order_num) / sum(order_num) * 100, 3) as 'validOrderRate',
|
|
|
+ sum(order_amount) as 'orderAmount',
|
|
|
+ sum(regimental_promotion_amount) as 'regimentalPromotionAmount',
|
|
|
+ sum(total_regimental_settle_amount) as 'totalRegimentalSettleAmount'
|
|
|
+ from ruixuan.canal_management
|
|
|
+ where 1 = 1
|
|
|
+ <if test="start != null and start != ''">
|
|
|
+ and stat_date >= #{start}
|
|
|
+ </if>
|
|
|
+ <if test="end != null and end != ''">
|
|
|
+ and stat_date <= #{end}
|
|
|
+ </if>
|
|
|
+ <if test="collectSampleId != null and collectSampleId != ''">
|
|
|
+ and collect_sample_id = #{collectSampleId}
|
|
|
+ </if>
|
|
|
+ group by collect_sample_id) t1
|
|
|
+ left join (
|
|
|
+ select user_id as 'userId',
|
|
|
+ count(distinct promoter_id) as 'promoterCount'
|
|
|
+ from kuaishou_promoter
|
|
|
+ group by user_id) t2
|
|
|
+ on t1.collectSampleId = t2.userId
|
|
|
+ left join (
|
|
|
+ select collect_sample_id as 'collectSampleId',
|
|
|
+ count(distinct promoter_id) as 'sampleCount'
|
|
|
+ from kuaishou_item_collect_samples
|
|
|
+ where collect_sample_status > 2
|
|
|
+ group by collect_sample_id) t3
|
|
|
+ on t2.userId = t3.collectSampleId
|
|
|
+ order by t1.orderNum desc
|
|
|
+ </select>
|
|
|
+ <select id="bdDetailList" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
+ select
|
|
|
+ t1.promoterId,
|
|
|
+ t1.promoterName,
|
|
|
+ t1.promoterUrl,
|
|
|
+ t2.sampleCount,
|
|
|
+ t1.orderNum,
|
|
|
+ t1.validOrderNum,
|
|
|
+ t1.validOrderRate,
|
|
|
+ t1.orderAmount,
|
|
|
+ t1.regimentalPromotionAmount,
|
|
|
+ t1.totalRegimentalSettleAmount
|
|
|
+ from (
|
|
|
+ select promoter_id as 'promoterId',
|
|
|
+ promoter_name as 'promoterName',
|
|
|
+ promoter_url as 'promoterUrl',
|
|
|
+ sum(order_num) as 'orderNum',
|
|
|
+ sum(valid_order_num) as 'validOrderNum',
|
|
|
+ round(sum(valid_order_num) / sum(order_num) * 100, 3) as 'validOrderRate',
|
|
|
+ sum(order_amount) as 'orderAmount',
|
|
|
+ sum(regimental_promotion_amount) as 'regimentalPromotionAmount',
|
|
|
+ sum(total_regimental_settle_amount) as 'totalRegimentalSettleAmount'
|
|
|
+ from ruixuan.canal_management
|
|
|
+ where 1 = 1
|
|
|
+ <if test="start != null and start != ''">
|
|
|
+ and stat_date >= #{start}
|
|
|
+ </if>
|
|
|
+ <if test="end != null and end != ''">
|
|
|
+ and stat_date <= #{end}
|
|
|
+ </if>
|
|
|
+ <if test="collectSampleId != null and collectSampleId != ''">
|
|
|
+ and collect_sample_id = #{collectSampleId}
|
|
|
+ </if>
|
|
|
+ group by promoter_id) t1
|
|
|
+ left join (
|
|
|
+ select promoter_id as 'promoterId',
|
|
|
+ count(distinct item_id) as 'sampleCount'
|
|
|
+ from kuaishou_item_collect_samples
|
|
|
+ where collect_sample_status > 2
|
|
|
+ <if test="collectSampleId != null and collectSampleId != ''">
|
|
|
+ and collect_sample_id = #{collectSampleId}
|
|
|
+ </if>
|
|
|
+ group by promoter_id) t2
|
|
|
+ on t1.promoterId = t2.promoterId
|
|
|
+ order by ${fieId} ${sort}
|
|
|
+ </select>
|
|
|
+ <select id="bdTotal" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
+ select
|
|
|
+ t2.sampleCount,
|
|
|
+ t1.orderNum,
|
|
|
+ t1.validOrderNum,
|
|
|
+ t1.validOrderRate,
|
|
|
+ t1.orderAmount,
|
|
|
+ t1.regimentalPromotionAmount,
|
|
|
+ t1.totalRegimentalSettleAmount
|
|
|
+ from (
|
|
|
+ select
|
|
|
+ sum(order_num) as 'orderNum',
|
|
|
+ sum(valid_order_num) as 'validOrderNum',
|
|
|
+ round(sum(valid_order_num) / sum(order_num) * 100, 3) as 'validOrderRate',
|
|
|
+ sum(order_amount) as 'orderAmount',
|
|
|
+ sum(regimental_promotion_amount) as 'regimentalPromotionAmount',
|
|
|
+ sum(total_regimental_settle_amount) as 'totalRegimentalSettleAmount'
|
|
|
+ from ruixuan.canal_management
|
|
|
+ where 1 = 1
|
|
|
+ <if test="start != null and start != ''">
|
|
|
+ and stat_date >= #{start}
|
|
|
+ </if>
|
|
|
+ <if test="end != null and end != ''">
|
|
|
+ and stat_date <= #{end}
|
|
|
+ </if>
|
|
|
+ <if test="collectSampleId != null and collectSampleId != ''">
|
|
|
+ and collect_sample_id = #{collectSampleId}
|
|
|
+ </if>
|
|
|
+ ) t1
|
|
|
+ join (
|
|
|
+ select
|
|
|
+ count(distinct item_id) as 'sampleCount'
|
|
|
+ from kuaishou_item_collect_samples
|
|
|
+ where collect_sample_status > 2
|
|
|
+ <if test="collectSampleId != null and collectSampleId != ''">
|
|
|
+ and collect_sample_id = #{collectSampleId}
|
|
|
+ </if>
|
|
|
+ ) t2
|
|
|
+
|
|
|
+ </select>
|
|
|
+ <select id="exportBdDetail" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
+ select
|
|
|
+ t1.promoterId,
|
|
|
+ t1.promoterName,
|
|
|
+ t1.promoterUrl,
|
|
|
+ t2.sampleCount,
|
|
|
+ t1.orderNum,
|
|
|
+ t1.validOrderNum,
|
|
|
+ t1.validOrderRate,
|
|
|
+ t1.orderAmount,
|
|
|
+ t1.regimentalPromotionAmount,
|
|
|
+ t1.totalRegimentalSettleAmount
|
|
|
+ from (
|
|
|
+ select promoter_id as 'promoterId',
|
|
|
+ promoter_name as 'promoterName',
|
|
|
+ promoter_url as 'promoterUrl',
|
|
|
+ sum(order_num) as 'orderNum',
|
|
|
+ sum(valid_order_num) as 'validOrderNum',
|
|
|
+ round(sum(valid_order_num) / sum(order_num) * 100, 3) as 'validOrderRate',
|
|
|
+ sum(order_amount) as 'orderAmount',
|
|
|
+ sum(regimental_promotion_amount) as 'regimentalPromotionAmount',
|
|
|
+ sum(total_regimental_settle_amount) as 'totalRegimentalSettleAmount'
|
|
|
+ from ruixuan.canal_management
|
|
|
+ where 1 = 1
|
|
|
+ <if test="start != null and start != ''">
|
|
|
+ and stat_date >= #{start}
|
|
|
+ </if>
|
|
|
+ <if test="end != null and end != ''">
|
|
|
+ and stat_date <= #{end}
|
|
|
+ </if>
|
|
|
+ <if test="collectSampleId != null and collectSampleId != ''">
|
|
|
+ and collect_sample_id = #{collectSampleId}
|
|
|
+ </if>
|
|
|
+ group by promoter_id) t1
|
|
|
+ left join (
|
|
|
+ select promoter_id as 'promoterId',
|
|
|
+ count(distinct item_id) as 'sampleCount'
|
|
|
+ from kuaishou_item_collect_samples
|
|
|
+ where collect_sample_status > 2
|
|
|
+ <if test="collectSampleId != null and collectSampleId != ''">
|
|
|
+ and collect_sample_id = #{collectSampleId}
|
|
|
+ </if>
|
|
|
+ group by promoter_id) t2
|
|
|
+ on t1.promoterId = t2.promoterId
|
|
|
+ order by t1.orderNum desc
|
|
|
+ </select>
|
|
|
</mapper>
|