mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-02-24 15:10:48 +08:00
Add tag module with post associations
This commit is contained in:
@@ -5,6 +5,11 @@ import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import com.openisle.model.Tag;
|
||||
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@@ -38,6 +43,12 @@ public class Post {
|
||||
@JoinColumn(name = "category_id")
|
||||
private Category category;
|
||||
|
||||
@ManyToMany(fetch = FetchType.LAZY)
|
||||
@JoinTable(name = "post_tags",
|
||||
joinColumns = @JoinColumn(name = "post_id"),
|
||||
inverseJoinColumns = @JoinColumn(name = "tag_id"))
|
||||
private java.util.Set<Tag> tags = new java.util.HashSet<>();
|
||||
|
||||
@Column(nullable = false)
|
||||
private long views = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user