From 2c6eded7f5221eb5b5302d8466c657dfaf7775ed Mon Sep 17 00:00:00 2001 From: changpengfei Date: Thu, 16 Sep 2021 10:52:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=93=E5=AE=B6=E7=BB=84=E6=8E=A8=E8=8D=90?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../talkonlineweb/controller/ArticleController.java | 14 ++++++++++++++ .../lyms/talkonlineweb/mapper/LymsArticleMapper.java | 11 +++++++++++ .../talkonlineweb/service/LymsArticleService.java | 2 ++ .../service/impl/LymsArticleServiceImpl.java | 19 +++++++++++++++++++ 4 files changed, 46 insertions(+) diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/ArticleController.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/ArticleController.java index 7386c81..a069373 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/ArticleController.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/ArticleController.java @@ -156,4 +156,18 @@ public class ArticleController { return baseResponse; } + /** + * 专家组推荐统计 + * @return + */ + @GetMapping("getArtPushStat") + public BaseResponse getArtPushStat(){ + BaseResponse baseResponse=new BaseResponse(); + + Map pMap = lymsArticleService.getArtPushStat(); + baseResponse.setObject(pMap); + + return baseResponse; + } + } diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsArticleMapper.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsArticleMapper.java index 682fdbe..653223c 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsArticleMapper.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsArticleMapper.java @@ -2,6 +2,7 @@ package com.lyms.talkonlineweb.mapper; import com.lyms.talkonlineweb.domain.LymsArticle; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.sun.corba.se.impl.ior.OldJIDLObjectKeyTemplate; import org.apache.ibatis.annotations.Select; import java.util.List; @@ -17,6 +18,16 @@ public interface LymsArticleMapper extends BaseMapper { @Select("SELECT COUNT(1) allcnt,SUM(CASE WHEN DATE(a.`createdtime`)=DATE(NOW()) THEN 1 END) ncnt FROM lyms_article a") List> getArtStat(); + +// 今日推荐 + @Select("SELECT COUNT(1) cnt FROM lyms_pushedart WHERE DATE(createdtime)=DATE(NOW())") + Map todayPush(); +// 今日已读 + @Select("SELECT COUNT(1) cnt FROM lyms_pushedart WHERE DATE(createdtime)=DATE(NOW()) AND isread=1") + Map todayRead(); + + @Select("SELECT COUNT(1) cnt FROM lyms_pushedart") + Map sumPush(); } diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsArticleService.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsArticleService.java index a917c48..80714e4 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsArticleService.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsArticleService.java @@ -14,4 +14,6 @@ import java.util.Map; public interface LymsArticleService extends IService { List sltNeedPush(); List> getArtStat(); + + Map getArtPushStat(); } diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsArticleServiceImpl.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsArticleServiceImpl.java index 1a3f78a..577f06e 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsArticleServiceImpl.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsArticleServiceImpl.java @@ -7,6 +7,8 @@ import com.lyms.talkonlineweb.mapper.LymsArticleMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -29,6 +31,23 @@ public class LymsArticleServiceImpl extends ServiceImpl> getArtStat() { return lymsArticleMapper.getArtStat(); } + + @Override + public Map getArtPushStat() { + Map rs=new HashMap<>(); + //今日推荐 + Map todayPush=lymsArticleMapper.todayPush(); + rs.put("todayPush",todayPush.get("cnt")); + + Map todayRead=lymsArticleMapper.todayRead(); + rs.put("todayRead",todayRead.get("cnt")); + + Map sumPush=lymsArticleMapper.sumPush(); + rs.put("sumPush",sumPush.get("cnt")); + + + return rs; + } } -- 1.8.3.1