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

import cn.estsh.i3plus.pojo.aps.annotation.FieldAnnotation;
import cn.estsh.i3plus.pojo.aps.common.BaseAPS;
import cn.estsh.i3plus.pojo.aps.common.BeanRelation;
import cn.estsh.i3plus.pojo.aps.holders.EExportDetail;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * @Description :数据导出明细
 * @Reference :
 * @Author : jason.niu
 * @CreateDate : 2019-09-23
 * @Modify:
 **/
@Data
@EqualsAndHashCode(callSuper = true)
@Entity
@Table(name = "APS_EXPORT_DETAIL")
@Api("数据导出明细")
public class ExportDetail extends BaseAPS {

    private static final long serialVersionUID = -8898414164032180539L;
    @Column(name="OUT_NAME")
    @ApiParam(value ="外部表名")
    private String outName;

    @Column(name="IN_NAME")
    @ApiParam(value ="内部表名")
    private String inName;

    @Column(name="FILTER")
    @ApiParam(value ="筛选")
    private String filter;

    @Column(name="SORT_BY")
    @ApiParam(value ="排序")
    private String sortBy;

    @Column(name="ORDER_NUMBER")
    @ApiParam(value ="序号")
    @FieldAnnotation(display = false)
    private Integer orderNumber;

    @Column(name="PROJECT_ID")
    @ApiParam(value ="导出项目ID")
    @FieldAnnotation(relation = "Project")
    private Long projectId;

    public ExportProject getProject() {
        return BeanRelation.get(this, EExportDetail.Project);
    }

    public void setProject(ExportProject project) {
        this.projectId = project != null ? project.getId() : 0l;
        BeanRelation.set(this, EExportDetail.Project, project);
    }
}
