/src/com/jieshuhuiyou/entity/User.java
Java | 338 lines | 246 code | 86 blank | 6 comment | 13 complexity | e0f42827219473a58905924327b43626 MD5 | raw file
- package com.jieshuhuiyou.entity;
- import java.io.Serializable;
- import java.util.Date;
- import javax.persistence.Column;
- import javax.persistence.Entity;
- import javax.persistence.GeneratedValue;
- import javax.persistence.Id;
- import javax.persistence.ManyToOne;
- import org.apache.struts2.json.annotations.JSON;
- import com.alibaba.fastjson.annotation.JSONField;
- import com.jieshuhuiyou.Config;
- /**
- * ???
- * @author psjay
- *
- */
- @Entity
- public class User implements Serializable {
- private static final long serialVersionUID = -2883585313597518351L;
-
- @Id
- @GeneratedValue
- private int id; //ID
-
- private String name; //??
-
- @Column(length = 100, nullable = false)
- private String email; //??
- @Column(length = 32, nullable = false)
- private String password; //??+salt?MD5?
-
- @Column(length = 16, nullable = false)
- private String passwordSalt;//salt(MD5)
-
- @Column(length = 15)
- private String qq; //QQ??
-
- @Column(length = 15)
- private String phoneNumber; //????
-
- private String smallAvatar; //???
-
- private String largeAvatar; // ???
-
- @ManyToOne
- private School school; //??
-
- @Column(length = 200)
- private String description; //????
-
- @Column(columnDefinition = "timestamp not null default current_timestamp")
- private Date signUpDate; //????
-
- @Column(nullable = false)
- private boolean isBlock = false; //????????
-
- @Column(nullable = false)
- private int integral = Config.INTEGRAL_DEFAULT_NUM; //??
- @Column(nullable = false)
- private float credit = 0; //??
-
- @Column(nullable = false)
- private int evalutedNum = 0; //????????????
-
- private int sharingCount; //????
-
- private int borrowedCount; //????
-
- private int receivedBorrowRequestsCount; // ????????
-
- private int sendedBorrowRequestsCount; //????????
-
- private int borrowingCount; // ????
-
- private int reviewsCount; // ????
-
- private int followingBookCount; //??????
-
- private int followingUserCount; //??????
-
- private int followersCount; // ??????
-
- public User() {
-
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- User other = (User) obj;
- if (email == null) {
- if (other.email != null)
- return false;
- } else if (!email.equals(other.email))
- return false;
- return true;
- }
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((email == null) ? 0 : email.hashCode());
- return result;
- }
-
- // setters and getters
- @JSONField(serialize = false)
- public int getBorrowedCount() {
- return borrowedCount;
- }
-
- @JSONField(serialize = false)
- @JSON(serialize = false)
- public String getDescription() {
- return description;
- }
-
- @JSONField(serialize = false)
- @JSON(serialize = false)
- public String getEmail() {
- return email;
- }
-
- public int getId() {
- return id;
- }
- public void setId(int id) {
- this.id = id;
- }
- public String getLargeAvatar() {
- return largeAvatar;
- }
- public String getName() {
- return name;
- }
-
- @JSONField(serialize = false)
- @JSON(serialize = false)
- public String getPassword() {
- return password;
- }
-
- @JSONField(serialize = false)
- @JSON(serialize = false)
- public String getPasswordSalt() {
- return passwordSalt;
- }
- public String getPhoneNumber() {
- return phoneNumber;
- }
- public String getQq() {
- return qq;
- }
-
- @JSONField(serialize = false)
- public int getSharingCount() {
- return sharingCount;
- }
-
- @JSONField(serialize = false)
- @JSON(serialize = false)
- public Date getSignUpDate() {
- return signUpDate;
- }
- @JSONField(serialize = false)
- public int getEvalutedNum() {
- return evalutedNum;
- }
- public void setEvalutedNum(int evalutedNum) {
- this.evalutedNum = evalutedNum;
- }
-
- public String getSmallAvatar() {
- return smallAvatar;
- }
- public School getSchool() {
- return school;
- }
- public void setBorrowedCount(int borrowedCount) {
- this.borrowedCount = borrowedCount;
- }
- public void setDescription(String description) {
- this.description = description;
- }
- public void setEmail(String email) {
- this.email = email;
- }
- public void setLargeAvatar(String largeAvatar) {
- this.largeAvatar = largeAvatar;
- }
- public void setName(String name) {
- this.name = name;
- }
- public void setPassword(String password) {
- this.password = password;
- }
- public void setPasswordSalt(String passwordSalt) {
- this.passwordSalt = passwordSalt;
- }
- public void setPhoneNumber(String phoneNumber) {
- this.phoneNumber = phoneNumber;
- }
- public void setQq(String qq) {
- this.qq = qq;
- }
- public void setSharingCount(int sharingCount) {
- this.sharingCount = sharingCount;
- }
-
- public void setSignUpDate(Date signUpDate) {
- this.signUpDate = signUpDate;
- }
- public void setSmallAvatar(String smallAvatar) {
- this.smallAvatar = smallAvatar;
- }
-
- @JSONField(serialize = false)
- public int getReceivedBorrowRequestsCount() {
- return receivedBorrowRequestsCount;
- }
- public void setReceivedBorrowRequestsCount(int receivedBorrowRequestsCount) {
- this.receivedBorrowRequestsCount = receivedBorrowRequestsCount;
- }
-
- @JSONField(serialize = false)
- public int getSendedBorrowRequestsCount() {
- return sendedBorrowRequestsCount;
- }
- public void setSendedBorrowRequestsCount(int sendedBorrowRequestsCount) {
- this.sendedBorrowRequestsCount = sendedBorrowRequestsCount;
- }
-
- @JSONField(serialize = false)
- public int getBorrowingCount() {
- return borrowingCount;
- }
- public void setBorrowingCount(int borrowingCount) {
- this.borrowingCount = borrowingCount;
- }
- public void setSchool(School school) {
- this.school = school;
- }
-
- @JSONField(serialize = false)
- public int getReviewsCount() {
- return reviewsCount;
- }
- public void setReviewsCount(int reviewsCount) {
- this.reviewsCount = reviewsCount;
- }
- public int getFollowingBookCount() {
- return followingBookCount;
- }
- public void setFollowingBookCount(int followingBookCount) {
- this.followingBookCount = followingBookCount;
- }
- public int getFollowingUserCount() {
- return followingUserCount;
- }
- public void setFollowingUserCount(int followingUserCount) {
- this.followingUserCount = followingUserCount;
- }
- public int getFollowersCount() {
- return followersCount;
- }
- public void setFollowersCount(int followersCount) {
- this.followersCount = followersCount;
- }
-
- public int getIntegral() {
- return integral;
- }
- public void setIntegral(int integral) {
- this.integral = integral;
- }
- public float getCredit() {
- return credit;
- }
- public void setCredit(float f) {
- this.credit = f;
- }
- public boolean isBlock() {
- return isBlock;
- }
- public void setBlock(boolean isBlock) {
- this.isBlock = isBlock;
- }
- }