| | |
| | | package com.ruoyi.article.controller.management; |
| | | |
| | | |
| | | import com.ruoyi.article.controller.management.dto.MgtArticleAuditDTO; |
| | | import com.ruoyi.article.controller.management.dto.MgtArticleDTO; |
| | | import com.ruoyi.article.controller.management.dto.MgtArticleQuery; |
| | | import com.ruoyi.article.controller.management.dto.MgtArticleUpdDTO; |
| | | import com.ruoyi.article.controller.management.vo.MgtArticleVO; |
| | | import com.ruoyi.article.service.IArticleService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.page.PageDTO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | |
| | | * @param query 资讯管理查询条件 |
| | | * @return PageDTO<ArticleVO> |
| | | */ |
| | | @ApiOperation(value = "获取资讯列表的分页数据", notes = "获取资讯列表的分页数据") |
| | | @ApiOperation(value = "获取资讯列表的分页数据", notes = "获取资讯列表的分页数据,资讯审核列表") |
| | | @PostMapping("/page") |
| | | public R<PageDTO<MgtArticleVO>> getArticlePage(@Validated @RequestBody MgtArticleQuery query) { |
| | | return R.ok(articleService.getArticlePage(query)); |
| | | } |
| | | |
| | | /** |
| | | * 添加/编辑资讯 |
| | | * |
| | | * @param dto 管理后台-资讯传输对象 |
| | | */ |
| | | @ApiOperation(value = "添加/编辑资讯") |
| | | @PostMapping("/save") |
| | | public R<?> saveArticle(@Validated @RequestBody MgtArticleDTO dto) { |
| | | articleService.saveArticle(dto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 处理举报 |
| | | * |
| | | * @param id 资讯id |
| | | */ |
| | | @ApiOperation(value = "处理举报") |
| | | @PutMapping("/handle-report/{id}") |
| | | public R<?> handleReport( |
| | | @ApiParam(name = "id", value = "资讯id", required = true) @PathVariable("id") Long id) { |
| | | articleService.handleReport(id); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 查看详情 |
| | | * |
| | | * @param id 资讯id |
| | | * @return MgtArticleVO |
| | | */ |
| | | @ApiOperation(value = "查看详情") |
| | | @GetMapping("/detail/{id}") |
| | | public R<MgtArticleVO> getDetail( |
| | | @ApiParam(name = "id", value = "资讯id", required = true) @PathVariable("id") Long id) { |
| | | return R.ok(articleService.getDetail(id)); |
| | | } |
| | | |
| | | /** |
| | | * 资讯审核 |
| | | * |
| | | * @param dto 管理后台-资讯审核传输对象 |
| | | */ |
| | | @ApiOperation("资讯审核") |
| | | @PutMapping("/audit") |
| | | public R<?> audit(@Validated @RequestBody MgtArticleAuditDTO dto) { |
| | | articleService.audit(dto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 上架/下架 |
| | | * |
| | | * @param dto 资讯上下架数据传输对象 |
| | | */ |
| | | @ApiOperation("上架/下架") |
| | | @PutMapping("/upd-status") |
| | | public R<?> updStatus(@Validated @RequestBody MgtArticleUpdDTO dto) { |
| | | articleService.updStatus(dto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 删除资讯 |
| | | * |
| | | * @param id 资讯id |
| | | */ |
| | | @ApiOperation("删除资讯") |
| | | @DeleteMapping("/{id}") |
| | | public R<?> removeById( |
| | | @ApiParam(name = "id", value = "资讯id", required = true) @PathVariable("id") Long id) { |
| | | articleService.removeById(id); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiOperation("删除资讯评论") |
| | | @DeleteMapping("/comments/{id}") |
| | | public R<?> removeCommentsById( |
| | | @ApiParam(name = "id", value = "资讯评论id", required = true) @PathVariable("id") Long id) { |
| | | articleService.removeCommentsById(id); |
| | | return R.ok(); |
| | | } |
| | | } |