评论,回复,删评

This commit is contained in:
sjm 2023-12-22 11:00:12 +08:00
parent c8b79cc7a5
commit 3e1265b72c
3 changed files with 7 additions and 6 deletions

View File

@ -32,9 +32,9 @@ public class CommentController {
return commentService.Reply2(comment);
}
// 删除功能
@RequestMapping(method = RequestMethod.POST, value = "/delete_comment")
public String Delete(Comment comment){
return commentService.Delete(comment);
@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){

View File

@ -12,5 +12,5 @@ public interface CommentService {
// 回复
String Reply2(Comment comment);
// 删除
String Delete(Comment comment);
String Delete(int id);
}

View File

@ -47,10 +47,11 @@ public class CommentServiceImpl implements CommentService {
}
// 删除
@Override
public String Delete(Comment comment){
int result = commentDao.deleteByPrimaryKey(comment.getId());
public String Delete(int id){
int result = commentDao.deleteByPrimaryKey(id);
HashMap<String, Object> hashMap = new HashMap<>();
if (result > 0){
hashMap.put("code", 200);
hashMap.put("msg", "删除成功");
String jsonString = JSONObject.toJSONString(hashMap);
return JSON.toJSONString(hashMap);