后台资产展示代码
parent
0879134c24
commit
98b020edd2
|
@ -6,7 +6,10 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
|||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import com.muyu.source.domain.req.DataSourceEditReq;
|
||||
import com.muyu.source.domain.req.DataSourceQueryReq;
|
||||
import com.muyu.source.domain.req.EtlDataScoreAddReq;
|
||||
import com.muyu.source.pool.config.BaseConfig;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
@ -14,6 +17,8 @@ import lombok.EqualsAndHashCode;
|
|||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* u
|
||||
*
|
||||
|
@ -141,7 +146,7 @@ public class DataSource extends BaseEntity {
|
|||
@Excel(name = "最大等待时间")
|
||||
@TableField("max_wait_time")
|
||||
|
||||
private Long maxWaitTime;
|
||||
private Integer maxWaitTime;
|
||||
|
||||
/**
|
||||
* 最大等待次数
|
||||
|
@ -149,7 +154,7 @@ public class DataSource extends BaseEntity {
|
|||
@Excel(name = "最大等待次数")
|
||||
@TableField("max_wait_size")
|
||||
|
||||
private Long maxWaitSize;
|
||||
private Integer maxWaitSize;
|
||||
/**
|
||||
* 驱动 com.mysql.cj.jdbc.Driver
|
||||
* */
|
||||
|
@ -166,5 +171,69 @@ public class DataSource extends BaseEntity {
|
|||
.systemName(dataSourceQueryReq.getSystemName())
|
||||
.build();
|
||||
}
|
||||
/**
|
||||
* 添加
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
public static DataSource addBuild(EtlDataScoreAddReq req){
|
||||
return DataSource.builder()
|
||||
.dataType(req.getDataType())
|
||||
.name(req.getName())
|
||||
.ip(req.getIp())
|
||||
.port(req.getPort())
|
||||
.databaseName(req.getDatabaseName())
|
||||
.userName(req.getUserName())
|
||||
.password(req.getPassword())
|
||||
.connectionParam(req.getConnectionParam())
|
||||
.isInit(req.getIsInit())
|
||||
.initTotal(req.getInitTotal())
|
||||
.maxNum(req.getMaxNum())
|
||||
.maxWaitSize(req.getMaxWaitSize())
|
||||
.maxWaitTime(req.getMaxWaitTime())
|
||||
.driverName("com.mysql.cj.jdbc.Driver")
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
public static DataSource updBuild(DataSourceEditReq req, Supplier<Long> idSupplier){
|
||||
return DataSource.builder()
|
||||
.id(idSupplier.get())
|
||||
.dataType(req.getDataType())
|
||||
.name(req.getName())
|
||||
.ip(req.getIp())
|
||||
.port(req.getPort())
|
||||
.databaseName(req.getDatabaseName())
|
||||
.userName(req.getUserName())
|
||||
.password(req.getPassword())
|
||||
.connectionParam(req.getConnectionParam())
|
||||
.isInit(req.getIsInit())
|
||||
.initTotal(req.getInitTotal())
|
||||
.maxNum(req.getMaxNum())
|
||||
.maxWaitSize(req.getMaxWaitSize())
|
||||
.maxWaitTime(req.getMaxWaitTime())
|
||||
.driverName(req.getDriverName())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据库连接
|
||||
* @return
|
||||
*/
|
||||
public String getUrl(){
|
||||
StringBuilder urlSb = new StringBuilder(BaseConfig.MYSQLJDBCPRO);
|
||||
urlSb.append(this.ip);//拼接ip
|
||||
urlSb.append(":");
|
||||
urlSb.append(this.port); //拼接端口
|
||||
urlSb.append("/");
|
||||
urlSb.append(this.databaseName);//拼接数据库
|
||||
urlSb.append("?");
|
||||
urlSb.append(this.connectionParam);//useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
return urlSb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.muyu.source.domain.req;
|
||||
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
@ -89,23 +90,28 @@ public class DataSourceEditReq extends BaseEntity {
|
|||
* 初始连接数量
|
||||
*/
|
||||
@Schema(type = "Long",defaultValue = "5",description = "初始化连接数量")
|
||||
private Long initTotal;
|
||||
private Integer initTotal;
|
||||
|
||||
/**
|
||||
* 最大连接数量
|
||||
*/
|
||||
@Schema(type = "Long",defaultValue = "10",description = "最大连接数量")
|
||||
private Long maxNum;
|
||||
private Integer maxNum;
|
||||
|
||||
/**
|
||||
* 最大等待时间
|
||||
*/
|
||||
@Schema(type = "Long",defaultValue = "10",description = "最大等待时间")
|
||||
private Long maxWaitTime;
|
||||
private Integer maxWaitTime;
|
||||
|
||||
/**
|
||||
* 最大等待次数
|
||||
*/
|
||||
@Schema(type = "Long",defaultValue = "3",description = "最大等待次数")
|
||||
private Long maxWaitSize;
|
||||
private Integer maxWaitSize;
|
||||
/**
|
||||
* 驱动 com.mysql.cj.jdbc.Driver
|
||||
* */
|
||||
@Excel(name = "驱动",defaultValue = "com.mysql.cj.jdbc.Driver")
|
||||
private String driverName;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,115 @@
|
|||
package com.muyu.source.domain.req;
|
||||
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @ Tool:IntelliJ IDEA
|
||||
* @ Author:CHX
|
||||
* @ Date:2024-08-29-15:20
|
||||
* @ Version:1.0
|
||||
* @ Description:
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Tag(name = "数据源列表")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class EtlDataScoreAddReq extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 接入源名称
|
||||
*/
|
||||
@Schema(type = "String",defaultValue = "接入源名称",description = "接入源名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 数据来源系统名称
|
||||
*/
|
||||
@Schema(type = "String",defaultValue = "数据来源系统",description = "数据来源系统")
|
||||
private String systemName;
|
||||
|
||||
/**
|
||||
* 数据库类型
|
||||
*/
|
||||
@Schema(type = "String",defaultValue = "mysql等",description = "要选择的数据库类型")
|
||||
private String dataType;
|
||||
|
||||
/**
|
||||
* ip地址
|
||||
*/
|
||||
@Schema(type = "String",defaultValue = "ip地址",description = "ip地址,要连接的mysql的ip")
|
||||
private String ip;
|
||||
|
||||
/**
|
||||
* 端口号
|
||||
*/
|
||||
@Schema(type = "String",defaultValue = "3306",description = "端口号")
|
||||
private String port;
|
||||
|
||||
/**
|
||||
* 数据库名称
|
||||
*/
|
||||
@Schema(type = "String",defaultValue = "t_user",description = "数据库名称")
|
||||
private String databaseName;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
@Schema(type = "String",defaultValue = "root",description = "用户名")
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
@Schema(type = "String",defaultValue = "root",description = "密码")
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 数据连接参数
|
||||
*/
|
||||
@Schema(type = "String",defaultValue = "useUnicode=true&characterEncoding=utf8",description = "数据连接参数")
|
||||
private String connectionParam;
|
||||
|
||||
/**
|
||||
* 是否初始化
|
||||
*/
|
||||
@Schema(type = "String",defaultValue = "Y",description = "是否初始化 状态 'Y'/'N'")
|
||||
private String isInit;
|
||||
|
||||
/**
|
||||
* 初始连接数量
|
||||
*/
|
||||
@Schema(type = "Long",defaultValue = "5",description = "初始化连接数量")
|
||||
private Integer initTotal;
|
||||
|
||||
/**
|
||||
* 最大连接数量
|
||||
*/
|
||||
@Schema(type = "Long",defaultValue = "10",description = "最大连接数量")
|
||||
private Integer maxNum;
|
||||
|
||||
/**
|
||||
* 最大等待时间
|
||||
*/
|
||||
@Schema(type = "Long",defaultValue = "10",description = "最大等待时间")
|
||||
private Integer maxWaitTime;
|
||||
|
||||
/**
|
||||
* 最大等待次数
|
||||
*/
|
||||
@Schema(type = "Long",defaultValue = "3",description = "最大等待次数")
|
||||
private Integer maxWaitSize;
|
||||
/**
|
||||
* 驱动 com.mysql.cj.jdbc.Driver
|
||||
* */
|
||||
@Excel(name = "驱动",defaultValue = "com.mysql.cj.jdbc.Driver")
|
||||
private String driverName;
|
||||
}
|
|
@ -172,7 +172,7 @@ public class DataSourceServiceImpl extends ServiceImpl<DataSourceMapper, DataSou
|
|||
.type("dataSource")
|
||||
.tableName(etlDataScore.getDatabaseName())
|
||||
.createBy(SecurityUtils.getUsername())
|
||||
.createTime(new java.util.Date())
|
||||
.createTime(new Date())
|
||||
.build();
|
||||
|
||||
//添加数据库table_info表
|
||||
|
|
Loading…
Reference in New Issue