Files
gc-plan/week5/src/main/java/com/learn/entity/User.java
2026-04-29 23:45:17 +08:00

45 lines
1.4 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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; }
}