feat: 数据库实体基础
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user