|
@@ -86,8 +86,10 @@
|
|
|
DATE_FORMAT( date_time, '%Y-%m' ) AS uploadYears,
|
|
|
user_id AS ksId,
|
|
|
total_charged_in_yuan AS dailyCharge,
|
|
|
- credit_real_charged_in_yuan AS realCharged,
|
|
|
- account_name,
|
|
|
+ contract_rebate_real_charged_in_yuan AS contractRebateRealCharged,
|
|
|
+ direct_rebate_real_charged_in_yuan as directRebateRealCharged,
|
|
|
+ (real_charged_in_yuan + total_rebate_real_charged_in_yuan + credit_real_charged_in_yuan) as realCharged,
|
|
|
+ account_name as accountName,
|
|
|
create_time
|
|
|
FROM
|
|
|
ctop_kuaishou_daily_agent
|
|
@@ -98,8 +100,6 @@
|
|
|
t.uploadYears = #{uploadYears}
|
|
|
ORDER BY
|
|
|
t.date
|
|
|
-
|
|
|
-
|
|
|
</select>
|
|
|
|
|
|
|
|
@@ -267,7 +267,7 @@
|
|
|
|
|
|
<!-- 查询 快手 利润表 总花费-->
|
|
|
<select id="getProfitKuaiShouAccountCost" resultType="java.util.LinkedHashMap">
|
|
|
- SELECT
|
|
|
+ <!--SELECT
|
|
|
d.account_id AS accountId,
|
|
|
SUM( d.daily_charge ) AS cost,
|
|
|
SUM( d.real_charged ) AS cashCost,
|
|
@@ -289,13 +289,36 @@
|
|
|
AND d.date <= #{endTime}
|
|
|
</if>
|
|
|
GROUP BY
|
|
|
- d.account_id;
|
|
|
+ d.account_id;-->
|
|
|
+
|
|
|
+ SELECT
|
|
|
+ d.account_id,
|
|
|
+ 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,
|
|
|
+ c.product_id as productId,
|
|
|
+ (SELECT p.product_name from ctop_product p where p.id = c.product_id) AS productName
|
|
|
+ FROM
|
|
|
+ ctop_kuaishou_daily_agent d
|
|
|
+ RIGHT JOIN ctop_cwjs_settlement_info c
|
|
|
+ on d.account_id = c.account_id
|
|
|
+ and c.kuai_shou_id = d.user_id
|
|
|
+ <if test="accountId !=null and accountId != ''">
|
|
|
+ AND d.account_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>
|
|
|
+ GROUP BY d.account_id
|
|
|
</select>
|
|
|
|
|
|
|
|
|
<!-- 查询 快手 利润表 总花费-->
|
|
|
<select id="getProfitKuaiShouCost" resultType="java.util.LinkedHashMap">
|
|
|
- SELECT
|
|
|
+ <!--SELECT
|
|
|
d.account_id AS accountId,
|
|
|
SUM( d.daily_charge ) AS cost,
|
|
|
SUM( d.real_charged ) AS cashCost,
|
|
@@ -315,14 +338,31 @@
|
|
|
</if>
|
|
|
<if test="endTime !=null and endTime != ''">
|
|
|
AND d.date <= #{endTime}
|
|
|
+ </if>-->
|
|
|
+ SELECT
|
|
|
+ d.account_id,
|
|
|
+ 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
|
|
|
+ FROM
|
|
|
+ ctop_kuaishou_daily_agent d
|
|
|
+ <if test="accountId !=null and accountId != ''">
|
|
|
+ AND d.account_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>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 查询 快手 利润表 广告主和运营和运营所属区域-->
|
|
|
<select id="getProfitKuaiShouOperate" resultType="java.util.LinkedHashMap">
|
|
|
- select
|
|
|
+ <!-- select
|
|
|
u.advertiser_id,
|
|
|
u.account_id,
|
|
|
b.user_id as ksId,
|
|
@@ -340,7 +380,21 @@
|
|
|
<if test="accountId !=null and accountId != ''">
|
|
|
AND u.account_id = #{accountId}
|
|
|
</if>
|
|
|
- </where>
|
|
|
+ </where>-->
|
|
|
+
|
|
|
+ SELECT
|
|
|
+ c.create_user_id AS operateUserId,
|
|
|
+ p.user_name AS operateName,
|
|
|
+ IFNULL( p.nick_name, '' ) AS operateArea,
|
|
|
+ d.NAME AS advertiserName
|
|
|
+ FROM
|
|
|
+ ctop_cwjs_settlement_file_info c
|
|
|
+ LEFT JOIN user_company p on c.create_user_id = p.user_id
|
|
|
+ LEFT JOIN ctop_advertiser d on d.id = c.advertiser_id
|
|
|
+ where c.del_flag = 0
|
|
|
+ <if test="accountId !=null and accountId != ''">
|
|
|
+ AND u.account_id = #{accountId}
|
|
|
+ </if>
|
|
|
</select>
|
|
|
|
|
|
|