package com.qmth.paper.library.common.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.qmth.paper.library.common.base.BaseEntity;
import com.qmth.paper.library.common.contant.SystemConstant;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * <p>
 * 所有附件记录表
 * </p>
 *
 * @author xf
 * @since 2021-03-23
 */
@TableName("basic_attachment")
public class BasicAttachment extends BaseEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "附件名称")
    @TableField(value = "name")
    private String name;

    @ApiModelProperty(value = "路径")
    @TableField(value = "path")
    private String path;

    @ApiModelProperty(value = "类型")
    @TableField(value = "type")
    private String type;

    @ApiModelProperty(value = "大小")
    @TableField(value = "size")
    private BigDecimal size;

    @ApiModelProperty(value = "MD5")
    @TableField(value = "md5")
    private String md5;

    @ApiModelProperty(value = "关联业务id")
    @JsonSerialize(using = ToStringSerializer.class)
    @TableField("obj_id")
    private Long objId;

    @TableField(exist = false)
    private Integer pages;

    @ApiModelProperty(value = "学校id")
    @JsonSerialize(using = ToStringSerializer.class)
    @TableField("school_id")
    private Long schoolId;

    @ApiModelProperty(value = "机构id")
    @JsonSerialize(using = ToStringSerializer.class)
    @TableField("org_id")
    private Long orgId;

    public BasicAttachment() {

    }

    public BasicAttachment(String path, String name, String type, BigDecimal size, String md5, Long createId) {
        setId(SystemConstant.getDbUuid());
        this.path = path;
        this.name = name;
        this.type = type;
        this.size = size;
        this.md5 = md5;
        setCreateTime(System.currentTimeMillis());
        setCreateId(createId);
    }

    public BasicAttachment(String path, String name, String type, BigDecimal size, String md5, Long createId, Long objId) {
        setId(SystemConstant.getDbUuid());
        this.path = path;
        this.name = name;
        this.type = type;
        this.size = size;
        this.md5 = md5;
        setCreateTime(System.currentTimeMillis());
        setCreateId(createId);
        this.objId = objId;
    }

    public Long getSchoolId() {
        return schoolId;
    }

    public void setSchoolId(Long schoolId) {
        this.schoolId = schoolId;
    }

    public Long getOrgId() {
        return orgId;
    }

    public void setOrgId(Long orgId) {
        this.orgId = orgId;
    }

    public Long getObjId() {
        return objId;
    }

    public void setObjId(Long objId) {
        this.objId = objId;
    }

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    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 String getType() {
        return type;
    }

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

    public BigDecimal getSize() {
        return size;
    }

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

    public String getMd5() {
        return md5;
    }

    public void setMd5(String md5) {
        this.md5 = md5;
    }

    public Integer getPages() {
        return pages;
    }

    public void setPages(Integer pages) {
        this.pages = pages;
    }
}
