package com.ruoyi.business.domain;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.Date;

/**
 * 外部接入连接信息对象 b_conn_info
 * 
 * @author ruoyi
 * @date 2024-01-10
 */
@Builder
@Data
@NoArgsConstructor
@AllArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
@TableName("b_database")
public class Database implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 
     */
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @JsonSerialize(using= ToStringSerializer.class)
    private Long id;

    /**
     * 数据源名称
     */
    @TableField("database_name")
    private String databaseName;

    /**
     * 数据源描述
     */
    @TableField("db_desc")
    private String dbDesc;

    /**
     * 数据库类型
     */
    @TableField("db_type")
    private String dbType;

    /**
     * 连接方式
     */
    @TableField("db_conn_type")
    private String dbConnType;

    /**
     * 连接参数
     */
    @TableField("db_conn_param")
    private String dbConnParam;

    /**
     * 字符集
     */
    @TableField("db_chartset")
    private String dbChartset;

    /**
     * 所属系统
     */
    @TableField("belong_system")
    private String belongSystem;

    /**
     * 部门路径
     */
    @TableField("dept_id_path")
    private String deptIdPath;

    /**
     * 部门名称
     */
    @TableField("dept_name")
    private String deptName;

    /**
     * 创建人
     */
    @TableField("create_by")
    private String createBy;

    /**
     * 创建人ID
     */
    @TableField("create_user_id")
    @JsonSerialize(using= ToStringSerializer.class)
    private Long createUserId;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("create_time")
    private Date createTime;

    /**
     * 更新人
     */
    @TableField("update_by")
    private String updateBy;

    /**
     * 更新时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("update_time")
    private Date updateTime;

    /**
     * 删除人
     */
    @TableField("delete_by")
    private String deleteBy;

    /**
     * 删除时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("delete_time")
    private Date deleteTime;

    /**
     * 删除标志 0未删除，1 删除
     */
    @TableField("delete_flag")
    @TableLogic
    private String deleteFlag;

    /**
     * 主机IP
     */
    @NotBlank(message = "{required}")
    @Size(max = 20, message = "{noMoreThan}")
    @TableField(exist = false)
    private String dbip;

    /**
     * 数据库名
     */
    @NotBlank(message = "{required}")
    @Size(max = 60, message = "{noMoreThan}")
    @TableField(exist = false)
    private String dbname;

    /**
     * 端口
     */
    @NotBlank(message = "{required}")
    @Size(max = 10, message = "{noMoreThan}")
    @TableField(exist = false)
    private String dbport;

    /**
     * 用户名
     */
    @NotBlank(message = "{required}")
    @Size(max = 30, message = "{noMoreThan}")
    @TableField(exist = false)
    private String dbuserid;

    /**
     * 密码
     */
    @NotBlank(message = "{required}")
    @Size(max = 30, message = "{noMoreThan}")
    @TableField(exist = false)
    private String dbpwd;

}
