package com.ff.weijinxiao.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.ff.weijinxiao.util.jsonfilter.DateSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

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

/**
 * 用户表
 */
@Data
@Entity
@Table(name = "tb_userinfo")
public class UserInfo implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "tid")
    private Integer id;

    @Column(name = "uid")
    @ApiModelProperty(value = "用户登录ID")
    private String uid;

    @Column(name = "wechat_openid")
    @ApiModelProperty(value = "openid")
    private String wechatOpenid;

    @Column(name = "wechat_icon")
    @ApiModelProperty(value = "微信头像")
    private String wechatIcon;

    @Column(name = "wechat_name")
    @ApiModelProperty(value = "微信昵称")
    private String wechatName;

    @Column(name = "phone")
    @ApiModelProperty(value = "电话号码")
    private String phone;

    @Column(name="account_book_id",columnDefinition = "int COMMENT '默认账本id'")
    @ApiModelProperty(value = "默认账本id")
    private Integer accountBookId;

    @Column(name="account_book_num",columnDefinition = "int COMMENT '账本同时记账人数'")
    @ApiModelProperty(value = "账本同时记账人数")
    private Integer accountBookNum;

    @Column(name = "isvip")
    @ApiModelProperty(value = "1=月，2是年")
    private Integer isvip;

    @Column(name = "validity_time")
    @ApiModelProperty(value = "有效日期")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = DateSerializer.class)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")//json序列化实体类处理
    private Date validityTime;

    @Column(name = "create_time")
    @ApiModelProperty(value = "创建时间")
    @org.hibernate.annotations.CreationTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = DateSerializer.class)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")//json序列化实体类处理
    private Date createTime;

    @Column(name = "modify_time")
    @ApiModelProperty(value = "更新时间")
    @org.hibernate.annotations.UpdateTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = DateSerializer.class)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")//json序列化实体类处理
    private Date modifyTime;

/*    @Column(name = "type")
    @ApiModelProperty(value = "是否是删除状态(0:否；1:是)")
    private Integer type;*/

    @Column(name = "referenceUID")
    @ApiModelProperty(value = "推荐人ID")
    private String referenceUID;

    @Column(name = "roleID")
    @ApiModelProperty(value = "1=普通会员 2=管理员，可以看所有 3=协同子账户，只可以看自己的数据 4=协同子账户，可以看见自己和其他所有人的数据 5=子账 6=")
    private String roleID = "1";

    @Column(name = "unionid")
    @ApiModelProperty(value = "unionid")
    private String unionid;


}
