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_goods_catalog")
public class GoodsCategory implements Serializable {

    private static final long serialVersionUID = 1L;

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

/*    @Column(name = "id")
    @ApiModelProperty(value = "分类id")
    private String categoryId;*/

    @Column(name = "uid")
    @ApiModelProperty(value = "创建者的用户ID")
    private String uid;

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

    @Column(name = "name")
    @ApiModelProperty(value = "分类名称")
    private String name;

    @Column(name = "fatherID")
    @ApiModelProperty(value = "上级分类id")
    private String fatherID;//onlyid

    @Transient
    @ApiModelProperty(value = "上级分类名称")
    private String fatherName;

    @Column(name = "status")
    @ApiModelProperty(value = "状态 1=正常  2=删除")
    private Integer status = 1;

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


}
