Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 1 | package com.example.myproject.entity; |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 2 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 3 | import javax.persistence.*; |
Jin | f50fba6 | 2025-06-09 22:47:24 +0800 | [diff] [blame^] | 4 | import java.math.BigDecimal; |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 5 | import java.util.Date; |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 6 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 7 | @Entity |
| 8 | @Table(name = "user") |
| 9 | public class Users { |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 10 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 11 | @Id |
| 12 | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| 13 | @Column(name = "user_id") |
| 14 | private Long userId; |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 15 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 16 | @Column(name = "username", nullable = false,unique = true) |
| 17 | private String username; |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 18 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 19 | @Column(name = "avatar_url", nullable = true) |
| 20 | private String avatarUrl; |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 21 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 22 | @Column(name = "email", nullable = false) |
| 23 | private String email; |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 24 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 25 | @Column(name = "password", nullable = false) |
| 26 | private String password; |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 27 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 28 | @Column(name = "role", nullable = false) |
| 29 | private String role; |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 30 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 31 | @Column(name = "invite_count") |
| 32 | private Integer inviteCount; |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 33 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 34 | @Column(name = "level", nullable = false) |
| 35 | private Long level; |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 36 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 37 | @Column(name = "upload_count") |
Jin | f50fba6 | 2025-06-09 22:47:24 +0800 | [diff] [blame^] | 38 | private Float uploadCount= 0f; |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 39 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 40 | @Column(name = "download_count") |
Jin | f50fba6 | 2025-06-09 22:47:24 +0800 | [diff] [blame^] | 41 | private Float downloadCount= 0f; |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 42 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 43 | @Column(name = "share_rate") |
| 44 | private Float shareRate; |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 45 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 46 | @Column(name = "registration_date", nullable = false) |
| 47 | private Date registrationDate; |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 48 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 49 | @Column(name = "last_login_time") |
| 50 | private Date lastLoginTime; |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 51 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 52 | @Column(name = "user_points") |
| 53 | private Integer userPoints; |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 54 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 55 | @Column(name = "is_promo") |
| 56 | private Boolean isPromo; |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 57 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 58 | @Column(name = "current_experience", nullable = false) |
| 59 | private Integer currentExperience; // 当前经验值 |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 60 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 61 | @Column(name = "current_seeding_hours", nullable = false) |
| 62 | private Float currentSeedingHours; // 当前做种时长 |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 63 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 64 | @Column(name = "gender", nullable = true) |
| 65 | private String gender; // 性别 |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 66 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 67 | @Column(name = "description", nullable = true) |
| 68 | private String description; // 个人描述 |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 69 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 70 | @Column(name = "hobbies", nullable = true) |
| 71 | private String hobbies; |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 72 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 73 | @Column(name = "registration_time", nullable = false, updatable = false) |
| 74 | @Temporal(TemporalType.TIMESTAMP) |
| 75 | private Date registrationTime; |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 76 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 77 | // 新增的lastupdatetime字段 |
| 78 | @Column(name = "lastupdatetime") |
| 79 | private Date lastupdatetime; |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 80 | |
Jin | f50fba6 | 2025-06-09 22:47:24 +0800 | [diff] [blame^] | 81 | @Column(nullable = false,precision = 10, scale = 2) |
| 82 | private BigDecimal money; |
| 83 | @Column(name = "status") |
| 84 | private Integer status;// 用户状态,0: 正常 1 封禁 2 怀疑用户 |
Jin | 80d879a | 2025-06-09 20:53:18 +0800 | [diff] [blame] | 85 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 86 | // Getters and Setters |
Jin | f50fba6 | 2025-06-09 22:47:24 +0800 | [diff] [blame^] | 87 | public BigDecimal getMoney() { |
Jin | 80d879a | 2025-06-09 20:53:18 +0800 | [diff] [blame] | 88 | return money; |
| 89 | } |
Jin | f50fba6 | 2025-06-09 22:47:24 +0800 | [diff] [blame^] | 90 | public void setMoney(BigDecimal money) { |
Jin | 80d879a | 2025-06-09 20:53:18 +0800 | [diff] [blame] | 91 | this.money = money; |
| 92 | } |
| 93 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 94 | public Long getUserId() { |
| 95 | return userId; |
| 96 | } |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 97 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 98 | public void setUserId(Long userId) { |
| 99 | this.userId = userId; |
| 100 | } |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 101 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 102 | public String getUsername() { |
| 103 | return username; |
| 104 | } |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 105 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 106 | public void setUsername(String username) { |
| 107 | this.username = username; |
| 108 | } |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 109 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 110 | public String getAvatarUrl() { |
| 111 | return avatarUrl; |
| 112 | } |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 113 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 114 | public void setAvatarUrl(String avatarUrl) { |
| 115 | this.avatarUrl = avatarUrl; |
| 116 | } |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 117 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 118 | public String getEmail() { |
| 119 | return email; |
| 120 | } |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 121 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 122 | public void setEmail(String email) { |
| 123 | this.email = email; |
| 124 | } |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 125 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 126 | public String getPassword() { |
| 127 | return password; |
| 128 | } |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 129 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 130 | public void setPassword(String password) { |
| 131 | this.password = password; |
| 132 | } |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 133 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 134 | public String getRole() { |
| 135 | return role; |
| 136 | } |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 137 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 138 | public void setRole(String role) { |
| 139 | this.role = role; |
| 140 | } |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 141 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 142 | public Integer getInviteCount() { |
| 143 | return inviteCount; |
| 144 | } |
| 145 | |
| 146 | public void setInviteCount(Integer inviteCount) { |
| 147 | this.inviteCount = inviteCount; |
| 148 | } |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 149 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 150 | public Long getLevel() { |
| 151 | return level; |
| 152 | } |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 153 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 154 | public void setLevel(Long level) { |
| 155 | this.level = level; |
| 156 | } |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 157 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 158 | public Float getUploadCount() { |
| 159 | return uploadCount; |
| 160 | } |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 161 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 162 | public void setUploadCount(Float uploadCount) { |
| 163 | this.uploadCount = uploadCount; |
| 164 | } |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 165 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 166 | public Float getDownloadCount() { |
| 167 | return downloadCount; |
| 168 | } |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 169 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 170 | public void setDownloadCount(Float downloadCount) { |
| 171 | this.downloadCount = downloadCount; |
| 172 | } |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 173 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 174 | public Float getShareRate() { |
| 175 | return shareRate; |
| 176 | } |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 177 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 178 | public void setShareRate(Float shareRate) { |
| 179 | this.shareRate = shareRate; |
| 180 | } |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 181 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 182 | public Date getRegistrationDate() { |
| 183 | return registrationDate; |
| 184 | } |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 185 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 186 | public void setRegistrationDate(Date registrationDate) { |
| 187 | this.registrationDate = registrationDate; |
| 188 | } |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 189 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 190 | public Date getLastLoginTime() { |
| 191 | return lastLoginTime; |
| 192 | } |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 193 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 194 | public void setLastLoginTime(Date lastLoginTime) { |
| 195 | this.lastLoginTime = lastLoginTime; |
| 196 | } |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 197 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 198 | public Integer getUserPoints() { |
| 199 | return userPoints; |
| 200 | } |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 201 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 202 | public void setUserPoints(Integer userPoints) { |
| 203 | this.userPoints = userPoints; |
| 204 | } |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 205 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 206 | public Boolean getIsPromo() { |
| 207 | return isPromo; |
| 208 | } |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 209 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 210 | public void setIsPromo(Boolean isPromo) { |
| 211 | this.isPromo = isPromo; |
| 212 | } |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 213 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 214 | public Integer getCurrentExperience() { |
| 215 | return currentExperience; |
| 216 | } |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 217 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 218 | public void setCurrentExperience(Integer currentExperience) { |
| 219 | this.currentExperience = currentExperience; |
| 220 | } |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 221 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 222 | public Float getCurrentSeedingHours() { |
| 223 | return currentSeedingHours; |
| 224 | } |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 225 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 226 | public void setCurrentSeedingHours(Float currentSeedingHours) { |
| 227 | this.currentSeedingHours = currentSeedingHours; |
| 228 | } |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 229 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 230 | public String getGender() { |
| 231 | return gender; |
| 232 | } |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 233 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 234 | public void setGender(String gender) { |
| 235 | this.gender = gender; |
| 236 | } |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 237 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 238 | public String getDescription() { |
| 239 | return description; |
| 240 | } |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 241 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 242 | public void setDescription(String description) { |
| 243 | this.description = description; |
| 244 | } |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 245 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 246 | public String getHobbies() { |
| 247 | return hobbies; |
| 248 | } |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 249 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 250 | public void setHobbies(String hobbies) { |
| 251 | this.hobbies = hobbies; |
| 252 | } |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 253 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 254 | public Date getRegistrationTime() { |
| 255 | return registrationTime; |
| 256 | } |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 257 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 258 | public void setRegistrationTime(Date registrationTime) { |
| 259 | this.registrationTime = registrationTime; |
| 260 | } |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 261 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 262 | // 新增的lastupdatetime的getter和setter方法 |
| 263 | public Date getLastupdatetime() { |
| 264 | return lastupdatetime; |
| 265 | } |
22301138 | 5e9c35a | 2025-06-04 15:52:45 +0800 | [diff] [blame] | 266 | |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 267 | public void setLastupdatetime(Date lastupdatetime) { |
| 268 | this.lastupdatetime = lastupdatetime; |
| 269 | } |
Jin | f50fba6 | 2025-06-09 22:47:24 +0800 | [diff] [blame^] | 270 | |
| 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 | } |
Krishya | b0cc188 | 2025-06-09 10:54:09 +0800 | [diff] [blame] | 280 | } |