From 0e77e7d716d3df19f11ee9f8e5ada24bcffed0e2 Mon Sep 17 00:00:00 2001 From: changpengfei Date: Thu, 9 Sep 2021 10:20:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E7=AB=A0=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 | 18 +++++++++++++----- .../lyms/talkonlineweb/mapper/LymsArticleMapper.java | 4 ++++ .../lyms/talkonlineweb/service/LymsArticleService.java | 2 ++ .../service/impl/LymsArticleServiceImpl.java | 6 ++++++ 4 files changed, 25 insertions(+), 5 deletions(-) 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 2756ce0..bed4ec8 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/ArticleController.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/ArticleController.java @@ -21,10 +21,7 @@ import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; import java.io.File; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Objects; +import java.util.*; @RestController @RequestMapping("art") @@ -119,7 +116,6 @@ public class ArticleController { /** * 根据患者获取推送的文章 */ - @GetMapping("getPushArt") public BaseResponse getPushArt(LymsPushedart pushedart){ BaseResponse baseResponse=new BaseResponse(); @@ -136,4 +132,16 @@ public class ArticleController { return baseResponse; } + /** + * 统计文章 + * @return + */ + @GetMapping("getArtStat") + public BaseResponse getArtStat(){ + BaseResponse baseResponse=new BaseResponse(); + List> aLst=lymsArticleService.getArtStat(); + baseResponse.setObject(aLst); + 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 656d9e0..682fdbe 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsArticleMapper.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsArticleMapper.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Select; import java.util.List; +import java.util.Map; /** * @Entity com.lyms.talkonlineweb.domain.LymsArticle @@ -13,6 +14,9 @@ public interface LymsArticleMapper extends BaseMapper { @Select("SELECT * FROM lyms_article a WHERE a.`stat`=1 AND a.`aid` NOT IN (SELECT aid FROM lyms_pushedart)") List sltNeedPush(); + + @Select("SELECT COUNT(1) allcnt,SUM(CASE WHEN DATE(a.`createdtime`)=DATE(NOW()) THEN 1 END) ncnt FROM lyms_article a") + List> getArtStat(); } 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 0196053..a917c48 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsArticleService.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsArticleService.java @@ -6,10 +6,12 @@ import com.lyms.talkonlineweb.mapper.LymsArticleMapper; import org.springframework.beans.factory.annotation.Autowired; import java.util.List; +import java.util.Map; /** * */ public interface LymsArticleService extends IService { List sltNeedPush(); + List> getArtStat(); } 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 03ba24d..1a3f78a 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 @@ -8,6 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; +import java.util.Map; /** * @@ -23,6 +24,11 @@ public class LymsArticleServiceImpl extends ServiceImpl sltNeedPush() { return lymsArticleMapper.sltNeedPush(); } + + @Override + public List> getArtStat() { + return lymsArticleMapper.getArtStat(); + } } -- 1.8.3.1