package xyz.acmer.entity.user;

import javax.persistence.*;
import java.util.Date;

/**
 * 用户详细资料表
 * Created by hypo on 16-2-11.
 */
public class UserInfo {

    private Integer infoId;
    private User user;

    /**
     * 个人信息
     */
    private Date birthday;
    private String webSite;
    private String company;
    private String school;

    /**
     * tagLine：签名
     */
    private String tagLine;

    /**
     * 社交账号
     */
    private String github;
    private String psnId;
    private String steamId;
    private String telegram;
    private String twitter;
    private String codingNet;

    /**
     * info : 个人简介
     */
    private String info;

    /**
     * 提供订阅的feed
     */
    private String feedUrl;

    public UserInfo(User user, Date birthday, String webSite,
                    String company, String school, String tagLine,
                    String github, String psnId, String steamId,
                    String telegram, String twitter, String codingNet, String info, String feedUrl) {
        this.user = user;
        this.birthday = birthday;
        this.webSite = webSite;
        this.company = company;
        this.school = school;
        this.tagLine = tagLine;
        this.github = github;
        this.psnId = psnId;
        this.steamId = steamId;
        this.telegram = telegram;
        this.twitter = twitter;
        this.codingNet = codingNet;
        this.info = info;
        this.feedUrl = feedUrl;
    }

    @Id
    @GeneratedValue
    public Integer getInfoId() {
        return infoId;
    }

    public void setInfoId(Integer infoId) {
        this.infoId = infoId;
    }

    @ManyToOne(optional = false)
    @JoinColumn(name = "user")
    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    @Column(name = "birthday", columnDefinition = "DATE")
    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    @Column(name = "url", length = 50)
    public String getWebSite() {
        return webSite;
    }

    public void setWebSite(String webSite) {
        this.webSite = webSite;
    }

    @Column(name = "company", length = 60)
    public String getCompany() {
        return company;
    }

    public void setCompany(String company) {
        this.company = company;
    }

    @Column(name = "school", length = 60)
    public String getSchool() {
        return school;
    }

    public void setSchool(String school) {
        this.school = school;
    }

    @Column(name = "tagline")
    public String getTagLine() {
        return tagLine;
    }

    public void setTagLine(String tagLine) {
        this.tagLine = tagLine;
    }

    @Column(name = "github", length = 50)
    public String getGithub() {
        return github;
    }

    public void setGithub(String github) {
        this.github = github;
    }

    @Column(name = "psn", length = 50)
    public String getPsnId() {
        return psnId;
    }

    public void setPsnId(String psnId) {
        this.psnId = psnId;
    }

    @Column(name = "steam", length = 50)
    public String getSteamId() {
        return steamId;
    }

    public void setSteamId(String steamId) {
        this.steamId = steamId;
    }

    @Column(name = "telegram", length = 50)
    public String getTelegram() {
        return telegram;
    }

    public void setTelegram(String telegram) {
        this.telegram = telegram;
    }

    @Column(name = "twitter", length = 50)
    public String getTwitter() {
        return twitter;
    }

    public void setTwitter(String twitter) {
        this.twitter = twitter;
    }

    @Column(name = "coding", length = 50)
    public String getCodingNet() {
        return codingNet;
    }

    public void setCodingNet(String codingNet) {
        this.codingNet = codingNet;
    }

    public String getInfo() {
        return info;
    }

    @Column(name = "info", length = 500, columnDefinition = "TEXT")
    public void setInfo(String info) {
        this.info = info;
    }

    @Column(name = "feed")
    public String getFeedUrl() {
        return feedUrl;
    }

    public void setFeedUrl(String feedUrl) {
        this.feedUrl = feedUrl;
    }
}

@@ -127,16 +127,44 @@
 11.%0A */%0A
+@Entity(name = %22user_info%22)%0A
 public c
@@ -369,16 +369,43 @@
  school;
+%0A    private Date joinTime;
 %0A%0A    /*
@@ -814,709 +814,72 @@
 user
-, Date birthday, String webSite,%0A                    String company, String school, String tagLine,%0A                    String github, String psnId, String steamId,%0A                    String telegram, String twitter, String codingNet, String info, String feedUrl) %7B%0A        this.user = user;%0A        this.birthday = birthday;%0A        this.webSite = webSite;%0A        this.company = company;%0A        this.school = school;%0A        this.tagLine = tagLine;%0A        this.github = github;%0A        this.psnId = psnId;%0A        this.steamId = steamId;%0A        this.telegram = telegram;%0A        this.twitter = twitter;%0A        this.codingNet = codingNet;%0A        this.info = info;%0A        this.feedUrl = feedUrl
+) %7B%0A        this.user = user;%0A        this.joinTime = new Date()
 ;%0A  
@@ -2185,32 +2185,246 @@
 tagLine;%0A    %7D%0A%0A
+    @Column(name = %22join_time%22, columnDefinition = %22TIMESTAMP%22)%0A    public Date getJoinTime() %7B%0A        return joinTime;%0A    %7D%0A%0A    public void setJoinTime(Date joinTime) %7B%0A        this.joinTime = joinTime;%0A    %7D%0A%0A
     @Column(name

update userinfo