给news实体类添加约束
This commit is contained in:
parent
e56db8a92e
commit
961a17efef
@ -1,9 +1,6 @@
|
||||
package org.cmh.backend.NewsManagement.model;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@ -14,9 +11,18 @@ public class News {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Column(nullable = false, unique = true)
|
||||
private String title;
|
||||
|
||||
@Column(nullable = false)
|
||||
private String summary;
|
||||
|
||||
@Column(nullable = false)
|
||||
private String content;
|
||||
|
||||
private String imagePath;
|
||||
|
||||
@Column(nullable = false)
|
||||
private String author;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user