From 9fc6541e98c67faa815f2375d110c792f69a9a42 Mon Sep 17 00:00:00 2001 From: aoshiguchen <1052045476@qq.com> Date: Sat, 25 Mar 2023 23:52:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B5=81=E9=87=8F=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E6=95=B0=E6=8D=AE=E4=B8=BA=E6=9F=A5=E8=AF=A2=E5=88=B0?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/mapper/ReportMapper.xml | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/neutrino-proxy-server/src/main/resources/mapper/ReportMapper.xml b/neutrino-proxy-server/src/main/resources/mapper/ReportMapper.xml index b325e230..9cc807fc 100644 --- a/neutrino-proxy-server/src/main/resources/mapper/ReportMapper.xml +++ b/neutrino-proxy-server/src/main/resources/mapper/ReportMapper.xml @@ -6,14 +6,14 @@ SELECT u.id AS 'userId', u.name AS 'userName', - SUM(frm.write_bytes + frd.write_bytes + frm2.write_bytes) AS 'upFlowBytes', - SUM(frm.read_bytes + frd.read_bytes + frm2.read_bytes) AS 'downFlowBytes', - SUM(frm.write_bytes) monthWriteBytes, - SUM(frm.read_bytes) monthReadBytes, - SUM(frd.write_bytes) dayWriteBytes, - SUM(frd.read_bytes) dayReadBytes, - SUM(frm2.write_bytes) minuteWriteBytes, - SUM(frm2.read_bytes) minuteReadBytes + SUM(IFNULL(frm.write_bytes,0) + IFNULL(frd.write_bytes,0) + IFNULL(frm2.write_bytes,0)) AS 'upFlowBytes', + SUM(IFNULL(frm.read_bytes,0) + IFNULL(frd.read_bytes,0) + IFNULL(frm2.read_bytes,0)) AS 'downFlowBytes', + IFNULL(SUM(frm.write_bytes),0) monthWriteBytes, + IFNULL(SUM(frm.read_bytes),0) monthReadBytes, + IFNULL(SUM(frd.write_bytes),0) dayWriteBytes, + IFNULL(SUM(frd.read_bytes),0) dayReadBytes, + IFNULL(SUM(frm2.write_bytes),0) minuteWriteBytes, + IFNULL(SUM(frm2.read_bytes),0) minuteReadBytes FROM `user` u LEFT JOIN (SELECT user_id,sum(write_bytes) write_bytes,sum(read_bytes) read_bytes from flow_report_month GROUP BY user_id) frm ON u.id = frm.user_id LEFT JOIN (SELECT user_id,sum(write_bytes) write_bytes,sum(read_bytes) read_bytes from flow_report_day @@ -36,14 +36,14 @@ l.name AS 'licenseName', u.id AS 'userId', u.name AS 'userName', - SUM(frm.write_bytes + frd.write_bytes + frm2.write_bytes) AS 'upFlowBytes', - SUM(frm.read_bytes + frd.read_bytes + frm2.read_bytes) AS 'downFlowBytes', - SUM(frm.write_bytes) monthWriteBytes, - SUM(frm.read_bytes) monthReadBytes, - SUM(frd.write_bytes) dayWriteBytes, - SUM(frd.read_bytes) dayReadBytes, - SUM(frm2.write_bytes) minuteWriteBytes, - SUM(frm2.read_bytes) minuteReadBytes + SUM(IFNULL(frm.write_bytes,0) + IFNULL(frd.write_bytes,0) + IFNULL(frm2.write_bytes,0)) AS 'upFlowBytes', + SUM(IFNULL(frm.read_bytes,0) + IFNULL(frd.read_bytes,0) + IFNULL(frm2.read_bytes,0)) AS 'downFlowBytes', + IFNULL(SUM(frm.write_bytes),0) monthWriteBytes, + IFNULL(SUM(frm.read_bytes),0) monthReadBytes, + IFNULL(SUM(frd.write_bytes),0) dayWriteBytes, + IFNULL(SUM(frd.read_bytes),0) dayReadBytes, + IFNULL(SUM(frm2.write_bytes),0) minuteWriteBytes, + IFNULL(SUM(frm2.read_bytes),0) minuteReadBytes FROM `license` l LEFT JOIN `user` u ON l.user_id = u.id LEFT JOIN (SELECT license_id,sum(write_bytes) write_bytes,sum(read_bytes) read_bytes from flow_report_month GROUP BY license_id) frm ON l.id = frm.license_id