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

import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

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

/**
 * @Description : 数据对象
 * @Reference :
 * @Author : alwaysfrin
 * @CreateDate : 2019-02-27 10:53
 * @Modify:
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name="SYS_DATA_SOURCE")
@Api(value="数据对象")
public class SysDataSource extends BaseBean {

    private static final long serialVersionUID = -3116421427693381484L;
    @Column(name="SOFT_TYPE")
    @ApiParam(value ="产品类型")
    private Integer softType;

    public String getSoftTypeTxt() {
        return softType == null ? null : CommonEnumUtil.SOFT_TYPE.valueOfDescription(softType);
    }

    @Column(name="SOURCE_NAME")
    @ApiParam(value ="数据源名称")
    private String sourceName;

    @Column(name="SOURCE_CODE")
    @ApiParam(value ="数据源编码")
    private String sourceCode;

    @Column(name="SOURCE_STATUS")
    @ApiParam(value ="数据源状态",name = "状态：可用，不可用 看枚举当中是否存在")
    private Integer sourceStatus;
    public String getSourceStatusTxt() {
        return softType == null ? null : CommonEnumUtil.DATA_SOURCE_STATUS.valueOfDescription(sourceStatus);
    }

    @Column(name="SOURCE_TYPE")
    @ApiParam(value ="数据源类型",name = "BlockFormEnumUtil.DATA_SOURCE_TYPE")
    private Integer sourceType;
    public String getSourceTypeTxt() {
        return softType == null ? null : CommonEnumUtil.DATA_SOURCE_TYPE.valueOfDescription(sourceType);
    }


    @Column(name="SOURCE_HOST")
    @ApiParam(value ="数据源连接地址")
    private String sourceHost;

    @Column(name="SOURCE_PORT")
    @ApiParam(value ="数据源端口")
    private Integer sourcePort;

    @Column(name="SOURCE_DATA_BASE_NAME")
    @ApiParam(value ="数据库名称")
    private String sourceDataBaseName;

    @Column(name="SOURCE_USER_NAME")
    @ApiParam(value ="数据库用户名称")
    private String sourceUserName;

    @Column(name="SOURCE_PASSWORD")
    @ApiParam(value ="数据库用户密码")
    private String sourcePassword;

    @Column(name="SOURCE_DESCRIPTION")
    @ApiParam(value ="数据源描述")
    private String sourceDescription;

}
