package cn.estsh.i3plus.pojo.platform.bean;

import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.text.DecimalFormat;

/**
 * @Description : 文件
 * @Reference   :
 * @Author      : wei.peng
 * @Date        : 2018-10-22 16:58:43.593
 * @Modify      :
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name="SYS_FILE")
@Api(value="文件",description = "文件")
public class SysFile extends BaseBean {

    private static final long serialVersionUID = 623700632055475696L;
    @Column(name="NAME")
    @ApiParam(value ="文件名称")
    private String name;

    @Column(name="FILE_CODE")
    @ApiParam(value ="文件代码")
    private String fileCode;

    @Column(name="FILE_SOFT_TYPE")
    @ApiParam(value ="文件所属模块")
    private Integer fileSoftType;

    public int getFileSoftTypeVal(){
        if(fileSoftType == null){
            return 0;
        }

        return fileSoftType.intValue();
    }

    @Column(name="USER_ID")
    @ApiParam(value ="用户ID" , example = "-1")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long userId;

    @Column(name="DFS_GROUP_NAME")
    @ApiParam(value ="FastDfs Group 名称(后台使用)")
    private String dfsGroupName;

    @Column(name="DFS_FILE_NAME")
    @ApiParam(value ="FastDfs 文件名称(后台使用)")
    private String dfsFileName;

    @Column(name="FILE_PATH")
    @ApiParam(value ="文件路径")
    private String filePath;

    @Column(name="FILE_ORIGINAL_NAME")
    @ApiParam(value ="原始文件名称")
    private String fileOriginalName;

    @Column(name="FILE_TYPE_ID")
    @ApiParam(value ="文件类型ID")
    private Long fileTypeId;

    @Column(name="FILE_TYPE_NAME_RDD")
    @ApiParam(value ="文件类型ID")
    private Long fileTypeNameRdd;

    @Column(name="FILE_TYPE_NAME")
    @ApiParam(value ="文件类型名称")
    private String fileTypeName;

    @Column(name="FILE_SIZE")
    @ApiParam(value ="文件大小(KB)" , example ="0")
    private Integer fileSize;

    @Column(name="DOWNLOAD_NUM")
    @ApiParam(value ="下载次数" , example ="0")
    private Integer downloadNum;
}
