blob: 2a0e9468deae0e00a8ff1d93f40bc91ca1eb1225 [file] [log] [blame]
Krishyab0cc1882025-06-09 10:54:09 +08001package com.example.myproject.entity;
223011385e9c35a2025-06-04 15:52:45 +08002
Krishyab0cc1882025-06-09 10:54:09 +08003import javax.persistence.*;
Jinf50fba62025-06-09 22:47:24 +08004import java.math.BigDecimal;
Krishyab0cc1882025-06-09 10:54:09 +08005import java.util.Date;
223011385e9c35a2025-06-04 15:52:45 +08006
Krishyab0cc1882025-06-09 10:54:09 +08007@Entity
8@Table(name = "user")
9public class Users {
223011385e9c35a2025-06-04 15:52:45 +080010
Krishyab0cc1882025-06-09 10:54:09 +080011 @Id
12 @GeneratedValue(strategy = GenerationType.IDENTITY)
13 @Column(name = "user_id")
14 private Long userId;
223011385e9c35a2025-06-04 15:52:45 +080015
Krishyab0cc1882025-06-09 10:54:09 +080016 @Column(name = "username", nullable = false,unique = true)
17 private String username;
223011385e9c35a2025-06-04 15:52:45 +080018
Krishyab0cc1882025-06-09 10:54:09 +080019 @Column(name = "avatar_url", nullable = true)
20 private String avatarUrl;
223011385e9c35a2025-06-04 15:52:45 +080021
Krishyab0cc1882025-06-09 10:54:09 +080022 @Column(name = "email", nullable = false)
23 private String email;
223011385e9c35a2025-06-04 15:52:45 +080024
Krishyab0cc1882025-06-09 10:54:09 +080025 @Column(name = "password", nullable = false)
26 private String password;
223011385e9c35a2025-06-04 15:52:45 +080027
Krishyab0cc1882025-06-09 10:54:09 +080028 @Column(name = "role", nullable = false)
29 private String role;
223011385e9c35a2025-06-04 15:52:45 +080030
Krishyab0cc1882025-06-09 10:54:09 +080031 @Column(name = "invite_count")
32 private Integer inviteCount;
223011385e9c35a2025-06-04 15:52:45 +080033
Krishyab0cc1882025-06-09 10:54:09 +080034 @Column(name = "level", nullable = false)
35 private Long level;
223011385e9c35a2025-06-04 15:52:45 +080036
Krishyab0cc1882025-06-09 10:54:09 +080037 @Column(name = "upload_count")
Jinf50fba62025-06-09 22:47:24 +080038 private Float uploadCount= 0f;
223011385e9c35a2025-06-04 15:52:45 +080039
Krishyab0cc1882025-06-09 10:54:09 +080040 @Column(name = "download_count")
Jinf50fba62025-06-09 22:47:24 +080041 private Float downloadCount= 0f;
223011385e9c35a2025-06-04 15:52:45 +080042
Krishyab0cc1882025-06-09 10:54:09 +080043 @Column(name = "share_rate")
44 private Float shareRate;
223011385e9c35a2025-06-04 15:52:45 +080045
Krishyab0cc1882025-06-09 10:54:09 +080046 @Column(name = "registration_date", nullable = false)
47 private Date registrationDate;
223011385e9c35a2025-06-04 15:52:45 +080048
Krishyab0cc1882025-06-09 10:54:09 +080049 @Column(name = "last_login_time")
50 private Date lastLoginTime;
223011385e9c35a2025-06-04 15:52:45 +080051
Krishyab0cc1882025-06-09 10:54:09 +080052 @Column(name = "user_points")
53 private Integer userPoints;
223011385e9c35a2025-06-04 15:52:45 +080054
Krishyab0cc1882025-06-09 10:54:09 +080055 @Column(name = "is_promo")
56 private Boolean isPromo;
223011385e9c35a2025-06-04 15:52:45 +080057
Krishyab0cc1882025-06-09 10:54:09 +080058 @Column(name = "current_experience", nullable = false)
59 private Integer currentExperience; // 当前经验值
223011385e9c35a2025-06-04 15:52:45 +080060
Krishyab0cc1882025-06-09 10:54:09 +080061 @Column(name = "current_seeding_hours", nullable = false)
62 private Float currentSeedingHours; // 当前做种时长
223011385e9c35a2025-06-04 15:52:45 +080063
Krishyab0cc1882025-06-09 10:54:09 +080064 @Column(name = "gender", nullable = true)
65 private String gender; // 性别
223011385e9c35a2025-06-04 15:52:45 +080066
Krishyab0cc1882025-06-09 10:54:09 +080067 @Column(name = "description", nullable = true)
68 private String description; // 个人描述
223011385e9c35a2025-06-04 15:52:45 +080069
Krishyab0cc1882025-06-09 10:54:09 +080070 @Column(name = "hobbies", nullable = true)
71 private String hobbies;
223011385e9c35a2025-06-04 15:52:45 +080072
Krishyab0cc1882025-06-09 10:54:09 +080073 @Column(name = "registration_time", nullable = false, updatable = false)
74 @Temporal(TemporalType.TIMESTAMP)
75 private Date registrationTime;
223011385e9c35a2025-06-04 15:52:45 +080076
Krishyab0cc1882025-06-09 10:54:09 +080077 // 新增的lastupdatetime字段
78 @Column(name = "lastupdatetime")
79 private Date lastupdatetime;
223011385e9c35a2025-06-04 15:52:45 +080080
Jinf50fba62025-06-09 22:47:24 +080081 @Column(nullable = false,precision = 10, scale = 2)
82 private BigDecimal money;
83 @Column(name = "status")
84 private Integer status;// 用户状态,0: 正常 1 封禁 2 怀疑用户
Jin80d879a2025-06-09 20:53:18 +080085
Krishyab0cc1882025-06-09 10:54:09 +080086 // Getters and Setters
Jinf50fba62025-06-09 22:47:24 +080087 public BigDecimal getMoney() {
Jin80d879a2025-06-09 20:53:18 +080088 return money;
89 }
Jinf50fba62025-06-09 22:47:24 +080090 public void setMoney(BigDecimal money) {
Jin80d879a2025-06-09 20:53:18 +080091 this.money = money;
92 }
93
Krishyab0cc1882025-06-09 10:54:09 +080094 public Long getUserId() {
95 return userId;
96 }
223011385e9c35a2025-06-04 15:52:45 +080097
Krishyab0cc1882025-06-09 10:54:09 +080098 public void setUserId(Long userId) {
99 this.userId = userId;
100 }
223011385e9c35a2025-06-04 15:52:45 +0800101
Krishyab0cc1882025-06-09 10:54:09 +0800102 public String getUsername() {
103 return username;
104 }
223011385e9c35a2025-06-04 15:52:45 +0800105
Krishyab0cc1882025-06-09 10:54:09 +0800106 public void setUsername(String username) {
107 this.username = username;
108 }
223011385e9c35a2025-06-04 15:52:45 +0800109
Krishyab0cc1882025-06-09 10:54:09 +0800110 public String getAvatarUrl() {
111 return avatarUrl;
112 }
223011385e9c35a2025-06-04 15:52:45 +0800113
Krishyab0cc1882025-06-09 10:54:09 +0800114 public void setAvatarUrl(String avatarUrl) {
115 this.avatarUrl = avatarUrl;
116 }
223011385e9c35a2025-06-04 15:52:45 +0800117
Krishyab0cc1882025-06-09 10:54:09 +0800118 public String getEmail() {
119 return email;
120 }
223011385e9c35a2025-06-04 15:52:45 +0800121
Krishyab0cc1882025-06-09 10:54:09 +0800122 public void setEmail(String email) {
123 this.email = email;
124 }
223011385e9c35a2025-06-04 15:52:45 +0800125
Krishyab0cc1882025-06-09 10:54:09 +0800126 public String getPassword() {
127 return password;
128 }
223011385e9c35a2025-06-04 15:52:45 +0800129
Krishyab0cc1882025-06-09 10:54:09 +0800130 public void setPassword(String password) {
131 this.password = password;
132 }
223011385e9c35a2025-06-04 15:52:45 +0800133
Krishyab0cc1882025-06-09 10:54:09 +0800134 public String getRole() {
135 return role;
136 }
223011385e9c35a2025-06-04 15:52:45 +0800137
Krishyab0cc1882025-06-09 10:54:09 +0800138 public void setRole(String role) {
139 this.role = role;
140 }
223011385e9c35a2025-06-04 15:52:45 +0800141
Krishyab0cc1882025-06-09 10:54:09 +0800142 public Integer getInviteCount() {
143 return inviteCount;
144 }
145
146 public void setInviteCount(Integer inviteCount) {
147 this.inviteCount = inviteCount;
148 }
223011385e9c35a2025-06-04 15:52:45 +0800149
Krishyab0cc1882025-06-09 10:54:09 +0800150 public Long getLevel() {
151 return level;
152 }
223011385e9c35a2025-06-04 15:52:45 +0800153
Krishyab0cc1882025-06-09 10:54:09 +0800154 public void setLevel(Long level) {
155 this.level = level;
156 }
223011385e9c35a2025-06-04 15:52:45 +0800157
Krishyab0cc1882025-06-09 10:54:09 +0800158 public Float getUploadCount() {
159 return uploadCount;
160 }
223011385e9c35a2025-06-04 15:52:45 +0800161
Krishyab0cc1882025-06-09 10:54:09 +0800162 public void setUploadCount(Float uploadCount) {
163 this.uploadCount = uploadCount;
164 }
223011385e9c35a2025-06-04 15:52:45 +0800165
Krishyab0cc1882025-06-09 10:54:09 +0800166 public Float getDownloadCount() {
167 return downloadCount;
168 }
223011385e9c35a2025-06-04 15:52:45 +0800169
Krishyab0cc1882025-06-09 10:54:09 +0800170 public void setDownloadCount(Float downloadCount) {
171 this.downloadCount = downloadCount;
172 }
223011385e9c35a2025-06-04 15:52:45 +0800173
Krishyab0cc1882025-06-09 10:54:09 +0800174 public Float getShareRate() {
175 return shareRate;
176 }
223011385e9c35a2025-06-04 15:52:45 +0800177
Krishyab0cc1882025-06-09 10:54:09 +0800178 public void setShareRate(Float shareRate) {
179 this.shareRate = shareRate;
180 }
223011385e9c35a2025-06-04 15:52:45 +0800181
Krishyab0cc1882025-06-09 10:54:09 +0800182 public Date getRegistrationDate() {
183 return registrationDate;
184 }
223011385e9c35a2025-06-04 15:52:45 +0800185
Krishyab0cc1882025-06-09 10:54:09 +0800186 public void setRegistrationDate(Date registrationDate) {
187 this.registrationDate = registrationDate;
188 }
223011385e9c35a2025-06-04 15:52:45 +0800189
Krishyab0cc1882025-06-09 10:54:09 +0800190 public Date getLastLoginTime() {
191 return lastLoginTime;
192 }
223011385e9c35a2025-06-04 15:52:45 +0800193
Krishyab0cc1882025-06-09 10:54:09 +0800194 public void setLastLoginTime(Date lastLoginTime) {
195 this.lastLoginTime = lastLoginTime;
196 }
223011385e9c35a2025-06-04 15:52:45 +0800197
Krishyab0cc1882025-06-09 10:54:09 +0800198 public Integer getUserPoints() {
199 return userPoints;
200 }
223011385e9c35a2025-06-04 15:52:45 +0800201
Krishyab0cc1882025-06-09 10:54:09 +0800202 public void setUserPoints(Integer userPoints) {
203 this.userPoints = userPoints;
204 }
223011385e9c35a2025-06-04 15:52:45 +0800205
Krishyab0cc1882025-06-09 10:54:09 +0800206 public Boolean getIsPromo() {
207 return isPromo;
208 }
223011385e9c35a2025-06-04 15:52:45 +0800209
Krishyab0cc1882025-06-09 10:54:09 +0800210 public void setIsPromo(Boolean isPromo) {
211 this.isPromo = isPromo;
212 }
223011385e9c35a2025-06-04 15:52:45 +0800213
Krishyab0cc1882025-06-09 10:54:09 +0800214 public Integer getCurrentExperience() {
215 return currentExperience;
216 }
223011385e9c35a2025-06-04 15:52:45 +0800217
Krishyab0cc1882025-06-09 10:54:09 +0800218 public void setCurrentExperience(Integer currentExperience) {
219 this.currentExperience = currentExperience;
220 }
223011385e9c35a2025-06-04 15:52:45 +0800221
Krishyab0cc1882025-06-09 10:54:09 +0800222 public Float getCurrentSeedingHours() {
223 return currentSeedingHours;
224 }
223011385e9c35a2025-06-04 15:52:45 +0800225
Krishyab0cc1882025-06-09 10:54:09 +0800226 public void setCurrentSeedingHours(Float currentSeedingHours) {
227 this.currentSeedingHours = currentSeedingHours;
228 }
223011385e9c35a2025-06-04 15:52:45 +0800229
Krishyab0cc1882025-06-09 10:54:09 +0800230 public String getGender() {
231 return gender;
232 }
223011385e9c35a2025-06-04 15:52:45 +0800233
Krishyab0cc1882025-06-09 10:54:09 +0800234 public void setGender(String gender) {
235 this.gender = gender;
236 }
223011385e9c35a2025-06-04 15:52:45 +0800237
Krishyab0cc1882025-06-09 10:54:09 +0800238 public String getDescription() {
239 return description;
240 }
223011385e9c35a2025-06-04 15:52:45 +0800241
Krishyab0cc1882025-06-09 10:54:09 +0800242 public void setDescription(String description) {
243 this.description = description;
244 }
223011385e9c35a2025-06-04 15:52:45 +0800245
Krishyab0cc1882025-06-09 10:54:09 +0800246 public String getHobbies() {
247 return hobbies;
248 }
223011385e9c35a2025-06-04 15:52:45 +0800249
Krishyab0cc1882025-06-09 10:54:09 +0800250 public void setHobbies(String hobbies) {
251 this.hobbies = hobbies;
252 }
223011385e9c35a2025-06-04 15:52:45 +0800253
Krishyab0cc1882025-06-09 10:54:09 +0800254 public Date getRegistrationTime() {
255 return registrationTime;
256 }
223011385e9c35a2025-06-04 15:52:45 +0800257
Krishyab0cc1882025-06-09 10:54:09 +0800258 public void setRegistrationTime(Date registrationTime) {
259 this.registrationTime = registrationTime;
260 }
223011385e9c35a2025-06-04 15:52:45 +0800261
Krishyab0cc1882025-06-09 10:54:09 +0800262 // 新增的lastupdatetime的getter和setter方法
263 public Date getLastupdatetime() {
264 return lastupdatetime;
265 }
223011385e9c35a2025-06-04 15:52:45 +0800266
Krishyab0cc1882025-06-09 10:54:09 +0800267 public void setLastupdatetime(Date lastupdatetime) {
268 this.lastupdatetime = lastupdatetime;
269 }
Jinf50fba62025-06-09 22:47:24 +0800270
271 public String getLevelRole() {
272 return switch (this.level.intValue()) {
273 case 1 -> "candy";
274 case 2 -> "cookie";
275 case 3 -> "chocolate";
276 case 4 -> "ice-cream";
277 default -> null;
278 };
279 }
Krishyab0cc1882025-06-09 10:54:09 +0800280}