fix: 后端代码格式化

This commit is contained in:
Tim
2025-09-18 14:42:25 +08:00
parent 70f7442f0c
commit 72b2b82e02
325 changed files with 15341 additions and 12370 deletions

View File

@@ -1,19 +1,15 @@
package com.openisle.model;
import com.openisle.model.Tag;
import jakarta.persistence.*;
import java.time.LocalDateTime;
import java.util.HashSet;
import java.util.Set;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.CreationTimestamp;
import java.util.HashSet;
import java.util.Set;
import java.time.LocalDateTime;
import com.openisle.model.Tag;
/**
* Post entity representing an article posted by a user.
*/
@@ -24,58 +20,64 @@ import com.openisle.model.Tag;
@Table(name = "posts")
@Inheritance(strategy = InheritanceType.JOINED)
public class Post {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(nullable = false)
private String title;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(nullable = false, columnDefinition = "LONGTEXT")
private String content;
@Column(nullable = false)
private String title;
@CreationTimestamp
@Column(nullable = false, updatable = false,
columnDefinition = "DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6)")
private LocalDateTime createdAt;
@Column(nullable = false, columnDefinition = "LONGTEXT")
private String content;
@ManyToOne(optional = false, fetch = FetchType.EAGER)
@JoinColumn(name = "author_id")
private User author;
@CreationTimestamp
@Column(
nullable = false,
updatable = false,
columnDefinition = "DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6)"
)
private LocalDateTime createdAt;
@ManyToOne(optional = false, fetch = FetchType.EAGER)
@JoinColumn(name = "category_id")
private Category category;
@ManyToOne(optional = false, fetch = FetchType.EAGER)
@JoinColumn(name = "author_id")
private User author;
@ManyToMany(fetch = FetchType.EAGER)
@JoinTable(name = "post_tags",
joinColumns = @JoinColumn(name = "post_id"),
inverseJoinColumns = @JoinColumn(name = "tag_id"))
private Set<Tag> tags = new HashSet<>();
@ManyToOne(optional = false, fetch = FetchType.EAGER)
@JoinColumn(name = "category_id")
private Category category;
@Column(nullable = false)
private long views = 0;
@ManyToMany(fetch = FetchType.EAGER)
@JoinTable(
name = "post_tags",
joinColumns = @JoinColumn(name = "post_id"),
inverseJoinColumns = @JoinColumn(name = "tag_id")
)
private Set<Tag> tags = new HashSet<>();
@Enumerated(EnumType.STRING)
@Column(nullable = false)
private PostStatus status = PostStatus.PUBLISHED;
@Column(nullable = false)
private long views = 0;
@Enumerated(EnumType.STRING)
@Column(nullable = false)
private PostType type = PostType.NORMAL;
@Enumerated(EnumType.STRING)
@Column(nullable = false)
private PostStatus status = PostStatus.PUBLISHED;
@Column(nullable = false)
private boolean closed = false;
@Enumerated(EnumType.STRING)
@Column(nullable = false)
private PostType type = PostType.NORMAL;
@Column
private LocalDateTime pinnedAt;
@Column(nullable = false)
private boolean closed = false;
@Column(nullable = true)
private Boolean rssExcluded = true;
@Column
private LocalDateTime pinnedAt;
@Column(nullable = false)
private long commentCount = 0;
@Column(nullable = true)
private Boolean rssExcluded = true;
@Column(nullable = true)
private LocalDateTime lastReplyAt;
@Column(nullable = false)
private long commentCount = 0;
@Column(nullable = true)
private LocalDateTime lastReplyAt;
}