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_supplier")
public class Supplier implements Serializable {

    private static final long serialVersionUID = 1L;

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

    @Column(name = "name")
    @ApiModelProperty(value = "供应商名称")
    private String name;

    @Column(name = "tel")
    @ApiModelProperty(value = "供应商电话")
    private String tel;

    @Column(name = "address")
    @ApiModelProperty(value = "供应商地址")
    private String address;

    @Column(name = "alipay")
    @ApiModelProperty(value = "支付宝账号")
    private String alipay;

    @Column(name = "weChat")
    @ApiModelProperty(value = "微信账号")
    private String weChat;

    @Column(name = "bank_card")
    @ApiModelProperty(value = "银行卡号")
    private String bankCard;

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

    @Column(name = "isBackup")
    @ApiModelProperty(value = "是否备份过(0:否；1:是)")
    private Integer isBackup = 0;

    // 01076548669
    @Column(name = "uid")
    @ApiModelProperty(value = "创建者uid")
    private String uid;

    @Transient
    @ApiModelProperty(value = "创建者姓名")
    private String userName;

    @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;

    // 150107717600090149862155037101291
    @Column(name = "onlyID")
    @ApiModelProperty(value = "onlyID")
    private String onlyID;

    @Column(name = "supplierLevel")
    @ApiModelProperty(value = "供应商级别 1~5，根据供应商模型自动填写")
    private String supplierLevel = "1";

    @OneToOne
    @JoinColumn(name = "book_id",referencedColumnName="id",foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT))
    @ApiModelProperty(value = "激活账本ID")
    private AccountBook accountBook;

}
