|
@@ -199,6 +199,7 @@
|
|
|
GROUP BY
|
|
|
d.advertiser_id;
|
|
|
-->
|
|
|
+<!--
|
|
|
|
|
|
SELECT
|
|
|
d.advertiser_id AS accountId,
|
|
@@ -214,19 +215,38 @@
|
|
|
WHERE
|
|
|
d.advertiser_id = c.account_id
|
|
|
AND c.product_id = p.id
|
|
|
- <if test="accountId !=null and accountId != ''">
|
|
|
- AND d.advertiser_id = #{accountId}
|
|
|
- </if>
|
|
|
- <if test="startTime !=null and startTime != ''">
|
|
|
- AND d.date >= #{startTime}
|
|
|
- </if>
|
|
|
- <if test="endTime !=null and endTime != ''">
|
|
|
- AND d.date <= #{endTime}
|
|
|
- </if>
|
|
|
+
|
|
|
+-->
|
|
|
+
|
|
|
+ SELECT
|
|
|
+ d.advertiser_id as accountId,
|
|
|
+ SUM( d.cost ) AS cost,
|
|
|
+ SUM( d.cash_cost ) AS cashCost,
|
|
|
+ SUM( d.reward_cost ) rewardCost,
|
|
|
+ IFNULL((SELECT a.name from ctop_user_allocation u,ctop_advertiser a where d.advertiser_id = u.account_id and u.advertiser_id = a.id),(SELECT a.name
|
|
|
+ from ctop_cwjs_settlement_info c ,ctop_advertiser a where c.account_id = d.advertiser_id and c.advertiser_id = a.id)) as advertiserName,
|
|
|
+ IFNULL((SELECT
|
|
|
+ p.product_name
|
|
|
+ FROM ctop_user_allocation u,ctop_project pj,ctop_product p where d.advertiser_id = u.account_id and u.project_id = pj.id and pj.product_id = p.id
|
|
|
+ ),(SELECT p.product_name
|
|
|
+ FROM ctop_cwjs_settlement_info c,ctop_product p where d.advertiser_id = c.account_id and c.product_id = p.id)) productName
|
|
|
+ FROM
|
|
|
+ ctop_account_transaction_day d
|
|
|
+<where>
|
|
|
+ <if test="accountId !=null and accountId != ''">
|
|
|
+ AND d.advertiser_id = #{accountId}
|
|
|
+ </if>
|
|
|
+ <if test="startTime !=null and startTime != ''">
|
|
|
+ AND d.date >= #{startTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime !=null and endTime != ''">
|
|
|
+ AND d.date <= #{endTime}
|
|
|
+ </if>
|
|
|
+</where>
|
|
|
GROUP BY
|
|
|
d.advertiser_id;
|
|
|
|
|
|
- </select>
|
|
|
+</select>
|
|
|
|
|
|
|
|
|
<!-- 查询 头条利润表 总花费-->
|
|
@@ -452,7 +472,7 @@
|
|
|
GROUP BY
|
|
|
d.account_id;-->
|
|
|
|
|
|
- SELECT
|
|
|
+ <!-- SELECT
|
|
|
d.account_id as accountId,
|
|
|
d.user_id AS ksId,
|
|
|
SUM(d.total_charged_in_yuan) AS cost,
|
|
@@ -477,7 +497,35 @@
|
|
|
</if>
|
|
|
</where>
|
|
|
|
|
|
+ GROUP BY d.account_id-->
|
|
|
+
|
|
|
+ SELECT
|
|
|
+ d.account_id as accountId,
|
|
|
+ d.user_id AS ksId,
|
|
|
+ SUM(d.total_charged_in_yuan) AS cost,
|
|
|
+ SUM((d.real_charged_in_yuan + d.total_rebate_real_charged_in_yuan + d.credit_real_charged_in_yuan)) as cashCost,
|
|
|
+ IFNULL((SELECT a.name from ctop_user_allocation u,ctop_advertiser a where d.account_id = u.account_id and u.advertiser_id = a.id),(SELECT a.name
|
|
|
+ from ctop_cwjs_settlement_info c ,ctop_advertiser a where c.account_id = d.account_id and c.advertiser_id = a.id)) as advertiserName,
|
|
|
+ IFNULL((SELECT
|
|
|
+ p.product_name
|
|
|
+ FROM ctop_user_allocation u,ctop_project pj,ctop_product p where d.account_id = u.account_id and u.project_id = pj.id and pj.product_id = p.id
|
|
|
+ ),(SELECT p.product_name
|
|
|
+ FROM ctop_cwjs_settlement_info c,ctop_product p where d.account_id = c.account_id and c.product_id = p.id)) productName
|
|
|
+ FROM
|
|
|
+ ctop_kuaishou_daily_agent d
|
|
|
+ <where>
|
|
|
+ <if test="accountId !=null and accountId != ''">
|
|
|
+ AND d.account_id = #{accountId}
|
|
|
+ </if>
|
|
|
+ <if test="startTime !=null and startTime != ''">
|
|
|
+ AND d.date_time >= #{startTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime !=null and endTime != ''">
|
|
|
+ AND d.date_time <= #{endTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
GROUP BY d.account_id
|
|
|
+
|
|
|
</select>
|
|
|
|
|
|
|