diff --git a/src/main/java/com/rymcu/vertical/dto/admin/Dashboard.java b/src/main/java/com/rymcu/vertical/dto/admin/Dashboard.java index d754087..4a9ba87 100644 --- a/src/main/java/com/rymcu/vertical/dto/admin/Dashboard.java +++ b/src/main/java/com/rymcu/vertical/dto/admin/Dashboard.java @@ -18,5 +18,5 @@ public class Dashboard { private Integer countViewNum; - private Integer toadyViewNum; + private Integer todayViewNum; } diff --git a/src/main/java/com/rymcu/vertical/mapper/DashboardMapper.java b/src/main/java/com/rymcu/vertical/mapper/DashboardMapper.java index 398afe9..c837d3f 100644 --- a/src/main/java/com/rymcu/vertical/mapper/DashboardMapper.java +++ b/src/main/java/com/rymcu/vertical/mapper/DashboardMapper.java @@ -1,5 +1,7 @@ package com.rymcu.vertical.mapper; +import org.apache.ibatis.annotations.Param; + /** * @author ronger */ @@ -16,7 +18,27 @@ public interface DashboardMapper { * */ Integer selectNewUserCount(); + /** + * 获取文章总数 + * @return + */ Integer selectArticleCount(); + /** + * 获取今日发布文章总数 + * @return + */ Integer selectNewArticleCount(); + + /** + * 获取浏览量总数 + * @return + */ + Integer selectCountViewNum(); + + /** + * 获取今日浏览总数 + * @return + */ + Integer selectTodayViewNum(); } diff --git a/src/main/java/com/rymcu/vertical/service/impl/DashboardServiceImpl.java b/src/main/java/com/rymcu/vertical/service/impl/DashboardServiceImpl.java index 985c64a..67921dd 100644 --- a/src/main/java/com/rymcu/vertical/service/impl/DashboardServiceImpl.java +++ b/src/main/java/com/rymcu/vertical/service/impl/DashboardServiceImpl.java @@ -23,9 +23,8 @@ public class DashboardServiceImpl implements DashboardService { dashboard.setNewUserNum(dashboardMapper.selectNewUserCount()); dashboard.setCountArticleNum(dashboardMapper.selectArticleCount()); dashboard.setNewArticleNum(dashboardMapper.selectNewArticleCount()); - // TODO 待完成浏览量统计 - dashboard.setCountViewNum(1000); - dashboard.setToadyViewNum(100); + dashboard.setCountViewNum(dashboardMapper.selectCountViewNum()); + dashboard.setTodayViewNum(dashboardMapper.selectTodayViewNum()); return dashboard; } } diff --git a/src/main/java/mapper/DashboardMapper.xml b/src/main/java/mapper/DashboardMapper.xml index 0802056..dfc50e5 100644 --- a/src/main/java/mapper/DashboardMapper.xml +++ b/src/main/java/mapper/DashboardMapper.xml @@ -15,4 +15,11 @@ select count(*) from vertical_article where created_time between date_sub(sysdate(),interval 1 day) and date_sub(sysdate(),interval - 1 day) + + \ No newline at end of file