This commit is contained in:
sjm
2023-12-25 16:09:14 +08:00
parent 1f9388cba4
commit 8efe35f13b
8 changed files with 209 additions and 29 deletions

View File

@@ -1,10 +1,17 @@
package com.lovenav.controller;
import com.lovenav.entity.Comment;
import com.lovenav.entity.CommentNode;
import com.lovenav.entity.CommentUser;
import com.lovenav.service.CommentService;
import io.swagger.annotations.ApiParam;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/comment")
@@ -34,13 +41,40 @@ public class CommentController {
// 显示评论
@RequestMapping(method = RequestMethod.GET, value = "/view_comment")
public String View_comment(){
return commentService.View_comment();
}
public ResponseEntity<List<CommentNode>> queryObserveByBlogId (
@ApiParam(name = "url_id", value = "id", required = true) @PathVariable Integer url_id
) {
return ResponseEntity.ok(commentService.queryCommentByUrlId(url_id));
}
// 显示回复
@RequestMapping(method = RequestMethod.GET, value = "/view_reply")
public String View_reply(int id){
return commentService.View_Reply(id);
}
/**
* 功能描述根据博客id查询此博客的所有评论信息链表类型的数据
* @param UrlId 博客id
* @return 博客的评论信息
*/
@GetMapping("/UrlId")
public ResponseEntity<List<CommentNode>> queryCommentByUrlId (
@ApiParam(name = "UrlId", value = "urlid", required = true) @PathVariable Integer UrlId
) {
return ResponseEntity.ok(commentService.queryCommentByUrlId(UrlId));
}
/**
* 功能描述根据评论id查询用户信息评论信息携带用户信息
* @param Id 评论id
* @return 评论信息,携带用户信息
*/
@GetMapping("/Id")
public ResponseEntity<CommentUser> queryObserveUserById (
@ApiParam(name = "Id", value = "评论id", required = true)@PathVariable Integer Id
) {
return ResponseEntity.ok(commentService.queryCommentUserById(Id));
}
}