jpablog : comment list
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.example.jpablog.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
@@ -34,7 +35,8 @@ public class Board {
|
||||
private User user;
|
||||
|
||||
@OneToMany(mappedBy = "board")
|
||||
private List<Reply> reply = new ArrayList<>();
|
||||
@JsonIgnoreProperties({"board"})
|
||||
private List<Reply> replies = new ArrayList<>();
|
||||
|
||||
@CreationTimestamp
|
||||
private LocalDateTime createDate;
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.example.jpablog.repository;
|
||||
|
||||
import com.example.jpablog.model.Reply;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface ReplyRepository extends JpaRepository<Reply, Long> {
|
||||
}
|
||||
@@ -30,14 +30,16 @@
|
||||
<br/>
|
||||
<div class="card">
|
||||
<div class="card-header">댓글</div>
|
||||
<ul id="comment--box" class="list-group">
|
||||
<li id="comment--1" class="list-group-item d-flex justify-content-between">
|
||||
<div>댓글 내용</div>
|
||||
<div class="d-flex">
|
||||
<div class="font-italic">작성자 : abc </div>
|
||||
<button class="badge">삭제</button>
|
||||
</div>
|
||||
</li>
|
||||
<ul id="reply--box" class="list-group">
|
||||
<c:forEach var="reply" items="${board.replies}">
|
||||
<li id="reply--1" class="list-group-item d-flex justify-content-between">
|
||||
<div>${reply.content}</div>
|
||||
<div class="d-flex">
|
||||
<div class="font-italic">작성자 : ${reply.user.username} </div>
|
||||
<button class="badge">삭제</button>
|
||||
</div>
|
||||
</li>
|
||||
</c:forEach>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user