| | |
| | | package com.ruoyi.article.controller.management; |
| | | |
| | | |
| | | import com.ruoyi.article.controller.management.dto.MgtArticleDTO; |
| | | import com.ruoyi.article.controller.management.dto.MgtArticleQuery; |
| | | import com.ruoyi.article.controller.management.vo.MgtArticleVO; |
| | | import com.ruoyi.article.service.IArticleService; |
| | |
| | | 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.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; |
| | |
| | | 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)); |
| | | } |
| | | |
| | | |
| | | } |