root | ff0769a | 2025-05-18 17:24:41 +0000 | [diff] [blame] | 1 | package entity; |
| 2 | |
| 3 | import javax.persistence.CascadeType; |
| 4 | import javax.persistence.Column; |
| 5 | import javax.persistence.Entity; |
| 6 | import javax.persistence.FetchType; |
| 7 | import javax.persistence.Id; |
| 8 | import javax.persistence.OneToOne; |
| 9 | import javax.persistence.Table; |
| 10 | import javax.persistence.Transient; |
root | ff0769a | 2025-05-18 17:24:41 +0000 | [diff] [blame] | 11 | import com.querydsl.core.annotations.QueryEntity; |
| 12 | |
| 13 | @QueryEntity |
root | 33a7d95 | 2025-05-18 17:24:41 +0000 | [diff] [blame] | 14 | @Entity(name = "User") |
root | ff0769a | 2025-05-18 17:24:41 +0000 | [diff] [blame] | 15 | @Table(name = "User") |
| 16 | public class User { |
| 17 | @Id |
| 18 | @Column(name = "user_id", length = 36, nullable = false) |
root | f35409f | 2025-05-19 04:41:57 +0000 | [diff] [blame] | 19 | public String userid; |
root | ff0769a | 2025-05-18 17:24:41 +0000 | [diff] [blame] | 20 | @Column(name = "email", nullable = false, length = 255, unique = true) |
root | f35409f | 2025-05-19 04:41:57 +0000 | [diff] [blame] | 21 | public String email; |
root | ff0769a | 2025-05-18 17:24:41 +0000 | [diff] [blame] | 22 | @Column(name = "username", length = 100, nullable = false) |
| 23 | public String username; |
root | ff0769a | 2025-05-18 17:24:41 +0000 | [diff] [blame] | 24 | @Column(name = "password", length = 255, nullable = false) |
| 25 | public String password; |
root | ff0769a | 2025-05-18 17:24:41 +0000 | [diff] [blame] | 26 | @Column(name = "gender", nullable = false) |
| 27 | public String sex; |
root | ff0769a | 2025-05-18 17:24:41 +0000 | [diff] [blame] | 28 | @Transient |
| 29 | public String age; |
root | ff0769a | 2025-05-18 17:24:41 +0000 | [diff] [blame] | 30 | @Column(name = "school") |
| 31 | public String school; |
root | ff0769a | 2025-05-18 17:24:41 +0000 | [diff] [blame] | 32 | @Column(name = "avatar_url") |
| 33 | public String pictureurl; |
root | ff0769a | 2025-05-18 17:24:41 +0000 | [diff] [blame] | 34 | @Column(name = "bio") |
| 35 | public String profile; |
root | ff0769a | 2025-05-18 17:24:41 +0000 | [diff] [blame] | 36 | @Column(name = "account_status", nullable = false) |
| 37 | public boolean accountstate; |
root | ff0769a | 2025-05-18 17:24:41 +0000 | [diff] [blame] | 38 | @Column(name = "invite_left", nullable = false) |
| 39 | public int invitetimes; |
root | ff0769a | 2025-05-18 17:24:41 +0000 | [diff] [blame] | 40 | @OneToOne(mappedBy = "user", cascade = CascadeType.ALL, fetch = FetchType.LAZY, optional = false) |
| 41 | public UserPT userPT; |
| 42 | |
| 43 | // Constructors, getters, setters |
root | 33a7d95 | 2025-05-18 17:24:41 +0000 | [diff] [blame] | 44 | public User() { |
| 45 | } |
| 46 | } |