|
|
|
@ -197,10 +197,9 @@
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="listCustomersData" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
|
SELECT r.nickname,r.headimg,o.customer_id,sum(if(t.transaction_type='Credit',t.clearing_amount,0)) amount,
|
|
|
|
|
COUNT(DISTINCT o.order_id) orders,max(t.clearing_amount) max_order
|
|
|
|
|
SELECT r.nickname,r.headimg,o.customer_id,sum(if(o.status='5',o.customer_payment_amount,0)) amount,
|
|
|
|
|
COUNT(DISTINCT o.order_id) orders,max(o.customer_payment_amount) max_order
|
|
|
|
|
FROM pmt_orders o
|
|
|
|
|
INNER JOIN pmt_transactions t on t.order_id=o.order_id and t.system_generate=0 and (t.transaction_type='Credit' or t.transaction_type>0)
|
|
|
|
|
<if test="openid_type==4">
|
|
|
|
|
LEFT JOIN sys_customer_relation r on r.globalpay_openid = o.customer_id
|
|
|
|
|
</if>
|
|
|
|
@ -236,9 +235,8 @@
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="listCustomersDataAnalysis" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
|
SELECT sum(if(t.transaction_type='Credit',t.clearing_amount,0)) total_amount
|
|
|
|
|
SELECT sum(if(o.status='5',o.customer_payment_amount,0)) total_amount
|
|
|
|
|
FROM pmt_orders o
|
|
|
|
|
INNER JOIN pmt_transactions t on t.order_id=o.order_id and t.system_generate=0 and (t.transaction_type='Credit' or t.refund_id is not null)
|
|
|
|
|
<where>
|
|
|
|
|
<if test="begin!=null">and o.create_time >= #{begin}</if>
|
|
|
|
|
<if test="end!=null">and o.create_time < #{end}</if>
|
|
|
|
|