Files
love-nav/src/main/java/com/lovenav/controller/CommentController.java
2023-12-23 15:34:05 +08:00

47 lines
1.4 KiB
Java

package com.lovenav.controller;
import com.lovenav.entity.Comment;
import com.lovenav.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/comment")
public class CommentController {
@Autowired
private CommentService commentService;
// 评论功能
@RequestMapping(method = RequestMethod.POST, value = "/comment")
public String Reply1(@RequestBody Comment comment){
return commentService.Reply1(comment);
}
// 回复功能
@RequestMapping(method = RequestMethod.POST, value = "/reply_comment")
public String Reply2(@RequestBody Comment comment,int id){
return commentService.Reply2(comment,id);
}
// 删除功能
@RequestMapping(method = RequestMethod.GET, value = "/delete_comment")
public String Delete(int id){
return commentService.Delete(id);
}
@RequestMapping(method = RequestMethod.GET, value = "/addLikeCount")
public String addLikeCount(int id){
return commentService.AddLikeCount(id);
}
// 显示评论
@RequestMapping(method = RequestMethod.GET, value = "/view_comment")
public String View_comment(){
return commentService.View_comment();
}
// 显示回复
@RequestMapping(method = RequestMethod.GET, value = "/view_reply")
public String View_reply(int id){
return commentService.View_Reply(id);
}
}