CommentController.java 1.75 KB
Newer Older
刘基明's avatar
刘基明 committed
1 2 3 4 5
package com.tanpu.community.controller;


import com.tanpu.common.api.CommonResp;
import com.tanpu.community.api.beans.qo.CommentQo;
刘基明's avatar
刘基明 committed
6
import com.tanpu.community.api.beans.req.theme.CreateCommentReq;
刘基明's avatar
刘基明 committed
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
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("查看评论")
刘基明's avatar
刘基明 committed
33
    @GetMapping(value = "/queryComment")
刘基明's avatar
刘基明 committed
34 35 36 37 38 39 40 41 42
    @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("点赞评论")
刘基明's avatar
刘基明 committed
43
    @GetMapping(value = "/likeComment")
刘基明's avatar
刘基明 committed
44
    @ResponseBody
刘基明's avatar
刘基明 committed
45
    public CommonResp<Void> likeComment(@RequestParam String commentId){
刘基明's avatar
刘基明 committed
46 47 48 49 50 51
        //todo
        String userId = "liujm";
        return CommonResp.success();
    }

    @ApiOperation("举报评论")
刘基明's avatar
刘基明 committed
52
    @GetMapping(value = "/reportComment")
刘基明's avatar
刘基明 committed
53
    @ResponseBody
刘基明's avatar
刘基明 committed
54
    public CommonResp<Void>  reportComment(@RequestParam String commentId){
刘基明's avatar
刘基明 committed
55 56 57 58 59
        //todo
        String userId = "liujm";
        return CommonResp.success();
    }
}