From b39cc2beacc1ec2e37cff349cae42e420105c8a6 Mon Sep 17 00:00:00 2001
From: zengh <123456>
Date: Fri, 05 Nov 2021 14:29:47 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
src/main/java/org/springblade/modules/article/controller/ArticleController.java | 63 ++++++++++++++++++++++++++++++-
1 files changed, 60 insertions(+), 3 deletions(-)
diff --git a/src/main/java/org/springblade/modules/article/controller/ArticleController.java b/src/main/java/org/springblade/modules/article/controller/ArticleController.java
index bd73a6a..b0b1d7d 100644
--- a/src/main/java/org/springblade/modules/article/controller/ArticleController.java
+++ b/src/main/java/org/springblade/modules/article/controller/ArticleController.java
@@ -12,12 +12,11 @@
import org.springblade.modules.article.entity.Article;
import org.springblade.modules.article.service.ArticleService;
import org.springblade.modules.article.vo.ArticleVo;
+import org.springblade.modules.words.DemoApplication;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
-import java.text.SimpleDateFormat;
-import java.time.LocalDateTime;
import java.util.Date;
/**
@@ -63,6 +62,42 @@
response.setHeader("Access-Control-Allow-Credentials","true");
return R.data(articleService.pageDate(Condition.getPage(query),article));
}
+
+ @GetMapping("/pageCollectList")
+ public R<IPage<Article>> pageCollectList(HttpServletResponse response, ArticleVo article, Query query){
+ response.setHeader("Access-Control-Allow-Origin", "*");
+ response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
+ response.setHeader("Access-Control-Allow-Credentials","true");
+ return R.data(articleService.pageCollectList(Condition.getPage(query),article));
+ }
+
+ /**
+ *
+ * 查询资讯分页信息(角色权限)附带点赞评论数
+ * @param response
+ * @param article 资讯对象
+ * @param query 查询参数
+ * @return
+ */
+ @GetMapping("/pageLikes")
+ public R<IPage<Article>> pageLikes(HttpServletResponse response, ArticleVo article, Query query){
+ response.setHeader("Access-Control-Allow-Origin", "*");
+ response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
+ response.setHeader("Access-Control-Allow-Credentials","true");
+ return R.data(articleService.pageLikes(Condition.getPage(query),article));
+ }
+
+ /**
+ * 查询已收藏的资讯
+ */
+ @GetMapping("/pageCollect")
+ public R<IPage<Article>> pageCollect(HttpServletResponse response, ArticleVo article, Query query){
+ response.setHeader("Access-Control-Allow-Origin", "*");
+ response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
+ response.setHeader("Access-Control-Allow-Credentials","true");
+ return R.data(articleService.pageCollect(Condition.getPage(query),article));
+ }
+
/**
* 资讯详情
@@ -111,7 +146,15 @@
@ApiOperation(value = "新增或修改", notes = "传入article")
public R submit(@Valid @RequestBody Article article) {
if (null==article.getId()){
- article.setCreateTime(new Date());
+ if (null==article.getCreateTime()){
+ article.setCreateTime(new Date());
+ }
+ }
+
+ if (article.getContent() != null && article.getContent() != ""){
+ String content = "";
+ content = DemoApplication.interceptWords(article.getContent());
+ article.setContent(content);
}
article.setUpdateTime(new Date());
return R.status(articleService.saveOrUpdate(article));
@@ -128,4 +171,18 @@
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(articleService.removeByIds(Func.toLongList(ids)));
}
+
+ /**
+ * 批量修改评论区状态
+ */
+ @PostMapping("/upcomment")
+ public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids,String type) {
+ String[] split = ids.split(",");
+ String strArrays = "";
+ for (int i = 0; i < split.length; i++) {
+ strArrays += "'" + split[i] + "',";
+ }
+ String code = strArrays.substring(0, strArrays.length() - 1);
+ return R.status(articleService.upcomment(code,type));
+ }
}
--
Gitblit v1.9.3