master
yuan 7 years ago
parent b65f8f0a15
commit 5f88caca01

@ -358,12 +358,12 @@
<select id="getAreaMerchantTradeAnalysis" resultType="com.alibaba.fastjson.JSONObject">
SELECT sum(s.total) total,sum(s.orders) orders,c.client_moniker,c.short_name,c.bd_user_name,c.suburb,c.state,c.royalpayindustry,sum(if(s.channel='Alipay',s.total,0)) alipay_total,
sum(if(s.channel='Alipay',s.orders,0)) alipay_order,sum(if(s.channel='Wechat',s.total,0)) wechat_toatl,sum(if(s.channel='Wechat',s.orders,0)) wechat_order
sum(if(s.channel='Alipay'OR s.channel='AlipayOnline',s.orders,0)) alipay_order,sum(if(s.channel='Wechat',s.total,0)) wechat_toatl,sum(if(s.channel='Wechat',s.orders,0)) wechat_order
FROM statistics_customer_order s
RIGHT JOIN sys_clients c ON c.client_id = s.client_id and c.is_valid=1
<if test="bd_user!=null">
INNER JOIN sys_client_bd d ON c.client_id = d.client_id AND d.bd_id = #{bd_user} and
date(d.start_date)&lt;= date(now()) and (d.end_date is null or date(d.end_date)&gt;= date(now())) and
date(d.start_date)&lt;= #{begin} and (d.end_date is null or date(d.end_date)&gt;= #{end}) and
d.is_valid=1
</if>
<where>

@ -797,19 +797,19 @@
<select id="getAreaMerchantAmountAnalysis" resultType="com.alibaba.fastjson.JSONObject">
SELECT c.client_moniker,c.short_name,c.bd_user_name,sum(if(t.transaction_type='Credit',t.clearing_amount,0)) total,
sum(if(t.transaction_type='Credit',1,0)) orders,
c.suburb,c.state,c.royalpayindustry,sum(if(t.channel='Alipay'AND t.transaction_type='Credit',t.clearing_amount,0)) alipay_total,
sum(if(t.channel='Alipay'AND t.transaction_type='Credit',1,0)) alipay_order,sum(if(t.channel='Wechat'AND t.transaction_type='Credit',t.clearing_amount,0)) wechat_toatl,
sum(if(t.channel='Wechat'AND t.transaction_type='Credit',1,0)) wechat_order
COUNT(DISTINCT t.order_id) orders,
c.suburb,c.state,c.royalpayindustry,sum(if(t.channel='Alipay',t.clearing_amount,0)) alipay_total,
sum(if(t.channel='Alipay'AND t.channel='AlipayOnline',1,0)) alipay_order,sum(if(t.channel='Wechat',t.clearing_amount,0)) wechat_toatl,
sum(if(t.channel='Wechat',1,0)) wechat_order
FROM pmt_transactions t
INNER JOIN pmt_orders ord on ord.order_id = t.order_id
RIGHT JOIN sys_clients c on t.client_id = c.client_id and c.is_valid = 1
<if test="bd_user!=null">
INNER JOIN sys_client_bd d ON c.client_id = d.client_id AND d.bd_id = #{bd_user} and
date(d.start_date)&lt;= date(now()) and (d.end_date is null or date(d.end_date)&gt;= date(now())) and
date(d.start_date)&lt;= #{begin} and (d.end_date is null or date(d.end_date)&gt;= #{end}) and
d.is_valid=1
</if>
where (t.transaction_type = 'Credit' or t.refund_id is not null)
where (t.transaction_type = 'Credit')
<if test="begin!=null">and t.transaction_time &gt;= #{begin}</if>
<if test="end!=null">and t.transaction_time &lt;= #{end}</if>
<if test="state!=null">and c.state &lt;= #{state}</if>

Loading…
Cancel
Save