package com.uas.finance.model;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;

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

/**
 * 附件实体
 * created by shicr on 2017/12/25
 **/
@Entity
@Table(name = "attach")
public class Attach implements Serializable {

    private static final long serialVersionUID = 1L;


    /**
     * 附件id
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private Long id;

    /**
     * 附件名
     */
    @Column(name = "name")
    private String name;

    /**
     * 附件路径
     */
    @Column(name = "path")
    private String path;

    /**
     * 文件大小
     */
    @Column(name = "size")
    private Long size;

    /**
     * 文件所属类别
     */
    @Column(name = "type")
    private String type;

    /**
     * 附件所属的金融单据
     */
    @Column(name = "applyId")
    private Long applyId;

    /**
     * 附件所属的保理公司
     */
    @Column(name = "faenuu")
    private Long fauu;


    @ManyToOne(cascade = CascadeType.REFRESH)
    @JoinColumn(name = "applyId", insertable = false, updatable = false)
    private FinancingApply financingApply;

    public Long getApplyId() {
        return applyId;
    }

    public void setApplyId(Long applyId) {
        this.applyId = applyId;
    }

    public Long getSize() {
        return size;
    }

    public void setSize(Long size) {
        this.size = size;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public Long getFauu() {
        return fauu;
    }

    public void setFauu(Long fauu) {
        this.fauu = fauu;
    }

    @JSONField(serialize = false)
    @JsonIgnore
    public FinancingApply getFinancingApply() {
        return financingApply;
    }

    public void setFinancingApply(FinancingApply financingApply) {
        this.financingApply = financingApply;
    }
}
