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();