|
@@ -261,22 +261,59 @@
|
|
|
|
|
|
</select>
|
|
|
<select id="getSettlementDate" resultType="com.alibaba.fastjson.JSONObject" parameterType="java.lang.Long">
|
|
|
- select t.* from (
|
|
|
- select
|
|
|
+ <!-- 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'
|
|
|
+ from (select id as 'id',
|
|
|
+ rule_name as 'ruleName',
|
|
|
+ item_ids as 'itemIds',
|
|
|
+ substring_index(item_ids, ',', 1) as 'itemId',
|
|
|
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
|
|
|
+ order_num as 'orderNum',
|
|
|
+ valid_order_num as 'validOrderNum',
|
|
|
+ last_settlement_order_num as 'lastSettlementOrderNum',
|
|
|
+ anchor_amount as 'anchorAmount',
|
|
|
+ reference_amount as 'referenceAmount',
|
|
|
+ settlement_status as 'settlementStatus',
|
|
|
+ (
|
|
|
+ case
|
|
|
+ when settlement_status = 1 then '未达到结算规则'
|
|
|
+ when settlement_status = 2 then '待结算'
|
|
|
+ when settlement_status = 3 then '已结算'
|
|
|
+ else '-'
|
|
|
+ end
|
|
|
+ ) as 'settlementStatusDesc'
|
|
|
+ from kuaishou_rule_settlement_data t1
|
|
|
+ where t1.stat_date = #{statDate}
|
|
|
+ and settlement_status >= 2
|
|
|
+ and anchor_amount > 0
|
|
|
<if test="promoterId != null and promoterId != '' ">
|
|
|
- and promoter_id = #{promoterId}
|
|
|
+ and t1.promoter_id = #{promoterId}
|
|
|
</if>
|
|
|
<if test="promoterName != null and promoterName != '' ">
|
|
|
- AND promoter_name LIKE CONCAT('%', #{promoterName}, '%')
|
|
|
+ AND t1.promoter_name LIKE CONCAT('%', #{promoterName}, '%')
|
|
|
</if>
|
|
|
- group by promoter_id) t order by t.anchorAmount desc
|
|
|
+
|
|
|
+ order by t1.anchor_amount, promoter_id) t
|
|
|
+ left join kuaishou_item_list t2 on t.itemId = t2.item_id
|
|
|
+
|
|
|
+
|
|
|
</select>
|
|
|
<select id="getPromoterSettlementDetail" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
select
|