| | |
| | | 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; |
| | | |
| | | /** |
| | |
| | | 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)); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * 查询资讯分页信息(角色权限)附带点赞评论数 |
| | |
| | | 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)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 资讯详情 |
| | |
| | | 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)); |
| | | } |