- UserInfo实体类删除nickname字段 - UserInfoService.loginOrRegister使用username - UserController删除nickname相关代码 - 前端所有页面统一使用username - auth-modal.vue登录时使用username
90 lines
2.6 KiB
Java
90 lines
2.6 KiB
Java
package xuan.entity;
|
|
|
|
import javax.persistence.*;
|
|
import java.time.LocalDateTime;
|
|
|
|
@Entity
|
|
@Table(name = "user_info")
|
|
public class UserInfo {
|
|
|
|
@Id
|
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
private Long id;
|
|
|
|
@Column(nullable = false, unique = true, length = 64)
|
|
private String openId;
|
|
|
|
@Column(length = 255)
|
|
private String avatarUrl;
|
|
|
|
@Column(length = 50)
|
|
private String username;
|
|
|
|
@Column(length = 20)
|
|
private String userId;
|
|
|
|
@Column(length = 20)
|
|
private String phone;
|
|
|
|
private Integer vipLevel;
|
|
|
|
@Column(columnDefinition = "INT DEFAULT 3")
|
|
private Integer coins;
|
|
|
|
private Integer streakDays;
|
|
|
|
@Column(nullable = false, updatable = false)
|
|
private LocalDateTime createTime;
|
|
|
|
private LocalDateTime updateTime;
|
|
|
|
@PrePersist
|
|
protected void onCreate() {
|
|
createTime = LocalDateTime.now();
|
|
updateTime = createTime;
|
|
vipLevel = 0;
|
|
if (coins == null) {
|
|
coins = 3;
|
|
}
|
|
streakDays = 0;
|
|
}
|
|
|
|
@PreUpdate
|
|
protected void onUpdate() {
|
|
updateTime = LocalDateTime.now();
|
|
}
|
|
|
|
public Long getId() { return id; }
|
|
public void setId(Long id) { this.id = id; }
|
|
|
|
public String getOpenId() { return openId; }
|
|
public void setOpenId(String openId) { this.openId = openId; }
|
|
|
|
public String getAvatarUrl() { return avatarUrl; }
|
|
public void setAvatarUrl(String avatarUrl) { this.avatarUrl = avatarUrl; }
|
|
|
|
public String getUsername() { return username; }
|
|
public void setUsername(String username) { this.username = username; }
|
|
|
|
public String getUserId() { return userId; }
|
|
public void setUserId(String userId) { this.userId = userId; }
|
|
|
|
public String getPhone() { return phone; }
|
|
public void setPhone(String phone) { this.phone = phone; }
|
|
|
|
public Integer getVipLevel() { return vipLevel; }
|
|
public void setVipLevel(Integer vipLevel) { this.vipLevel = vipLevel; }
|
|
|
|
public Integer getCoins() { return coins; }
|
|
public void setCoins(Integer coins) { this.coins = coins; }
|
|
|
|
public Integer getStreakDays() { return streakDays; }
|
|
public void setStreakDays(Integer streakDays) { this.streakDays = streakDays; }
|
|
|
|
public LocalDateTime getCreateTime() { return createTime; }
|
|
public void setCreateTime(LocalDateTime createTime) { this.createTime = createTime; }
|
|
|
|
public LocalDateTime getUpdateTime() { return updateTime; }
|
|
public void setUpdateTime(LocalDateTime updateTime) { this.updateTime = updateTime; }
|
|
}
|