Dashboard count 0으로 나누기 오류 수정

thkim
Lim\jun 2024-03-03 13:44:08 +09:00
parent d2901908c8
commit ca9dd81dc1
3 changed files with 12 additions and 4 deletions

View File

@ -23,7 +23,7 @@ const AnalyticEcommerce = ({ color, title, count, percentage, isLoss, extra }) =
{count}
</Typography>
</Grid>
{percentage && (
{percentage !== undefined && (
<Grid item>
<Chip
variant="combined"

View File

@ -323,7 +323,7 @@ function EgovAdminDashboard(props) {
<Grid item xs={12} md={7} lg={8}>
<Grid container alignItems="center" justifyContent="space-between">
<Grid item>
<Typography variant="h5">최근 문의사항</Typography>
<Typography variant="h5">미답변 문의사항</Typography>
</Grid>
<Grid item />
</Grid>

View File

@ -23,7 +23,11 @@ public interface DashboardRepository extends JpaRepository<TnDailyMenuLog, Long>
") " +
"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<Object[]> ConnMonthlyCount();
@ -44,7 +48,11 @@ public interface DashboardRepository extends JpaRepository<TnDailyMenuLog, Long>
") " +
"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<Object[]> DocuMonthlyCount();