You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.9 KiB
62 lines
1.9 KiB
package com.example.myapp.model;
|
|
|
|
import java.io.Serializable;
|
|
import java.time.LocalDateTime;
|
|
|
|
public class User implements Serializable {
|
|
private String email;
|
|
private String username; // 新增用户名字段
|
|
private String passwordHash;
|
|
private boolean verified;
|
|
private LocalDateTime createdAt;
|
|
private LocalDateTime lastModified;
|
|
|
|
public User() {
|
|
this.createdAt = LocalDateTime.now();
|
|
this.lastModified = LocalDateTime.now();
|
|
}
|
|
|
|
public User(String email, String username) {
|
|
this.email = email;
|
|
this.username = username;
|
|
this.verified = false;
|
|
this.createdAt = LocalDateTime.now();
|
|
this.lastModified = LocalDateTime.now();
|
|
}
|
|
|
|
// Getters and Setters
|
|
public String getEmail() { return email; }
|
|
public void setEmail(String email) {
|
|
this.email = email;
|
|
this.lastModified = LocalDateTime.now();
|
|
}
|
|
|
|
public String getUsername() { return username; }
|
|
public void setUsername(String username) {
|
|
this.username = username;
|
|
this.lastModified = LocalDateTime.now();
|
|
}
|
|
|
|
public String getPasswordHash() { return passwordHash; }
|
|
public void setPasswordHash(String passwordHash) {
|
|
this.passwordHash = passwordHash;
|
|
this.lastModified = LocalDateTime.now();
|
|
}
|
|
|
|
public boolean isVerified() { return verified; }
|
|
public void setVerified(boolean verified) {
|
|
this.verified = verified;
|
|
this.lastModified = LocalDateTime.now();
|
|
}
|
|
|
|
public LocalDateTime getCreatedAt() { return createdAt; }
|
|
public void setCreatedAt(LocalDateTime createdAt) { this.createdAt = createdAt; }
|
|
|
|
public LocalDateTime getLastModified() { return lastModified; }
|
|
public void setLastModified(LocalDateTime lastModified) { this.lastModified = lastModified; }
|
|
|
|
@Override
|
|
public String toString() {
|
|
return "User{email='" + email + "', username='" + username + "', verified=" + verified + "}";
|
|
}
|
|
} |