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