CommentController.java 813 B

12345678910111213141516171819202122232425262728
  1. package com.seecoder.BlueWhale.controller;
  2. import java.util.List;
  3. import org.springframework.beans.factory.annotation.Autowired;
  4. import org.springframework.web.bind.annotation.RequestMapping;
  5. import org.springframework.web.bind.annotation.RestController;
  6. import com.seecoder.BlueWhale.service.CommentService;
  7. import com.seecoder.BlueWhale.vo.ResultVO;
  8. import org.springframework.web.bind.annotation.GetMapping;
  9. import org.springframework.web.bind.annotation.PathVariable;
  10. @RestController
  11. @RequestMapping("/api/comments")
  12. public class CommentController {
  13. @Autowired
  14. CommentService commentService;
  15. @GetMapping("/{id}")
  16. public ResultVO<List<String>> getComments(@PathVariable(value = "id") Integer id) {
  17. return ResultVO.buildSuccess(commentService.findComments(id));
  18. }
  19. }