Week 1-8: Spring Boot 学习计划完整项目
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
44
week5/src/main/java/com/learn/entity/User.java
Normal file
44
week5/src/main/java/com/learn/entity/User.java
Normal file
@@ -0,0 +1,44 @@
|
||||
package com.learn.entity;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Entity
|
||||
@Table(name = "users")
|
||||
public class User implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Column(nullable = false, unique = true, length = 50)
|
||||
private String username;
|
||||
|
||||
@Column(nullable = false, length = 200)
|
||||
private String password; // BCrypt 加密后的密文
|
||||
|
||||
@Column(nullable = false, length = 20)
|
||||
private String role; // ADMIN / USER(第 3 天 RBAC)
|
||||
|
||||
@Column(nullable = false)
|
||||
private Integer enabled = 1;
|
||||
|
||||
@Column(name = "create_time", insertable = false, updatable = false)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
public User() {}
|
||||
|
||||
public Long getId() { return id; }
|
||||
public void setId(Long id) { this.id = id; }
|
||||
public String getUsername() { return username; }
|
||||
public void setUsername(String username) { this.username = username; }
|
||||
public String getPassword() { return password; }
|
||||
public void setPassword(String password) { this.password = password; }
|
||||
public String getRole() { return role; }
|
||||
public void setRole(String role) { this.role = role; }
|
||||
public Integer getEnabled() { return enabled; }
|
||||
public void setEnabled(Integer enabled) { this.enabled = enabled; }
|
||||
public LocalDateTime getCreateTime() { return createTime; }
|
||||
}
|
||||
Reference in New Issue
Block a user