Files
webgame-backend/src/main/java/com/webgame/webgamebackend/entities/UserEntity.java
2026-06-22 11:19:19 +08:00

84 lines
1.8 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.webgame.webgamebackend.entities;
import com.webgame.webgamebackend.entities.base.UUIDBaseEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.OneToOne;
import jakarta.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
import java.time.LocalDate;
/**
* 用户实体,与 AccountEntity 一对一关联
*/
@Entity
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@Table(name = "user")
public class UserEntity extends UUIDBaseEntity {
/**
* 关联的账号
*/
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "account_id", referencedColumnName = "id", unique = true)
private AccountEntity account;
/**
* 昵称
*/
@Column(name = "nick_name", length = 16, nullable = false)
private String nickName;
/**
* 头像
*/
@Column(name = "avatar", length = 512)
private String avatar;
/**
* 个性签名
*/
@Column(name = "signature", length = 64)
private String signature;
/**
* 年龄
*/
@Column(name = "age")
private Integer age;
/**
* 性别 1男 2女
*/
@Column(name = "sex", length = 1)
private Integer sex;
/**
* 生日
*/
@Column(name = "birthday")
private LocalDate birthday;
/**
* 金币余额,默认 1000
*/
@Column(name = "balance", nullable = false)
private Long balance = 1000L;
/**
* 在线状态ONLINE / AWAY / DND / INVISIBLE默认 ONLINE
*/
@Column(name = "status", length = 16, nullable = false)
private String status = "ONLINE";
}