Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <#list comment as msg>
- <#if !msg.reply??>
- <li>
- ${msg.message}
- <ul>
- <li>
- <#list replyes as reply>
- <#if reply.reply.toString() == msg.toString()>
- ${reply.message}
- <#list replyes as sub_reply>
- <#if sub_reply.reply.toString() == reply.toString()>
- <ul>
- <li>
- ${sub_reply.message}
- </li>
- </ul>
- </#if>
- </#list>
- </#if>
- </#list>
- </li>
- </ul>
- </li>
- </#if>
- </#list>
- @GetMapping(value = "chat")
- public String charPage(@AuthenticationPrincipal User user,
- Map<String, Object> model) {
- model.put("comment",commentRepo.findAllByMessageIsNotNullOrderById());
- model.put("replyes",commentRepo.findAllByReplyIsNotNull());
- return "chatmessage";
- }
- public interface CommentRepo extends JpaRepository <Comment, Long> {
- List<Comment> findAllByMessageIsNotNullOrderById();
- List<Comment> findAllByReplyIsNotNull();
- }
- @Entity
- public class Comment {
- @Id
- @GeneratedValue(strategy = GenerationType.AUTO)
- private long id;
- private String message;
- @ManyToOne(fetch = FetchType.EAGER)
- @JoinColumn(name = "comment_id")
- private Comment reply;
- @ManyToOne(fetch = FetchType.EAGER)
- @JoinColumn(name = "user_id")
- private User user;
- public Comment() {
- }
Add Comment
Please, Sign In to add comment