后台资产展示代码

master
冷调 2024-08-29 15:34:21 +08:00
parent 0879134c24
commit 98b020edd2
4 changed files with 197 additions and 7 deletions

View File

@ -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();
}
}

View File

@ -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;
}

View File

@ -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;
/**
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-08-29-15:20
* @ Version1.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;
}

View File

@ -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表