mirror of
https://gitee.com/devlive-community/datacap.git
synced 2024-12-03 04:27:56 +08:00
[Core] Fixed user createTime is null
This commit is contained in:
parent
5b21319225
commit
44203f4599
@ -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());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user