Guest User

Untitled

a guest
May 27th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. <#list comment as msg>
  2. <#if !msg.reply??>
  3. <li>
  4. ${msg.message}
  5. <ul>
  6. <li>
  7. <#list replyes as reply>
  8. <#if reply.reply.toString() == msg.toString()>
  9. ${reply.message}
  10. <#list replyes as sub_reply>
  11. <#if sub_reply.reply.toString() == reply.toString()>
  12. <ul>
  13. <li>
  14. ${sub_reply.message}
  15. </li>
  16. </ul>
  17. </#if>
  18. </#list>
  19. </#if>
  20.  
  21. </#list>
  22. </li>
  23. </ul>
  24. </li>
  25. </#if>
  26. </#list>
  27.  
  28. @GetMapping(value = "chat")
  29. public String charPage(@AuthenticationPrincipal User user,
  30. Map<String, Object> model) {
  31. model.put("comment",commentRepo.findAllByMessageIsNotNullOrderById());
  32. model.put("replyes",commentRepo.findAllByReplyIsNotNull());
  33.  
  34. return "chatmessage";
  35. }
  36.  
  37. public interface CommentRepo extends JpaRepository <Comment, Long> {
  38. List<Comment> findAllByMessageIsNotNullOrderById();
  39. List<Comment> findAllByReplyIsNotNull();
  40. }
  41.  
  42. @Entity
  43. public class Comment {
  44.  
  45. @Id
  46. @GeneratedValue(strategy = GenerationType.AUTO)
  47. private long id;
  48.  
  49. private String message;
  50.  
  51.  
  52. @ManyToOne(fetch = FetchType.EAGER)
  53. @JoinColumn(name = "comment_id")
  54. private Comment reply;
  55.  
  56.  
  57. @ManyToOne(fetch = FetchType.EAGER)
  58. @JoinColumn(name = "user_id")
  59. private User user;
  60.  
  61.  
  62. public Comment() {
  63. }
Add Comment
Please, Sign In to add comment