parent
b2fb7eaec8
commit
b66625bdc8
@ -0,0 +1,40 @@
|
||||
package com.school.lostfound.entity;
|
||||
|
||||
import lombok.Data;
|
||||
import javax.persistence.*;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "claim_record")
|
||||
public class Claim {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "item_id", nullable = false)
|
||||
private Item item;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "user_id", nullable = false)
|
||||
private User user;
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "publish_user_id", nullable = false)
|
||||
private User publishUser;
|
||||
|
||||
@Column(columnDefinition = "varchar(20) default 'pending'")
|
||||
private String status;
|
||||
|
||||
@Column(name = "apply_time", updatable = false)
|
||||
private Date applyTime;
|
||||
|
||||
@PrePersist
|
||||
public void prePersist() {
|
||||
if (this.applyTime == null) {
|
||||
this.applyTime = new Date();
|
||||
}
|
||||
if (this.status == null) {
|
||||
this.status = "pending";
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue