| | |
| | | package org.springblade.modules.article.controller; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.AllArgsConstructor; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | |
| | | /** |
| | | * 查询资讯分页信息 |
| | | * @param article 资讯对象 |
| | | * @param query 查询参数 |
| | | * |
| | | * @param article 资讯对象 |
| | | * @param query 查询参数 |
| | | * @return |
| | | */ |
| | | @GetMapping("/pageWeb") |
| | |
| | | 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") |
| | |
| | | |
| | | /** |
| | | * 敏感词预警 |
| | | * @param article 资讯对象 |
| | | * @param query 查询参数 |
| | | * |
| | | * @param article 资讯对象 |
| | | * @param query 查询参数 |
| | | * @return |
| | | */ |
| | | @GetMapping("/pageWords") |
| | |
| | | |
| | | /** |
| | | * 查询资讯分页信息(角色权限) |
| | | * @param article 资讯对象 |
| | | * @param query 查询参数 |
| | | * |
| | | * @param article 资讯对象 |
| | | * @param query 查询参数 |
| | | * @return |
| | | */ |
| | | @GetMapping("/pageDate") |
| | |
| | | |
| | | /** |
| | | * 查询资讯分页信息(角色权限)附带点赞评论数 |
| | | * @param article 资讯对象 |
| | | * @param query 查询参数 |
| | | * |
| | | * @param article 资讯对象 |
| | | * @param query 查询参数 |
| | | * @return |
| | | */ |
| | | @GetMapping("/pageLikes") |
| | |
| | | /** |
| | | * 资讯详情 |
| | | * |
| | | * @param article 资讯查询对象 |
| | | * @param article 资讯查询对象 |
| | | */ |
| | | @GetMapping("/detail") |
| | | @ApiOperationSupport(order = 1) |
| | |
| | | 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); |
| | | // 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); |
| | | } |
| | | |
| | |
| | | |
| | | /** |
| | | * 修改资讯信息 |
| | | * |
| | | * @param article 资讯对象 |
| | | */ |
| | | @PostMapping("/update") |
| | |
| | | |
| | | /** |
| | | * 删除资讯信息 |
| | | * |
| | | * @param ids 资讯主键id,id集合 |
| | | */ |
| | | @PostMapping("/remove") |
| | |
| | | |
| | | /** |
| | | * 查询个人资讯 |
| | | * |
| | | * @param article |
| | | * @param query |
| | | * @return |
| | |
| | | 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)); |
| | | } |
| | | } |