|
@@ -211,16 +211,16 @@
|
|
|
from kuaishou_rule_detail where rule_id = #{ruleId}
|
|
|
</select>
|
|
|
<select id="lastRule" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
- select son_rule_id as 'sonRuleId',
|
|
|
- (select sort_count from kuaishou_rule_detail where id = t1.son_rule_id) as 'sortCount',
|
|
|
- IFNULL(valid_order_num,0) as 'validOrderNum'
|
|
|
- from kuaishou_rule_settlement_data t1
|
|
|
+ select son_rule_id as 'sonRuleId',
|
|
|
+ (select sort_count from kuaishou_rule_detail where id = t1.son_rule_id) as 'sortCount',
|
|
|
+ IFNULL(valid_order_num,0) as 'validOrderNum'
|
|
|
+ from kuaishou_rule_settlement_data t1
|
|
|
where 1 = 1
|
|
|
<if test="relateId != null and relateId != ''">
|
|
|
- and relate_id = #{relateId}
|
|
|
+ and relate_id = #{relateId}
|
|
|
</if>
|
|
|
- and promoter_id = #{promoterId}
|
|
|
- and rule_id = #{ruleId}
|
|
|
+ and promoter_id = #{promoterId}
|
|
|
+ and rule_id = #{ruleId}
|
|
|
and settlement_status != 1
|
|
|
order by create_time desc limit 1
|
|
|
</select>
|
|
@@ -244,7 +244,6 @@
|
|
|
</select>
|
|
|
|
|
|
|
|
|
-
|
|
|
<insert id="replaceIncentiveLog">
|
|
|
replace into kuaishou_rule_incentive_log (
|
|
|
relate_id,
|
|
@@ -279,7 +278,6 @@
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
-
|
|
|
<select id="getTotalByCountAndRuleId" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
select
|
|
|
ifnull(round(sum(anchor_amount) * #{incentivizedCount}, 2),0) as 'anchorAmount',
|
|
@@ -292,26 +290,9 @@
|
|
|
|
|
|
</select>
|
|
|
<select id="getSettlementDate" resultType="com.alibaba.fastjson.JSONObject" parameterType="java.lang.Long">
|
|
|
- <!-- select t.* from (
|
|
|
- select
|
|
|
- promoter_id as 'promoterId',
|
|
|
- promoter_name as 'promoterName',
|
|
|
- sum(anchor_amount) as 'anchorAmount',
|
|
|
- sum(reference_amount) as 'referenceAmount'
|
|
|
- from kuaishou_rule_settlement_data
|
|
|
- where stat_date = #{statDate}
|
|
|
- and settlement_status != 3
|
|
|
- <if test="promoterId != null and promoterId != '' ">
|
|
|
- and promoter_id = #{promoterId}
|
|
|
- </if>
|
|
|
- <if test="promoterName != null and promoterName != '' ">
|
|
|
- AND promoter_name LIKE CONCAT('%', #{promoterName}, '%')
|
|
|
- </if>
|
|
|
- group by promoter_id) t order by t.anchorAmount desc-->
|
|
|
-
|
|
|
select t.*, t2.item_title as 'itemName',
|
|
|
- t2.user_name as 'itemUserName',
|
|
|
- (select user_name from kuaishou_promoter where promoter_id = t.promoterId limit 1) as 'promoterUserName'
|
|
|
+ t2.user_name as 'itemUserName',
|
|
|
+ (select user_name from kuaishou_promoter where promoter_id = t.promoterId limit 1) as 'promoterUserName'
|
|
|
from (select id as 'id',
|
|
|
rule_name as 'ruleName',
|
|
|
item_ids as 'itemIds',
|
|
@@ -326,9 +307,9 @@
|
|
|
settlement_status as 'settlementStatus',
|
|
|
(
|
|
|
case
|
|
|
- when settlement_status = 1 then '未达到结算规则'
|
|
|
- when settlement_status = 2 then '待结算'
|
|
|
- when settlement_status = 3 then '已结算'
|
|
|
+ when settlement_status = 1 then '未达到结算规则'
|
|
|
+ when settlement_status = 2 then '待结算'
|
|
|
+ when settlement_status = 3 then '已结算'
|
|
|
else '-'
|
|
|
end
|
|
|
) as 'settlementStatusDesc'
|
|
@@ -347,6 +328,28 @@
|
|
|
left join kuaishou_item_list t2 on t.itemId = t2.item_id
|
|
|
order by t.settlementStatus asc
|
|
|
</select>
|
|
|
+
|
|
|
+ <select id="getSettlementDataV2" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
+ select t.* from (
|
|
|
+ select
|
|
|
+ promoter_id as 'promoterId',
|
|
|
+
|
|
|
+ promoter_name as 'promoterName',
|
|
|
+ sum(anchor_amount) as 'anchorAmount',
|
|
|
+ sum(reference_amount) as 'referenceAmount'
|
|
|
+ from kuaishou_rule_settlement_data
|
|
|
+ where stat_date = #{statDate}
|
|
|
+ and settlement_status != 3
|
|
|
+ <if test="promoterId != null and promoterId != '' ">
|
|
|
+ and promoter_id = #{promoterId}
|
|
|
+ </if>
|
|
|
+ <if test="promoterName != null and promoterName != '' ">
|
|
|
+ AND promoter_name LIKE CONCAT('%', #{promoterName}, '%')
|
|
|
+ </if>
|
|
|
+ group by promoter_id) t order by t.anchorAmount desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
<select id="getPromoterSettlementDetail" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
select
|
|
|
id as 'id',
|