This commit is contained in:
parent
1d3f97815a
commit
2f40292c00
|
|
@ -519,14 +519,13 @@
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
<select id="getlistByOtherlist" resultType="com.bonus.canteen.core.reportforms.beans.OrgConsume">
|
<select id="getlistByOtherlist" resultType="com.bonus.canteen.core.reportforms.beans.OrgConsume">
|
||||||
|
SELECT
|
||||||
SELECT
|
|
||||||
co.org_full_name AS orgFullName,
|
co.org_full_name AS orgFullName,
|
||||||
u.cust_name,
|
u.cust_name,
|
||||||
u.cust_name_like,
|
u.cust_name_like,
|
||||||
t.canteen_name,
|
t.canteen_name,
|
||||||
t.area_name,
|
t.area_name,
|
||||||
t.consume_source,
|
'station' AS consume_source,
|
||||||
t.flow_id,
|
t.flow_id,
|
||||||
t.flow_type,
|
t.flow_type,
|
||||||
CASE
|
CASE
|
||||||
|
|
@ -534,7 +533,7 @@
|
||||||
WHEN t.flow_type = 130 THEN '退款'
|
WHEN t.flow_type = 130 THEN '退款'
|
||||||
ELSE '其他'
|
ELSE '其他'
|
||||||
END AS flow_type_name,
|
END AS flow_type_name,
|
||||||
t.flow_real_amount / 100 AS amount,
|
ROUND(t.amount / 100, 2) AS amount,
|
||||||
t.ord_time,
|
t.ord_time,
|
||||||
t.pay_time,
|
t.pay_time,
|
||||||
t.walletId,
|
t.walletId,
|
||||||
|
|
@ -543,61 +542,67 @@
|
||||||
SELECT
|
SELECT
|
||||||
aa.canteen_name,
|
aa.canteen_name,
|
||||||
aac.area_name,
|
aac.area_name,
|
||||||
'station' AS consume_source,
|
|
||||||
f.flow_id,
|
f.flow_id,
|
||||||
d.flow_type,
|
f.flow_type,
|
||||||
f.flow_real_amount,
|
f.flow_real_amount AS amount,
|
||||||
f.ord_time,
|
f.ord_time,
|
||||||
d.pay_time,
|
f.pay_time,
|
||||||
f.cust_id,
|
f.cust_id,
|
||||||
atwd.wallet_id AS walletId,
|
atwd.wallet_id AS walletId, -- 加上别名
|
||||||
f.remark
|
f.remark
|
||||||
FROM report_account_flow f
|
FROM report_account_flow f
|
||||||
LEFT JOIN acc_trade_wallet_detail atwd ON atwd.trade_id = f.flow_id
|
LEFT JOIN acc_trade_wallet_detail atwd ON atwd.trade_id = f.flow_id
|
||||||
INNER JOIN report_account_flow_detail d ON f.flow_id = d.flow_id
|
|
||||||
LEFT JOIN device_info di ON f.mch_sn = di.device_sn
|
|
||||||
LEFT JOIN device_bind bd ON di.device_id = bd.device_id
|
|
||||||
LEFT JOIN alloc_canteen aa ON aa.canteen_id = bd.canteen_id
|
|
||||||
LEFT JOIN alloc_area aac ON aac.area_id = aa.area_id
|
|
||||||
WHERE d.pay_time >= #{startPayTime}
|
|
||||||
AND d.pay_time < #{endPayTime}
|
|
||||||
AND d.flow_type = 110
|
|
||||||
AND f.source_type IS NULL
|
|
||||||
AND f.remark LIKE '%支付%'
|
|
||||||
|
|
||||||
UNION ALL
|
|
||||||
SELECT
|
|
||||||
aa.canteen_name,
|
|
||||||
aac.area_name,
|
|
||||||
'station' AS consume_source,
|
|
||||||
at.origin_trade_id AS flow_id,
|
|
||||||
130 AS flow_type,
|
|
||||||
at.actual_amount AS flow_real_amount,
|
|
||||||
f.ord_time,
|
|
||||||
at.trade_time AS pay_time,
|
|
||||||
at.cust_id,
|
|
||||||
atwd_refund.wallet_id AS walletId,
|
|
||||||
CONCAT('退款-', f.remark) AS remark
|
|
||||||
FROM acc_trade at
|
|
||||||
INNER JOIN report_account_flow f ON at.origin_trade_id = f.flow_id AND f.flow_type = 110
|
|
||||||
LEFT JOIN acc_trade_wallet_detail atwd_refund ON atwd_refund.trade_id = at.id -- 假设acc_trade的主键是id
|
|
||||||
LEFT JOIN device_info di ON f.mch_sn = di.device_sn
|
LEFT JOIN device_info di ON f.mch_sn = di.device_sn
|
||||||
LEFT JOIN device_bind bd ON di.device_id = bd.device_id
|
LEFT JOIN device_bind bd ON di.device_id = bd.device_id
|
||||||
LEFT JOIN alloc_canteen aa ON aa.canteen_id = bd.canteen_id
|
LEFT JOIN alloc_canteen aa ON aa.canteen_id = bd.canteen_id
|
||||||
LEFT JOIN alloc_area aac ON aac.area_id = aa.area_id
|
LEFT JOIN alloc_area aac ON aac.area_id = aa.area_id
|
||||||
WHERE
|
WHERE
|
||||||
at.trade_time >= #{startPayTime}
|
f.pay_time >= #{startPayTime}
|
||||||
AND at.trade_time < #{endPayTime}
|
AND f.pay_time < #{endPayTime}
|
||||||
|
AND f.flow_type = 110
|
||||||
|
AND f.status = 1
|
||||||
|
AND (f.source_type IS NULL OR f.source_type = 0 OR f.source_type = '')
|
||||||
|
AND f.remark LIKE '%支付%'
|
||||||
|
|
||||||
|
UNION ALL
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
aa.canteen_name,
|
||||||
|
aac.area_name,
|
||||||
|
f.flow_id AS flow_id,
|
||||||
|
130 AS flow_type,
|
||||||
|
at.actual_amount AS amount,
|
||||||
|
f.ord_time,
|
||||||
|
at.trade_time AS pay_time,
|
||||||
|
at.cust_id,
|
||||||
|
atwd_refund.wallet_id AS walletId, -- 加上别名
|
||||||
|
CONCAT('退款-', f.remark) AS remark
|
||||||
|
FROM acc_trade at
|
||||||
|
INNER JOIN report_account_flow f
|
||||||
|
ON at.origin_trade_id = f.flow_id
|
||||||
|
AND f.flow_type = 110
|
||||||
|
LEFT JOIN acc_trade_wallet_detail atwd_refund
|
||||||
|
ON atwd_refund.trade_id = at.id
|
||||||
|
LEFT JOIN device_info di ON f.mch_sn = di.device_sn
|
||||||
|
LEFT JOIN device_bind bd ON di.device_id = bd.device_id
|
||||||
|
LEFT JOIN alloc_canteen aa ON aa.canteen_id = bd.canteen_id
|
||||||
|
LEFT JOIN alloc_area aac ON aac.area_id = aa.area_id
|
||||||
|
WHERE
|
||||||
|
at.trade_time >= #{startPayTime}
|
||||||
|
AND at.trade_time < #{endPayTime}
|
||||||
AND at.trade_type = 130
|
AND at.trade_type = 130
|
||||||
AND at.trade_state = 2
|
AND at.trade_state = 2
|
||||||
AND (at.machine_sn IS NULL OR at.machine_sn = '')
|
AND (at.machine_sn IS NULL OR at.machine_sn = '')
|
||||||
AND f.source_type IS NULL
|
AND f.status = 1
|
||||||
|
AND (f.source_type IS NULL OR f.source_type = 0 OR f.source_type = '')
|
||||||
AND f.remark LIKE '%支付%'
|
AND f.remark LIKE '%支付%'
|
||||||
|
|
||||||
) t
|
) t
|
||||||
LEFT JOIN cust_info u ON t.cust_id = u.cust_id
|
LEFT JOIN cust_info u ON t.cust_id = u.cust_id
|
||||||
LEFT JOIN cust_org co ON u.org_id = co.org_id
|
LEFT JOIN cust_org co ON u.org_id = co.org_id
|
||||||
WHERE t.area_name LIKE CONCAT('%', #{orgName}, '%')
|
WHERE t.area_name LIKE CONCAT('%', #{orgName}, '%')
|
||||||
ORDER BY t.pay_time DESC
|
ORDER BY t.pay_time DESC;
|
||||||
|
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
<select id="getlistConsmerlist" resultType="com.bonus.canteen.core.reportforms.beans.OrgConsume">
|
<select id="getlistConsmerlist" resultType="com.bonus.canteen.core.reportforms.beans.OrgConsume">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue