|
|
@ -197,10 +197,16 @@
|
|
|
|
</select>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="listCustomersData" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
<select id="listCustomersData" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
SELECT o.customer_id,sum(if(t.transaction_type='Credit',t.clearing_amount,0)) amount,
|
|
|
|
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
|
|
|
|
COUNT(DISTINCT o.order_id) orders,max(t.clearing_amount) max_order
|
|
|
|
FROM pmt_orders o
|
|
|
|
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)
|
|
|
|
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>
|
|
|
|
|
|
|
|
<if test="openid_type==0 or openid_type==1">
|
|
|
|
|
|
|
|
LEFT JOIN sys_customer_relation r on r.wechat_openid = o.customer_id
|
|
|
|
|
|
|
|
</if>
|
|
|
|
<where>
|
|
|
|
<where>
|
|
|
|
<if test="begin!=null">and o.create_time >= #{begin}</if>
|
|
|
|
<if test="begin!=null">and o.create_time >= #{begin}</if>
|
|
|
|
<if test="end!=null">and o.create_time < #{end}</if>
|
|
|
|
<if test="end!=null">and o.create_time < #{end}</if>
|
|
|
@ -216,6 +222,9 @@
|
|
|
|
<if test="openid_type==3">
|
|
|
|
<if test="openid_type==3">
|
|
|
|
and o.channel='Bestpay'
|
|
|
|
and o.channel='Bestpay'
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
|
|
|
|
<if test="openid_type==4">
|
|
|
|
|
|
|
|
AND o.customer_id LIKE 'olH%' and o.channel='Wechat'
|
|
|
|
|
|
|
|
</if>
|
|
|
|
<if test="customer_id!=null">
|
|
|
|
<if test="customer_id!=null">
|
|
|
|
and o.customer_id=#{customer_id}
|
|
|
|
and o.customer_id=#{customer_id}
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
@ -245,6 +254,9 @@
|
|
|
|
<if test="openid_type==3">
|
|
|
|
<if test="openid_type==3">
|
|
|
|
and o.channel='Bestpay'
|
|
|
|
and o.channel='Bestpay'
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|
|
|
|
|
<if test="openid_type==4">
|
|
|
|
|
|
|
|
AND customer_id LIKE 'olH%'
|
|
|
|
|
|
|
|
</if>
|
|
|
|
<if test="customer_id!=null">
|
|
|
|
<if test="customer_id!=null">
|
|
|
|
and o.customer_id=#{customer_id}
|
|
|
|
and o.customer_id=#{customer_id}
|
|
|
|
</if>
|
|
|
|
</if>
|
|
|
|