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.enums.IMPORT_DETAIL_TYPE;
import cn.estsh.i3plus.pojo.aps.holders.EImportDetail;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import lombok.Data;

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

/**
 * @Description :数据导入明细
 * @Reference :
 * @Author : jason.niu
 * @CreateDate : 2019-09-23
 * @Modify:
 **/
@Data
@Entity
@Table(name = "APS_IMPORT_DETAIL")
@Api("数据导入明细")
public class ImportDetail extends BaseAPS {
    @Column(name="TYPE")
    @ApiParam(value ="导入类型")
    private IMPORT_DETAIL_TYPE type;

    @Column(name="OUT_NAME")
    @ApiParam(value ="外部表名")
    private String outName;

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

    @Column(name="PROJECT_ID")
    @ApiParam(value ="导入项目ID")
    @FieldAnnotation(property = false)
    private Long projectId;

    public ImportProject getProject() {
        return BeanRelation.get(this, EImportDetail.Project);
    }

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