From 9bf5189d3ebf9f35984400859c2db86c2837a367 Mon Sep 17 00:00:00 2001 From: zhaoqiaobo Date: Thu, 18 Apr 2024 19:30:50 +0800 Subject: [PATCH] =?UTF-8?q?fix(xml):=20=E4=BF=AE=E6=94=B9=E9=85=8D?= =?UTF-8?q?=E9=80=81=E6=8A=A5=E8=A1=A8=E5=AE=A2=E6=88=B7=E7=AD=BE=E6=94=B6?= =?UTF-8?q?=E6=95=B0=E5=92=8C=E6=96=87=E5=91=98=E7=AD=BE=E6=94=B6=E6=95=B0?= =?UTF-8?q?=E4=B8=8D=E6=AD=A3=E7=A1=AE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../report/mapper/ReportDeliverMapper.xml | 161 +++++++++--------- 1 file changed, 78 insertions(+), 83 deletions(-) diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/ReportDeliverMapper.xml b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/ReportDeliverMapper.xml index 58f8d103e..df9dc5c3b 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/ReportDeliverMapper.xml +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/ReportDeliverMapper.xml @@ -26,93 +26,88 @@ ds_num, ss_num, unloading_team_name - from (SELECT d.train_number train_number, - d.task_time task_time, - d.warehouse_name warehouse_name, - CASE - WHEN d.type = 1 THEN - '商配' - WHEN d.type = 2 THEN - '市配' - ELSE '' - END type, - CASE - WHEN d.kind = 1 THEN - '自主配送' - WHEN d.kind = 2 THEN - '自主配送' - ELSE '' - END kind, - d.vehicle_name vehicle_name, - d.driver_name driver_name, - d.distribution_company distribution_company, - CASE - WHEN d.delivery_status = 1 THEN - '待配送' - WHEN d.delivery_status = 2 THEN - '配送中' - WHEN d.delivery_status = 3 THEN - '已完成' - ELSE '' - END delivery_status, - d.customers_number customers_number, - d.price, - d.order_number order_number, - rn.num reservation_num, - rsln.num reservation_stock_listNum, - IFNULL(loadScan.loadedNum, 0) loaded_num, - IFNULL(loadscaninvn.loadedNum, 0) invn_loaded_num, - IFNULL(loadScan.exLoadedNum, 0) ex_loaded_num, - IFNULL(loadScan.reNum, 0) re_num, - IFNULL(loadscaninvn.reNum, 0) invn_re_num, - IFNULL(loadScan.exReNum, 0) ex_reNum, - ifnull(ds.dsNum, 0) ds_num, - ifnull(ds.ssNum, 0) ss_num, - ifnull(d.unloading_team_name, '') unloading_team_name - FROM logpm_distribution_delivery_list d - LEFT JOIN (SELECT lds.delivery_id, - COALESCE(sum(ldr.reservation_num), 0) num - FROM logpm_distribution_signfor lds - JOIN logpm_distribution_reservation ldr ON lds.reservation_id = ldr.id - WHERE ldr.reservation_status != '40' - GROUP BY lds.delivery_id) rn ON rn.delivery_id = d.id - - LEFT JOIN (SELECT lds.delivery_id, - COALESCE(sum(ldr.reservation_stock_list_num), 0) num - FROM logpm_distribution_signfor lds - JOIN logpm_distribution_reservation ldr ON lds.reservation_id = ldr.id - GROUP BY lds.delivery_id) rsln ON rsln.delivery_id = d.id - - left join (select t.delivery_id, - SUM(t.loaded_nub) loadedNum, - sum(t.received_quantity) reNum, - sum(if(t.is_abnormal_loading = 1, 0, 1)) exLoadedNum, - sum(if(t.is_abnormal_signing = 1, 0, 1)) exReNum - from logpm_distribution_loadscan t - where t.scan_status != 1 - group by t.delivery_id) loadScan on loadScan.delivery_id = d.id - + from (select + d.train_number train_number, + d.task_time task_time, + d.warehouse_name warehouse_name, + CASE + WHEN d.type = 1 THEN + '商配' + WHEN d.type = 2 THEN + '市配' + ELSE '' + END type, + CASE + WHEN d.kind = 1 THEN + '自主配送' + WHEN d.kind = 2 THEN + '自主配送' + ELSE '' + END kind, + d.vehicle_name vehicle_name, + d.driver_name driver_name, + d.distribution_company distribution_company, + CASE + WHEN d.delivery_status = 1 THEN + '待配送' + WHEN d.delivery_status = 2 THEN + '配送中' + WHEN d.delivery_status = 3 THEN + '已完成' + ELSE '' + END delivery_status, + d.customers_number customers_number, + d.price, + d.order_number order_number, + rn.num reservation_num, + rn.stnum reservation_stock_listNum, + IFNULL(loadScan.loadedNum, 0) loaded_num, + IFNULL(loadscaninvn.loadedNum, 0) invn_loaded_num, + IFNULL(loadScan.exLoadedNum, 0) ex_loaded_num, + IFNULL(loadScan.reNum, 0) re_num, + IFNULL(loadscaninvn.reNum, 0) invn_re_num, + IFNULL(loadScan.exReNum, 0) ex_reNum, + ifnull(rn.dsNum, 0) ds_num, + ifnull(rn.ssNum, 0) ss_num, + ifnull(d.unloading_team_name, '') unloading_team_name + from + logpm_distribution_delivery_list d + LEFT JOIN ( + SELECT lds.delivery_id, + COALESCE(sum(ldr1.reservation_num), 0) num, + COALESCE(sum(ldr1.reservation_stock_list_num), 0) stnum, + SUM(CASE + WHEN lds.driver_signing = 2 THEN + 1 + ELSE + 0 + END) dsNum, + SUM(CASE + WHEN lds.signing_status = 2 THEN + 1 + ELSE + 0 + END) ssNum + FROM logpm_distribution_signfor lds + JOIN logpm_distribution_reservation ldr1 ON lds.reservation_id = ldr1.id + WHERE ldr1.reservation_status != '40' + GROUP BY lds.delivery_id order by null + ) rn ON rn.delivery_id = d.id + left join (select t.delivery_id, + SUM(t.loaded_nub) loadedNum, + sum(t.received_quantity) reNum, + sum(if(t.is_abnormal_loading = 1, 0, 1)) exLoadedNum, + sum(if(t.is_abnormal_signing = 1, 0, 1)) exReNum + from logpm_distribution_loadscan t + where t.scan_status != 1 + group by t.delivery_id order by null) loadScan on loadScan.delivery_id = d.id left join (select t.delivery_id, SUM(t.loaded_nub) loadedNum, sum(t.received_quantity) reNum from logpm_distribution_loadscaninvn t - group by t.delivery_id) loadscaninvn on loadscaninvn.delivery_id = d.id - - left join (select t.delivery_id, - SUM(CASE - WHEN t.driver_signing = 2 THEN - 1 - ELSE - 0 - END) dsNum, - SUM(CASE - WHEN t.signing_status = 2 THEN - 1 - ELSE - 0 - END) ssNum - from logpm_distribution_signfor t - group by t.delivery_id) ds on ds.delivery_id = d.id) t + where t.scan_status != 1 + group by t.delivery_id order by null) loadscaninvn on loadscaninvn.delivery_id = d.id + where d.customers_number != 0) t ${ew.customSqlSegment}