linwei
2024-02-23 33dc5038638f6b5e9f7f0b9165905e56797ec990
src/main/java/org/springblade/modules/article/controller/ArticleController.java
@@ -18,6 +18,7 @@
import javax.validation.Valid;
import java.util.Date;
import java.util.List;
/**
 * @author zhongrj
@@ -33,8 +34,9 @@
   /**
    * 查询资讯分页信息
    * @param article  资讯对象
    * @param query    查询参数
    *
    * @param article 资讯对象
    * @param query   查询参数
    * @return
    */
   @GetMapping("/pageWeb")
@@ -42,10 +44,16 @@
      return R.data(articleService.selectArticlePage(Condition.getPage(query), article));
   }
   @GetMapping("/getArticleByDistrictId")
   public R<List<ArticleVO>> getArticleByDistrictId(ArticleVO article) {
      return R.data(articleService.getArticleByDistrictId(article));
   }
   /**
    * 查询资讯分页信息-app
    * @param article  资讯对象
    * @param query    查询参数
    *
    * @param article 资讯对象
    * @param query   查询参数
    * @return
    */
   @GetMapping("/page")
@@ -55,8 +63,9 @@
   /**
    * 敏感词预警
    * @param article  资讯对象
    * @param query    查询参数
    *
    * @param article 资讯对象
    * @param query   查询参数
    * @return
    */
   @GetMapping("/pageWords")
@@ -66,8 +75,9 @@
   /**
    * 查询资讯分页信息(角色权限)
    * @param article  资讯对象
    * @param query    查询参数
    *
    * @param article 资讯对象
    * @param query   查询参数
    * @return
    */
   @GetMapping("/pageDate")
@@ -82,8 +92,9 @@
   /**
    * 查询资讯分页信息(角色权限)附带点赞评论数
    * @param article  资讯对象
    * @param query    查询参数
    *
    * @param article 资讯对象
    * @param query   查询参数
    * @return
    */
   @GetMapping("/pageLikes")
@@ -103,17 +114,22 @@
   /**
    * 资讯详情
    *
    * @param article  资讯查询对象
    * @param article 资讯查询对象
    */
   @GetMapping("/detail")
   @ApiOperationSupport(order = 1)
   @ApiOperation(value = "详情", notes = "传入articleoy")
   public R<Article> detail(Article article) {
      Article detail = articleService.getOne(Condition.getQueryWrapper(article));
   public R<Article> detail(ArticleVO article) {
      ArticleVO detail = articleService.getArticleOne(article);
      UpdateWrapper<Article> objectUpdateWrapper = new UpdateWrapper<>();
      objectUpdateWrapper.setSql("view_number = view_number + 1");
      objectUpdateWrapper.eq("id", article.getId());
      articleService.update(null, objectUpdateWrapper);
//      List<List<String>> lists = new ArrayList<>();
//      if (StringUtils.isNotBlank(detail.getArticleRange())) {
//         lists = (List<List<String>>) JSON.parse(detail.getArticleRange());
//      }
//      detail.setArticleList(lists);
      return R.data(detail);
   }
@@ -131,6 +147,7 @@
   /**
    * 修改资讯信息
    *
    * @param article 资讯对象
    */
   @PostMapping("/update")
@@ -159,6 +176,7 @@
   /**
    * 删除资讯信息
    *
    * @param ids 资讯主键id,id集合
    */
   @PostMapping("/remove")
@@ -184,6 +202,7 @@
   /**
    * 查询个人资讯
    *
    * @param article
    * @param query
    * @return
@@ -202,7 +221,7 @@
   public R addNumber(@Valid @RequestBody Article notice) {
      UpdateWrapper<Article> objectUpdateWrapper = new UpdateWrapper<>();
      objectUpdateWrapper.setSql("view_number = view_number + 1");
      objectUpdateWrapper.eq("id",notice.getId());
      return R.status(articleService.update(null ,objectUpdateWrapper));
      objectUpdateWrapper.eq("id", notice.getId());
      return R.status(articleService.update(null, objectUpdateWrapper));
   }
}