Commit 0e77e7d716d3df19f11ee9f8e5ada24bcffed0e2

Authored by changpengfei
1 parent d694d9eef3
Exists in master and in 1 other branch dev

文章统计

Showing 4 changed files with 25 additions and 5 deletions

talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/ArticleController.java View file @ 0e77e7d
... ... @@ -21,10 +21,7 @@
21 21 import org.springframework.web.multipart.MultipartFile;
22 22  
23 23 import java.io.File;
24   -import java.util.ArrayList;
25   -import java.util.Date;
26   -import java.util.List;
27   -import java.util.Objects;
  24 +import java.util.*;
28 25  
29 26 @RestController
30 27 @RequestMapping("art")
... ... @@ -119,7 +116,6 @@
119 116 /**
120 117 * 根据患者获取推送的文章
121 118 */
122   -
123 119 @GetMapping("getPushArt")
124 120 public BaseResponse getPushArt(LymsPushedart pushedart){
125 121 BaseResponse baseResponse=new BaseResponse();
... ... @@ -133,6 +129,18 @@
133 129 baseResponse.setObject(aLst);
134 130  
135 131 }
  132 + return baseResponse;
  133 + }
  134 +
  135 + /**
  136 + * 统计文章
  137 + * @return
  138 + */
  139 + @GetMapping("getArtStat")
  140 + public BaseResponse getArtStat(){
  141 + BaseResponse baseResponse=new BaseResponse();
  142 + List<Map<String,Object>> aLst=lymsArticleService.getArtStat();
  143 + baseResponse.setObject(aLst);
136 144 return baseResponse;
137 145 }
138 146  
talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsArticleMapper.java View file @ 0e77e7d
... ... @@ -5,6 +5,7 @@
5 5 import org.apache.ibatis.annotations.Select;
6 6  
7 7 import java.util.List;
  8 +import java.util.Map;
8 9  
9 10 /**
10 11 * @Entity com.lyms.talkonlineweb.domain.LymsArticle
... ... @@ -13,5 +14,8 @@
13 14  
14 15 @Select("SELECT * FROM lyms_article a WHERE a.`stat`=1 AND a.`aid` NOT IN (SELECT aid FROM lyms_pushedart)")
15 16 List<LymsArticle> sltNeedPush();
  17 +
  18 + @Select("SELECT COUNT(1) allcnt,SUM(CASE WHEN DATE(a.`createdtime`)=DATE(NOW()) THEN 1 END) ncnt FROM lyms_article a")
  19 + List<Map<String, Object>> getArtStat();
16 20 }
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsArticleService.java View file @ 0e77e7d
... ... @@ -6,11 +6,13 @@
6 6 import org.springframework.beans.factory.annotation.Autowired;
7 7  
8 8 import java.util.List;
  9 +import java.util.Map;
9 10  
10 11 /**
11 12 *
12 13 */
13 14 public interface LymsArticleService extends IService<LymsArticle> {
14 15 List<LymsArticle> sltNeedPush();
  16 + List<Map<String, Object>> getArtStat();
15 17 }
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsArticleServiceImpl.java View file @ 0e77e7d
... ... @@ -8,6 +8,7 @@
8 8 import org.springframework.stereotype.Service;
9 9  
10 10 import java.util.List;
  11 +import java.util.Map;
11 12  
12 13 /**
13 14 *
... ... @@ -22,6 +23,11 @@
22 23 @Override
23 24 public List<LymsArticle> sltNeedPush() {
24 25 return lymsArticleMapper.sltNeedPush();
  26 + }
  27 +
  28 + @Override
  29 + public List<Map<String, Object>> getArtStat() {
  30 + return lymsArticleMapper.getArtStat();
25 31 }
26 32 }