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
57
58
59
package com.tanpu.community.controller;
import com.tanpu.common.api.CommonResp;
import com.tanpu.community.api.beans.qo.CommentQo;
import com.tanpu.community.api.beans.req.theme.CreateCommentReq;
import com.tanpu.community.manager.CommentManager;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@Slf4j
@RequestMapping(value = "/api/theme")
public class CommentController {
@Autowired
private CommentManager commentManager;
@ApiOperation("发表评论")
@PostMapping(value = "/publishComment")
@ResponseBody
public CommonResp<Void> publishCommet(@RequestBody CreateCommentReq req) {
String userId = "liujm";
commentManager.comment(req, userId);
return CommonResp.success();
}
@ApiOperation("查看评论")
@GetMapping(value = "/queryComment")
@ResponseBody
public CommonResp<List<CommentQo>> queryComment(@RequestParam String themeId){
//todo
String userId = "liujm";
List<CommentQo> result = commentManager.queryComments(themeId,userId);
return CommonResp.success(result);
}
@ApiOperation("点赞评论")
@GetMapping(value = "/likeComment")
@ResponseBody
public CommonResp<Void> likeComment(@RequestParam String commentId){
//todo
String userId = "liujm";
return CommonResp.success();
}
@ApiOperation("举报评论")
@GetMapping(value = "/reportComment")
@ResponseBody
public CommonResp<Void> reportComment(@RequestParam String commentId){
//todo
String userId = "liujm";
return CommonResp.success();
}
}