Skip to content
Snippets Groups Projects

add showPark function and Combined projects,Perfect logic of showComment

23 files
+ 864
312
Compare changes
  • Side-by-side
  • Inline

Files

package hackathon.Controller;
import hackathon.DTO.RecommendDTO;
import hackathon.Entity.Comment;
import hackathon.Service.CommentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
@@ -18,17 +18,15 @@ public class CommentController {
@PostMapping("/comment")
public String GetCommnet(@RequestBody Comment comment){
System.out.println("comment"+comment);
commentService.addComment(comment);
return "Comment added successfully";
}
@PostMapping("/showRec")
public ArrayList show(@RequestBody String type){
System.out.println(type);
ArrayList arrayList = commentService.selectByType(type);
System.out.println(arrayList);
return arrayList;
public RecommendDTO show(@RequestBody String type){
RecommendDTO recommendDTO = commentService.selectRecommend(type);
return recommendDTO;
}
@GetMapping("/viewComments")
public String viewComments(Model model){
@@ -36,6 +34,7 @@ public class CommentController {
model.addAttribute("comments", comments);
return "viewComments";
}
@GetMapping("/comments")
public ArrayList<Comment> getCommentsByType(@RequestParam String type) {
return commentService.selectByType(type);
Loading