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(); + } }