generated from youfool-project/youfool-prj-springboot-template
142 lines
3.7 KiB
Java
142 lines
3.7 KiB
Java
package com.chinaweal.youfool.course.entity;
|
||
|
||
import com.baomidou.mybatisplus.annotation.IdType;
|
||
import com.baomidou.mybatisplus.annotation.TableField;
|
||
import com.baomidou.mybatisplus.annotation.TableId;
|
||
import com.baomidou.mybatisplus.annotation.TableName;
|
||
import io.swagger.v3.oas.annotations.media.Schema;
|
||
import lombok.Data;
|
||
|
||
import java.io.Serial;
|
||
import java.io.Serializable;
|
||
|
||
/**
|
||
* 系统用户实体类
|
||
*
|
||
* <p>该类对应数据库表sys_user,用于存储系统用户的基本信息。
|
||
* 包含用户ID、用户名、昵称、姓名、头像、邮箱和Gitea Open ID等字段。</p>
|
||
*
|
||
* @author youfool-course
|
||
* @since 1.0.0
|
||
*/
|
||
@Data
|
||
@TableName("sys_user")
|
||
@Schema(description = "系统用户")
|
||
public class SysUser implements Serializable {
|
||
|
||
@Serial
|
||
private static final long serialVersionUID = 1L;
|
||
|
||
/**
|
||
* 用户ID
|
||
*
|
||
* <p>系统用户的唯一标识符,使用UUID格式。</p>
|
||
*/
|
||
@TableId(value = "user_id", type = IdType.ASSIGN_UUID)
|
||
@Schema(description = "用户ID", example = "550e8400-e29b-41d4-a716-446655440000")
|
||
private String userId;
|
||
|
||
/**
|
||
* 用户名
|
||
*
|
||
* <p>用户登录时使用的用户名,系统内需要保持唯一。</p>
|
||
*/
|
||
@TableField("username")
|
||
@Schema(description = "用户名", example = "admin")
|
||
private String username;
|
||
|
||
/**
|
||
* 昵称
|
||
*
|
||
* <p>用户在系统中显示的昵称,可以重复。</p>
|
||
*/
|
||
@TableField("nickname")
|
||
@Schema(description = "昵称", example = "管理员")
|
||
private String nickname;
|
||
|
||
/**
|
||
* 姓名
|
||
*
|
||
* <p>用户的真实姓名,用于实名认证等场景。</p>
|
||
*/
|
||
@TableField("name")
|
||
@Schema(description = "姓名", example = "张三")
|
||
private String name;
|
||
|
||
/**
|
||
* 头像
|
||
*
|
||
* <p>用户头像图片的URL或Base64编码数据。</p>
|
||
*/
|
||
@TableField("avatar")
|
||
@Schema(description = "头像", example = "https://example.com/avatar.jpg")
|
||
private String avatar;
|
||
|
||
/**
|
||
* 邮箱
|
||
*
|
||
* <p>用户的电子邮箱地址,用于通知和找回密码等功能。</p>
|
||
*/
|
||
@TableField("email")
|
||
@Schema(description = "邮箱", example = "user@example.com")
|
||
private String email;
|
||
|
||
/**
|
||
* Gitea Open ID
|
||
*
|
||
* <p>用于Gitea第三方登录的Open ID标识符。</p>
|
||
*/
|
||
@TableField("gitea_open_id")
|
||
@Schema(description = "Gitea Open ID", example = "1234567890")
|
||
private String giteaOpenId;
|
||
|
||
/**
|
||
* 无参构造函数
|
||
*/
|
||
public SysUser() {
|
||
}
|
||
|
||
/**
|
||
* 带用户ID的构造函数
|
||
*
|
||
* @param userId 用户ID
|
||
*/
|
||
public SysUser(String userId) {
|
||
this.userId = userId;
|
||
}
|
||
|
||
/**
|
||
* 完整参数构造函数
|
||
*
|
||
* @param userId 用户ID
|
||
* @param username 用户名
|
||
* @param nickname 昵称
|
||
* @param name 姓名
|
||
* @param avatar 头像
|
||
* @param email 邮箱
|
||
* @param giteaOpenId Gitea Open ID
|
||
*/
|
||
public SysUser(String userId, String username, String nickname, String name,
|
||
String avatar, String email, String giteaOpenId) {
|
||
this.userId = userId;
|
||
this.username = username;
|
||
this.nickname = nickname;
|
||
this.name = name;
|
||
this.avatar = avatar;
|
||
this.email = email;
|
||
this.giteaOpenId = giteaOpenId;
|
||
}
|
||
|
||
@Override
|
||
public String toString() {
|
||
return "SysUser{" +
|
||
"userId='" + userId + '\'' +
|
||
", username='" + username + '\'' +
|
||
", nickname='" + nickname + '\'' +
|
||
", name='" + name + '\'' +
|
||
", avatar='" + avatar + '\'' +
|
||
", email='" + email + '\'' +
|
||
", giteaOpenId='" + giteaOpenId + '\'' +
|
||
'}';
|
||
}
|
||
} |