Files
love-nav/src/main/java/com/lovenav/controller/CommentController.java
2023-12-22 14:03:59 +08:00

50 lines
1.6 KiB
Java

package com.lovenav.controller;
import com.alibaba.fastjson2.JSONObject;
import com.lovenav.entity.Comment;
import com.lovenav.service.CommentService;
import com.lovenav.service.serviceImpl.CommentServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.HashMap;
@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();
}
}