refactor(jpa): 使用 @Table 和 @Column 的 comment 属性替换 @Comment 注解
This commit is contained in:
@@ -10,13 +10,13 @@ import jakarta.persistence.Enumerated;
|
||||
import jakarta.persistence.ForeignKey;
|
||||
import jakarta.persistence.JoinTable;
|
||||
import jakarta.persistence.OneToMany;
|
||||
import jakarta.persistence.Table;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.FieldNameConstants;
|
||||
import org.hibernate.annotations.Comment;
|
||||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
import org.hibernate.annotations.SoftDelete;
|
||||
@@ -31,13 +31,11 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||
@DynamicUpdate
|
||||
@DynamicInsert
|
||||
@EntityListeners(AuditingEntityListener.class)
|
||||
@Comment("企业")
|
||||
@Table(comment = "企业")
|
||||
public class Company extends SimpleEntity {
|
||||
@Column(nullable = false)
|
||||
@Comment("名称")
|
||||
@Column(nullable = false, comment = "名称")
|
||||
private String name;
|
||||
@Column(nullable = false)
|
||||
@Comment("成员数")
|
||||
@Column(nullable = false, comment = "成员数")
|
||||
private Integer members;
|
||||
|
||||
@OneToMany(mappedBy = "company")
|
||||
|
||||
@@ -12,13 +12,13 @@ import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.JoinTable;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.MapKeyEnumerated;
|
||||
import jakarta.persistence.Table;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.FieldNameConstants;
|
||||
import org.hibernate.annotations.Comment;
|
||||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
import org.hibernate.annotations.SoftDelete;
|
||||
@@ -33,17 +33,14 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||
@DynamicUpdate
|
||||
@DynamicInsert
|
||||
@EntityListeners(AuditingEntityListener.class)
|
||||
@Comment("员工")
|
||||
@Table(comment = "员工")
|
||||
public class Employee extends SimpleEntity {
|
||||
@Column(nullable = false)
|
||||
@Comment("名称")
|
||||
@Column(nullable = false, comment = "名称")
|
||||
private String name;
|
||||
@Column(nullable = false)
|
||||
@Comment("年龄")
|
||||
@Column(nullable = false, comment = "年龄")
|
||||
private Integer age;
|
||||
@Column(nullable = false)
|
||||
@Column(nullable = false, comment = "角色")
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Comment("角色")
|
||||
private Role role;
|
||||
|
||||
@ManyToOne
|
||||
|
||||
@@ -5,11 +5,11 @@ import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.EntityListeners;
|
||||
import jakarta.persistence.EnumType;
|
||||
import jakarta.persistence.Enumerated;
|
||||
import jakarta.persistence.Table;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.FieldNameConstants;
|
||||
import org.hibernate.annotations.Comment;
|
||||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
import org.hibernate.annotations.SoftDelete;
|
||||
@@ -24,18 +24,15 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||
@DynamicUpdate
|
||||
@DynamicInsert
|
||||
@EntityListeners(AuditingEntityListener.class)
|
||||
@Comment("报告")
|
||||
@Table(comment = "报告")
|
||||
public class Report extends SimpleEntity {
|
||||
@Column(nullable = false)
|
||||
@Comment("分数")
|
||||
@Column(nullable = false, comment = "分数")
|
||||
private Double score = 0.0;
|
||||
@Column(nullable = false)
|
||||
@Column(nullable = false, comment = "等级")
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Comment("等级")
|
||||
private Level level;
|
||||
|
||||
@Column(nullable = false)
|
||||
@Comment("员工id")
|
||||
@Column(nullable = false, comment = "员工 ID")
|
||||
private Long employeeId;
|
||||
|
||||
public enum Level {
|
||||
|
||||
Reference in New Issue
Block a user