Merge remote-tracking branch 'origin/develop' into develop

master
yixian 6 years ago
commit 2a6cbe1b69

@ -52,12 +52,18 @@
</select>
<select id="analysisLuckyMoney" resultType="com.alibaba.fastjson.JSONObject">
SELECT COUNT(red_packet_order_id) total_counts,sum(red_packet_amount) total_amount,
ifnull(SUM(if(status=0 AND lock_key is null,1,0)),0) unsend_counts,SUM(if(status=0 AND lock_key is null,red_packet_amount,0)) unsend_amount,
sum(if(status!=0,1,0)) send_counts,SUM(if(status !=0 ,red_packet_amount,0)) send_amount,
sum(if(status=2,1,0)) fail_counts,SUM(if(status=2,red_packet_amount,0)) fail_amount,
sum(if(status=1 or status=3,1,0)) receive_counts,SUM(if(status=1 or status=3,red_packet_amount,0)) receive_amount,
sum(if(status=4,1,0)) return_counts,SUM(if(status=4,red_packet_amount,0)) return_amount
SELECT COUNT(red_packet_order_id) total_counts,
sum(red_packet_amount) total_amount,
ifnull(SUM(if(status=0 AND lock_key is null,1,0)),0) unsend_counts,
SUM(if(status=0 AND lock_key is null,red_packet_amount,0)) unsend_amount,
sum(if(status!=0,1,0)) send_counts,
SUM(if(status !=0 ,red_packet_amount,0)) send_amount,
sum(if(status=2,1,0)) fail_counts,
SUM(if(status=2,red_packet_amount,0)) fail_amount,
sum(if(status=1 or status=3,1,0)) receive_counts,
SUM(if(status=1 or status=3,red_packet_amount,0)) receive_amount,
sum(if(status=4,1,0)) return_counts,
SUM(if(status=4,red_packet_amount,0)) return_amount
FROM act_red_packets_orders
<where>
act_id = #{act_id}
@ -164,7 +170,11 @@
<select id="getRedPacketsByOpenid" resultType="int">
SELECT count(1) FROM act_red_packets_orders WHERE open_id=#{open_id} and date(event_time) = date(#{event_date}) and status !=0 and act_id = '2'
SELECT count(1)
FROM act_red_packets_orders
WHERE open_id=#{open_id}
and date(event_time) = date(#{event_date})
and status !=0 and act_id = '2'
</select>

@ -24,15 +24,19 @@
AND status != 0 AND act_id = #{act_id}
</select>
<!-- 由于在sys_customer_relation中新增了关联字段globalpay_openid
所以重新关联此字段再次left join, 选取其中不为null的
-->
<select id="listOrders" resultType="com.alibaba.fastjson.JSONObject">
SELECT
a.*,
b.client_moniker,
c.headimg,
c.nickname
ifnull(c.headimg, c2.headimg) headimg,
ifnull(c.nickname, c2.nickname) nickname
FROM act_red_packets_customer_orders a
INNER JOIN sys_clients b ON a.client_id = b.client_id
LEFT JOIN sys_customer_relation c ON c.wechat_openid = a.open_id
LEFT JOIN sys_customer_relation c2 ON c2.globalpay_openid = a.open_id
WHERE act_id = #{actId}
<if test="client_moniker != null">
AND b.client_moniker = #{client_moniker}

Loading…
Cancel
Save