Initial empty repository
Change-Id: Ie0685414be5495d9da50d659d9ec16ae51487e46
diff --git a/src/main/java/com/example/myproject/entity/User.java b/src/main/java/com/example/myproject/entity/User.java
new file mode 100644
index 0000000..20f7138
--- /dev/null
+++ b/src/main/java/com/example/myproject/entity/User.java
@@ -0,0 +1,55 @@
+package com.example.myproject.entity;
+
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+@TableName("user") // 指定数据库表名
+@ApiModel("用户实体类") // 用于描述模型
+public class User {
+
+ @TableId(type = IdType.AUTO) // 指定主键策略
+ @ApiModelProperty(value = "用户ID", example = "1")
+ private Long id;
+
+ @JsonProperty("username")
+ @ApiModelProperty(value = "用户名", example = "22301115")
+ private String username;
+
+ @JsonProperty("nickname")
+ @ApiModelProperty(value = "昵称", example = "cyl")
+ private String nickname;
+
+ @JsonProperty("role")
+ @ApiModelProperty(value = "角色", example = "Student")
+ private String role;
+
+ @JsonProperty("password")
+ @ApiModelProperty(value = "密码", example = "123")
+ private String password;
+
+ @JsonProperty("status")
+ @ApiModelProperty(value = "用户状态", example = "1")
+ private int status;
+
+ @JsonProperty("email")
+ @ApiModelProperty(value = "电子邮件地址", example = "john_doe@example.com")
+ private String email;
+
+ @JsonProperty("email_verified")
+ @ApiModelProperty(value = "邮箱验证状态", example = "true")
+ private boolean emailVerified;
+
+ @JsonProperty("avatar")
+ @ApiModelProperty(value = "头像")
+ private String avatar;
+
+ public User() {
+ }
+}
diff --git a/src/main/java/com/example/myproject/entity/UserDetails.java b/src/main/java/com/example/myproject/entity/UserDetails.java
new file mode 100644
index 0000000..9af35f0
--- /dev/null
+++ b/src/main/java/com/example/myproject/entity/UserDetails.java
@@ -0,0 +1,23 @@
+package com.example.myproject.entity;
+
+import org.springframework.security.core.GrantedAuthority;
+
+import java.io.Serializable;
+import java.util.Collection;
+
+public interface UserDetails extends Serializable {
+ Collection<? extends GrantedAuthority> getAuthorities();
+
+ String getPassword();
+
+ String getUsername();
+
+ boolean isAccountNonExpired();
+
+ boolean isAccountNonLocked();
+
+ boolean isCredentialsNonExpired();
+
+ boolean isEnabled();
+}
+
diff --git a/src/main/java/com/example/myproject/entity/VerificationToken.java b/src/main/java/com/example/myproject/entity/VerificationToken.java
new file mode 100644
index 0000000..231fd95
--- /dev/null
+++ b/src/main/java/com/example/myproject/entity/VerificationToken.java
@@ -0,0 +1,58 @@
+package com.example.myproject.entity;
+
+import com.baomidou.mybatisplus.annotation.*;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.AllArgsConstructor;
+
+import java.time.Instant;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@TableName("verification_token")
+@ApiModel("验证令牌实体类")
+public class VerificationToken {
+
+ @TableId(type = IdType.AUTO)
+ @ApiModelProperty(value = "令牌ID")
+ private Long id;
+
+ @ApiModelProperty(value = "令牌字符串")
+ @TableField("token")
+ private String token;
+
+ @ApiModelProperty(value = "令牌过期日期")
+ @TableField("expiry_date")
+ private Instant expiryDate;
+
+ @ApiModelProperty(value = "用户名")
+ @TableField("username")
+ private String username;
+
+ @ApiModelProperty(value = "电子邮件地址")
+ @TableField("email")
+ private String email;
+
+ @ApiModelProperty(value = "加密后的密码")
+ @TableField("password")
+ private String password;
+
+ public VerificationToken(String token, String username, String email, String password, Instant expiryDate) {
+ this.token = token;
+ this.username = username;
+ this.email = email;
+ this.password = password;
+ this.expiryDate = expiryDate;
+ }
+
+ /**
+ * 检查令牌是否过期
+ * @return true 如果令牌已过期
+ */
+ public boolean isExpired() {
+ return expiryDate.isBefore(Instant.now());
+ }
+}