jsk 重修修改数据表 将report_order_info 改为 report_account_flow
This commit is contained in:
parent
0d5111fd5a
commit
6d9b376040
|
|
@ -860,27 +860,28 @@
|
|||
ap.area_name AS work_area_name,
|
||||
a.mch_sn
|
||||
FROM (
|
||||
SELECT
|
||||
a.order_id, a.cust_id, a.payable_amount, a.real_amount, a.pay_time, a.canteen_id, NULL AS mch_sn
|
||||
FROM report_order_info a
|
||||
WHERE a.order_refund_state='1' and a.pay_time >= #{vo.startTime} AND a.pay_time <= #{vo.endTime}
|
||||
select a.flow_id as order_id, a.cust_id,a.flow_amount as payable_amount,a.flow_real_amount as real_amount,a.pay_time,
|
||||
case when bd.canteen_id is not null then bd.canteen_id when roi.canteen_id is not null then roi.canteen_id
|
||||
else a.canteen_id end as canteen_id,CONCAT(a.cust_id,a.ord_time) as id
|
||||
,a.mch_sn as mch_sn
|
||||
from report_account_flow a
|
||||
LEFT JOIN device_info di ON a.mch_sn = di.device_sn
|
||||
LEFT JOIN device_bind bd ON di.device_id = bd.device_id
|
||||
LEFT JOIN report_order_info roi on CONCAT(a.cust_id,a.ord_time)=CONCAT(roi.cust_id,roi.order_time)
|
||||
where a.pay_time >= #{vo.startTime} AND a.flow_type IN ( 110, 120,130 )
|
||||
AND a.pay_time <= #{vo.endTime} and (a.remark not like '%支付' or a.remark is null)
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
a.flow_id AS order_id,
|
||||
a.cust_id,
|
||||
a.flow_amount AS payable_amount,
|
||||
replace(a.flow_real_amount,'-','') AS real_amount,
|
||||
a.pay_time,
|
||||
bd.canteen_id,
|
||||
a.mch_sn
|
||||
FROM report_account_flow a
|
||||
select a.flow_id as order_id, a.cust_id,a.flow_amount as payable_amount,a.flow_real_amount as real_amount,a.pay_time,bd.canteen_id
|
||||
,CONCAT(a.cust_id,a.ord_time) as id
|
||||
,a.mch_sn as mch_sn
|
||||
from report_account_flow a
|
||||
LEFT JOIN device_info di ON a.mch_sn = di.device_sn
|
||||
LEFT JOIN device_bind bd ON di.device_id = bd.device_id
|
||||
WHERE a.pay_time >= #{vo.startTime} AND a.pay_time <= #{vo.endTime} AND a.remark LIKE '%支付'
|
||||
where a.pay_time >= #{vo.startTime} AND a.flow_type IN ( 110, 120,130 )
|
||||
AND a.pay_time <= #{vo.endTime} and a.remark like '%支付'
|
||||
) a
|
||||
LEFT JOIN report_order_info_snapshot ros ON ros.order_id = a.order_id
|
||||
LEFT JOIN alloc_canteen ac ON ac.canteen_id = a.canteen_id
|
||||
LEFT JOIN cust_info ci ON ci.cust_id = a.cust_id
|
||||
LEFT JOIN cust_org co ON co.org_id = ci.org_id
|
||||
|
|
@ -917,25 +918,27 @@
|
|||
ac.canteen_type,
|
||||
p.dining_place_id
|
||||
FROM (
|
||||
SELECT
|
||||
a.order_id, a.cust_id, a.payable_amount, a.real_amount, a.pay_time, a.canteen_id, NULL AS mch_sn
|
||||
FROM report_order_info a
|
||||
WHERE a.order_refund_state='1' and a.pay_time >= #{startTime} AND a.pay_time <= #{endTime}
|
||||
select a.flow_id as order_id, a.cust_id,a.flow_amount as payable_amount,a.flow_real_amount as real_amount,a.pay_time,
|
||||
case when bd.canteen_id is not null then bd.canteen_id when roi.canteen_id is not null then roi.canteen_id
|
||||
else a.canteen_id end as canteen_id,CONCAT(a.cust_id,a.ord_time) as id
|
||||
,a.mch_sn as mch_sn
|
||||
from report_account_flow a
|
||||
LEFT JOIN device_info di ON a.mch_sn = di.device_sn
|
||||
LEFT JOIN device_bind bd ON di.device_id = bd.device_id
|
||||
LEFT JOIN report_order_info roi on CONCAT(a.cust_id,a.ord_time)=CONCAT(roi.cust_id,roi.order_time)
|
||||
where a.pay_time >= #{startTime} AND a.flow_type IN ( 110, 120,130 )
|
||||
AND a.pay_time <= #{endTime} and (a.remark not like '%支付' or a.remark is null)
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
a.flow_id AS order_id,
|
||||
a.cust_id,
|
||||
a.flow_amount AS payable_amount,
|
||||
a.flow_real_amount AS real_amount,
|
||||
a.pay_time,
|
||||
bd.canteen_id,
|
||||
a.mch_sn
|
||||
FROM report_account_flow a
|
||||
select a.flow_id as order_id, a.cust_id,a.flow_amount as payable_amount,a.flow_real_amount as real_amount,a.pay_time,bd.canteen_id
|
||||
,CONCAT(a.cust_id,a.ord_time) as id
|
||||
,a.mch_sn as mch_sn
|
||||
from report_account_flow a
|
||||
LEFT JOIN device_info di ON a.mch_sn = di.device_sn
|
||||
LEFT JOIN device_bind bd ON di.device_id = bd.device_id
|
||||
WHERE a.pay_time >= #{startTime} AND a.pay_time <= #{endTime} AND a.remark LIKE '%支付'
|
||||
where a.pay_time >= #{startTime} AND a.flow_type IN ( 110, 120,130 )
|
||||
AND a.pay_time <= #{endTime} and a.remark like '%支付'
|
||||
) a
|
||||
LEFT JOIN alloc_canteen ac ON ac.canteen_id = a.canteen_id
|
||||
JOIN cust_info ci ON ci.cust_id = a.cust_id
|
||||
|
|
@ -980,23 +983,27 @@
|
|||
a.canteen_id,
|
||||
a.mch_sn
|
||||
FROM (
|
||||
SELECT
|
||||
order_id, cust_id, payable_amount, real_amount, pay_time, canteen_id, NULL AS mch_sn
|
||||
FROM report_order_info
|
||||
WHERE order_refund_state='1' and pay_time >= #{startTime} AND pay_time <= #{endTime}
|
||||
UNION ALL
|
||||
SELECT
|
||||
flow_id AS order_id,
|
||||
cust_id,
|
||||
flow_amount AS payable_amount,
|
||||
replace(flow_real_amount,'-','') AS real_amount,
|
||||
pay_time,
|
||||
bd.canteen_id,
|
||||
mch_sn
|
||||
FROM report_account_flow a
|
||||
select a.flow_id as order_id, a.cust_id,a.flow_amount as payable_amount,a.flow_real_amount as real_amount,a.pay_time,
|
||||
case when bd.canteen_id is not null then bd.canteen_id when roi.canteen_id is not null then roi.canteen_id
|
||||
else a.canteen_id end as canteen_id,CONCAT(a.cust_id,a.ord_time) as id
|
||||
,a.mch_sn as mch_sn
|
||||
from report_account_flow a
|
||||
LEFT JOIN device_info di ON a.mch_sn = di.device_sn
|
||||
LEFT JOIN device_bind bd ON di.device_id = bd.device_id
|
||||
WHERE pay_time >= #{startTime} AND pay_time <= #{endTime} AND remark LIKE '%支付'
|
||||
LEFT JOIN report_order_info roi on CONCAT(a.cust_id,a.ord_time)=CONCAT(roi.cust_id,roi.order_time)
|
||||
where a.pay_time >= #{startTime} AND a.flow_type IN ( 110, 120,130 )
|
||||
AND a.pay_time <= #{endTime} and (a.remark not like '%支付' or a.remark is null)
|
||||
|
||||
UNION ALL
|
||||
|
||||
select a.flow_id as order_id, a.cust_id,a.flow_amount as payable_amount,a.flow_real_amount as real_amount,a.pay_time,bd.canteen_id
|
||||
,CONCAT(a.cust_id,a.ord_time) as id
|
||||
,a.mch_sn as mch_sn
|
||||
from report_account_flow a
|
||||
LEFT JOIN device_info di ON a.mch_sn = di.device_sn
|
||||
LEFT JOIN device_bind bd ON di.device_id = bd.device_id
|
||||
where a.pay_time >= #{startTime} AND a.flow_type IN ( 110, 120,130 )
|
||||
AND a.pay_time <= #{endTime} and a.remark like '%支付'
|
||||
) a
|
||||
LEFT JOIN alloc_canteen ac ON ac.canteen_id = a.canteen_id
|
||||
LEFT JOIN cust_info ci ON ci.cust_id = a.cust_id
|
||||
|
|
|
|||
|
|
@ -34,27 +34,28 @@
|
|||
ap.area_name AS work_area_name,
|
||||
a.mch_sn
|
||||
FROM (
|
||||
SELECT
|
||||
a.order_id, a.cust_id, a.payable_amount, a.real_amount, a.pay_time, a.canteen_id, NULL AS mch_sn
|
||||
FROM report_order_info a
|
||||
WHERE a.order_refund_state='1' and a.pay_time >= #{startTime} AND a.pay_time <= #{endTime}
|
||||
select a.flow_id as order_id, a.cust_id,a.flow_amount as payable_amount,a.flow_real_amount as real_amount,a.pay_time,
|
||||
case when bd.canteen_id is not null then bd.canteen_id when roi.canteen_id is not null then roi.canteen_id
|
||||
else a.canteen_id end as canteen_id,CONCAT(a.cust_id,a.ord_time) as id
|
||||
,a.mch_sn as mch_sn
|
||||
from report_account_flow a
|
||||
LEFT JOIN device_info di ON a.mch_sn = di.device_sn
|
||||
LEFT JOIN device_bind bd ON di.device_id = bd.device_id
|
||||
LEFT JOIN report_order_info roi on CONCAT(a.cust_id,a.ord_time)=CONCAT(roi.cust_id,roi.order_time)
|
||||
where a.pay_time >= #{startTime} AND a.flow_type IN ( 110, 120,130 )
|
||||
AND a.pay_time <= #{endTime} and (a.remark not like '%支付' or a.remark is null)
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
a.flow_id AS order_id,
|
||||
a.cust_id,
|
||||
a.flow_amount AS payable_amount,
|
||||
replace(a.flow_real_amount,'-','') AS real_amount,
|
||||
a.pay_time,
|
||||
bd.canteen_id,
|
||||
a.mch_sn
|
||||
FROM report_account_flow a
|
||||
select a.flow_id as order_id, a.cust_id,a.flow_amount as payable_amount,a.flow_real_amount as real_amount,a.pay_time,bd.canteen_id
|
||||
,CONCAT(a.cust_id,a.ord_time) as id
|
||||
,a.mch_sn as mch_sn
|
||||
from report_account_flow a
|
||||
LEFT JOIN device_info di ON a.mch_sn = di.device_sn
|
||||
LEFT JOIN device_bind bd ON di.device_id = bd.device_id
|
||||
WHERE a.pay_time >= #{startTime} AND a.pay_time <= #{endTime} AND a.remark LIKE '%支付'
|
||||
where a.pay_time >= #{startTime} AND a.flow_type IN ( 110, 120,130 )
|
||||
AND a.pay_time <= #{endTime} and a.remark like '%支付'
|
||||
) a
|
||||
LEFT JOIN report_order_info_snapshot ros ON ros.order_id = a.order_id
|
||||
LEFT JOIN alloc_canteen ac ON ac.canteen_id = a.canteen_id
|
||||
LEFT JOIN cust_info ci ON ci.cust_id = a.cust_id
|
||||
LEFT JOIN cust_org co ON co.org_id = ci.org_id
|
||||
|
|
|
|||
Loading…
Reference in New Issue