cloudroam
2025-06-04 ed0dc655e6732f15d30f399c0d460ad7b9fe42da
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package com.mzl.flower.web.film;
 
import com.github.pagehelper.PageInfo;
import com.mzl.flower.base.BaseController;
import com.mzl.flower.base.R;
import com.mzl.flower.base.ReturnDataDTO;
import com.mzl.flower.dto.request.film.CommentSearchDTO;
import com.mzl.flower.dto.response.film.CommentDTO;
import com.mzl.flower.service.film.CommentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
import java.util.List;
 
 
/**
 * @author fanghaowei
 * @date 2025/6/3 14:28
 */
@Slf4j
@RestController
@RequestMapping("/api/comment/")
@Api(tags = "评论管理")
public class CommentController extends BaseController {
    @Resource
    private CommentService commentService;
 
    @GetMapping("getCommentByFilmId")
    @ApiOperation(value = "获取文章的评论信息")
    public ResponseEntity<ReturnDataDTO<List<CommentDTO>>> getCommentByFilmId(CommentSearchDTO commentSearchDTO) {
        return returnData(R.SUCCESS.getCode(), commentService.getCommentByFilmId(commentSearchDTO));
    }
 
    @GetMapping("getLatestComment")
    @ApiOperation(value = "获取最新评论信息")
    public ResponseEntity<PageInfo<CommentDTO>> getLatestComment(CommentSearchDTO commentSearchDTO) {
        return returnData(R.SUCCESS.getCode(),commentService.getLatestComment(commentSearchDTO));
    }
 
    @PostMapping("create")
    @ApiOperation(value = "创建评论")
    public ResponseEntity<Boolean> create(@RequestBody CommentDTO commentDTO) {
        return returnData(R.SUCCESS.getCode(),commentService.create(commentDTO));
    }
 
    @PostMapping("delete/{commentId}")
    @ApiOperation(value = "删除评论")
    public ResponseEntity<Boolean> delete(@PathVariable Integer commentId) {
        return returnData(R.SUCCESS.getCode(),commentService.delete(commentId));
    }
 
}