From ca9dd81dc1c5992a3ca0a2745156bd2887596aa3 Mon Sep 17 00:00:00 2001 From: "Lim\\jun" Date: Sun, 3 Mar 2024 13:44:08 +0900 Subject: [PATCH] =?UTF-8?q?Dashboard=20count=200=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EB=82=98=EB=88=84=EA=B8=B0=20=EC=98=A4=EB=A5=98=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/cards/AnalyticEcommerce.jsx | 2 +- .../pages/admin/schedule/EgovAdminScheduleList.jsx | 2 +- .../dashboard/repository/DashboardRepository.java | 12 ++++++++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/egovframe-template-simple-react-contribution/src/components/cards/AnalyticEcommerce.jsx b/egovframe-template-simple-react-contribution/src/components/cards/AnalyticEcommerce.jsx index 58be7d2..6435387 100644 --- a/egovframe-template-simple-react-contribution/src/components/cards/AnalyticEcommerce.jsx +++ b/egovframe-template-simple-react-contribution/src/components/cards/AnalyticEcommerce.jsx @@ -23,7 +23,7 @@ const AnalyticEcommerce = ({ color, title, count, percentage, isLoss, extra }) = {count} - {percentage && ( + {percentage !== undefined && ( - 최근 문의사항 + 미답변 문의사항 diff --git a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/dashboard/repository/DashboardRepository.java b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/dashboard/repository/DashboardRepository.java index 0bc1274..afa8cc6 100644 --- a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/dashboard/repository/DashboardRepository.java +++ b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/dashboard/repository/DashboardRepository.java @@ -23,7 +23,11 @@ public interface DashboardRepository extends JpaRepository ") " + "SELECT " + " this_month_cnt, " + - " ROUND(((CAST(this_month_cnt AS NUMERIC) - last_month_cnt) / last_month_cnt * 100), 1) AS ratio, " + + " CASE " + + " WHEN last_month_cnt = 0 AND this_month_cnt = 0 THEN 0" + + " WHEN last_month_cnt = 0 THEN 100" + + " ELSE ROUND(((CAST(this_month_cnt AS NUMERIC) - last_month_cnt) / last_month_cnt * 100), 1)" + + " END AS ratio, " + " last_month_cnt " + "FROM this_month_logs, last_month_logs", nativeQuery = true) List ConnMonthlyCount(); @@ -44,7 +48,11 @@ public interface DashboardRepository extends JpaRepository ") " + "SELECT " + " this_month_cnt, " + - " ROUND(((CAST(this_month_cnt AS NUMERIC) - last_month_cnt) / last_month_cnt * 100), 1) AS ratio, " + + " CASE " + + " WHEN last_month_cnt = 0 AND this_month_cnt = 0 THEN 0" + + " WHEN last_month_cnt = 0 THEN 100" + + " ELSE ROUND(((CAST(this_month_cnt AS NUMERIC) - last_month_cnt) / last_month_cnt * 100), 1) " + + " END AS ratio, " + " last_month_cnt " + "FROM this_month_logs, last_month_logs", nativeQuery = true) List DocuMonthlyCount();