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; |
| 11 | |
| 12 | import com.querydsl.core.annotations.QueryEntity; |
| 13 | |
| 14 | @QueryEntity |
| 15 | @Entity(name="User") |
| 16 | @Table(name = "User") |
| 17 | public class User { |
| 18 | @Id |
| 19 | @Column(name = "user_id", length = 36, nullable = false) |
| 20 | private String userid; |
| 21 | |
| 22 | @Column(name = "email", nullable = false, length = 255, unique = true) |
| 23 | private String email; |
| 24 | |
| 25 | @Column(name = "username", length = 100, nullable = false) |
| 26 | public String username; |
| 27 | |
| 28 | @Column(name = "password", length = 255, nullable = false) |
| 29 | public String password; |
| 30 | |
| 31 | @Column(name = "gender", nullable = false) |
| 32 | public String sex; |
| 33 | |
| 34 | @Transient |
| 35 | public String age; |
| 36 | |
| 37 | @Column(name = "school") |
| 38 | public String school; |
| 39 | |
| 40 | @Column(name = "avatar_url") |
| 41 | public String pictureurl; |
| 42 | |
| 43 | @Column(name = "bio") |
| 44 | public String profile; |
| 45 | |
| 46 | @Column(name = "account_status", nullable = false) |
| 47 | public boolean accountstate; |
| 48 | |
| 49 | @Column(name = "invite_left", nullable = false) |
| 50 | public int invitetimes; |
| 51 | |
| 52 | @OneToOne(mappedBy = "user", cascade = CascadeType.ALL, fetch = FetchType.LAZY, optional = false) |
| 53 | public UserPT userPT; |
| 54 | |
| 55 | // Constructors, getters, setters |
| 56 | public User() {} |
| 57 | } |