[Core] Fixed user createTime is null

This commit is contained in:
qianmoQ 2023-05-27 17:05:18 +08:00
parent 5b21319225
commit 44203f4599

View File

@ -20,12 +20,14 @@ import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.PrePersist;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@ -81,4 +83,10 @@ public class UserEntity
@OneToMany(mappedBy = "user", cascade = CascadeType.REMOVE, fetch = FetchType.LAZY)
@JsonIgnore
private List<SourceEntity> sources;
@PrePersist
void prePersist()
{
createTime = Timestamp.valueOf(LocalDateTime.now());
}
}