package cn.estsh.i3plus.pojo.screen.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.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;

/**
 * @author Wynne.Lu
 * @date 2021/3/22 下午1:27
 * @desc 数据对象管理
 */
@Entity
@Table(name = "SCR_DATA_OBJECT")
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
@DynamicUpdate
@DynamicInsert
@Builder
@ApiModel("数据对象管理")
public class ScrDataObject extends BaseBean implements Serializable {
    private static final long serialVersionUID = -270662014158685376L;

    @Column(name = "DATASOURCE_ID")
    @ApiModelProperty(value = "数据源ID", example = "-1")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long datasourceId;

    @Column(name = "DATA_OBJECT_CODE")
    @ApiModelProperty(value = "数据对象代码")
    private String dataObjectCode;

    @Column(name = "DATA_OBJECT_NAME")
    @ApiModelProperty(value = "数据对象名称")
    private String dataObjectName;

    @Column(name = "TABLE_NAME")
    @ApiModelProperty(value = "表或视图名称")
    private String tableName;

    @Column(name = "TABLE_TYPE")
    @ApiModelProperty(value = "表还是视图")
    private Integer tableType;

    @Transient
    @ApiModelProperty(value = "数据源代码")
    private String datasourceCode;

    @Transient
    @ApiModelProperty(value="数据源名称")
    private String datasourceName;

}
