parent
247bc15afc
commit
08dec2fa81
|
@ -136,6 +136,11 @@
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>redis.clients</groupId>
|
||||||
|
<artifactId>jedis</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
package com.etl.data.source.domain;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 资产模块
|
|
||||||
* @author YunFei.Du
|
|
||||||
* @date 19:25 2024/4/21
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
public class AssetsModule {
|
|
||||||
private HashMap<String, String> structure;
|
|
||||||
private List<Map<String, VtModel>> kvtList;
|
|
||||||
|
|
||||||
private List<TableAssets> tableAssets;
|
|
||||||
}
|
|
|
@ -1,210 +1,113 @@
|
||||||
package com.etl.data.source.domain;
|
package com.etl.data.source.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.etl.common.core.annotation.Excel;
|
import com.etl.common.core.annotation.Excel;
|
||||||
import com.etl.common.core.web.domain.BaseEntity;
|
import com.etl.common.core.web.domain.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据源对象 data_source
|
* 数据源信息对象 data_source
|
||||||
*
|
*
|
||||||
* @author fei
|
* @author Chao
|
||||||
* @date 2024-04-21
|
* @date 2024-04-21
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@SuperBuilder
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("data_source")
|
||||||
public class DataSource extends BaseEntity {
|
public class DataSource extends BaseEntity {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/** 主键 */
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源名称
|
||||||
|
*/
|
||||||
|
@Excel(name = "数据源名称")
|
||||||
|
private String dataSourceName;
|
||||||
|
|
||||||
/** 接入源名称 */
|
/**
|
||||||
@Excel(name = "接入源名称")
|
* 数据源系统名称
|
||||||
private String name;
|
*/
|
||||||
|
@Excel(name = "数据源系统名称")
|
||||||
|
private String dataSourceSystemName;
|
||||||
|
|
||||||
/** 数据来源系统名称 */
|
/**
|
||||||
@Excel(name = "数据来源系统名称")
|
* 数据源类型
|
||||||
private String systemName;
|
*/
|
||||||
|
@Excel(name = "数据源类型")
|
||||||
|
private Long typeId;
|
||||||
|
|
||||||
/** 主机ip地址 */
|
/**
|
||||||
@Excel(name = "主机ip地址")
|
* 数据源ip地址
|
||||||
private String host;
|
*/
|
||||||
|
@Excel(name = "数据源ip地址")
|
||||||
|
private String dataSourceIp;
|
||||||
|
|
||||||
/** 端口 */
|
/**
|
||||||
@Excel(name = "端口")
|
* 端口号
|
||||||
private String port;
|
*/
|
||||||
|
@Excel(name = "端口号")
|
||||||
|
private String dataSourcePort;
|
||||||
|
|
||||||
/** 用户名 */
|
/**
|
||||||
@Excel(name = "用户名")
|
* 连接数据库名称
|
||||||
private String username;
|
*/
|
||||||
|
@Excel(name = "连接数据库名称")
|
||||||
|
private String dataSourceDatabaseName;
|
||||||
|
|
||||||
/** 密码 */
|
/**
|
||||||
@Excel(name = "密码")
|
* 用户名
|
||||||
private String password;
|
*/
|
||||||
|
private String dataSourceUsername;
|
||||||
|
|
||||||
/** 数据接入类型 */
|
/**
|
||||||
@Excel(name = "数据接入类型")
|
* 密码
|
||||||
private String type;
|
*/
|
||||||
|
private String dataSourcePassword;
|
||||||
|
|
||||||
/** 数据库名称 */
|
/**
|
||||||
@Excel(name = "数据库名称")
|
* 额外配置
|
||||||
private String databaseName;
|
*/
|
||||||
|
private String additionalConfiguration;
|
||||||
|
|
||||||
/** 数据连接参数 */
|
/**
|
||||||
@Excel(name = "数据连接参数")
|
* 状态
|
||||||
private String connectionParam;
|
*/
|
||||||
|
@Excel(name = "状态")
|
||||||
|
private String status;
|
||||||
|
|
||||||
/** 初始连接数量 */
|
/**
|
||||||
@Excel(name = "初始连接数量")
|
* 初始化连接数量
|
||||||
private Long initNum;
|
*/
|
||||||
|
private Long initialNumberOfConnections;
|
||||||
|
|
||||||
/** 最大连接数量 */
|
/**
|
||||||
@Excel(name = "最大连接数量")
|
* 最大连接数量
|
||||||
private Long maxNum;
|
*/
|
||||||
|
private Long maximumNumberOfConnections;
|
||||||
|
|
||||||
/** 最大等待时间 */
|
/**
|
||||||
@Excel(name = "最大等待时间")
|
* 最大等待时间
|
||||||
private Long maxWaitTime;
|
*/
|
||||||
|
private Long maximumWaitingTime;
|
||||||
|
|
||||||
/** 最大等待次数 */
|
/**
|
||||||
@Excel(name = "最大等待次数")
|
* 最大等待次数
|
||||||
private Long maxWaitSize;
|
*/
|
||||||
|
private Long maximumWaitingTimes;
|
||||||
|
|
||||||
|
|
||||||
public Long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSystemName() {
|
|
||||||
return systemName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSystemName(String systemName) {
|
|
||||||
this.systemName = systemName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getHost() {
|
|
||||||
return host;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHost(String host) {
|
|
||||||
this.host = host;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPort() {
|
|
||||||
return port;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPort(String port) {
|
|
||||||
this.port = port;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUsername() {
|
|
||||||
return username;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUsername(String username) {
|
|
||||||
this.username = username;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPassword() {
|
|
||||||
return password;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPassword(String password) {
|
|
||||||
this.password = password;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setType(String type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDatabaseName() {
|
|
||||||
return databaseName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDatabaseName(String databaseName) {
|
|
||||||
this.databaseName = databaseName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getConnectionParam() {
|
|
||||||
return connectionParam;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setConnectionParam(String connectionParam) {
|
|
||||||
this.connectionParam = connectionParam;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getInitNum() {
|
|
||||||
return initNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setInitNum(Long initNum) {
|
|
||||||
this.initNum = initNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getMaxNum() {
|
|
||||||
return maxNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMaxNum(Long maxNum) {
|
|
||||||
this.maxNum = maxNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getMaxWaitTime() {
|
|
||||||
return maxWaitTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMaxWaitTime(Long maxWaitTime) {
|
|
||||||
this.maxWaitTime = maxWaitTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getMaxWaitSize() {
|
|
||||||
return maxWaitSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMaxWaitSize(Long maxWaitSize) {
|
|
||||||
this.maxWaitSize = maxWaitSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "DataSource{" +
|
|
||||||
"id=" + id +
|
|
||||||
", name='" + name + '\'' +
|
|
||||||
", systemName='" + systemName + '\'' +
|
|
||||||
", host='" + host + '\'' +
|
|
||||||
", port='" + port + '\'' +
|
|
||||||
", username='" + username + '\'' +
|
|
||||||
", password='" + password + '\'' +
|
|
||||||
", type='" + type + '\'' +
|
|
||||||
", databaseName='" + databaseName + '\'' +
|
|
||||||
", connectionParam='" + connectionParam + '\'' +
|
|
||||||
", initNum=" + initNum +
|
|
||||||
", maxNum=" + maxNum +
|
|
||||||
", maxWaitTime=" + maxWaitTime +
|
|
||||||
", maxWaitSize=" + maxWaitSize +
|
|
||||||
"} " + super.toString ( );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
package com.etl.data.source.domain;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
public class TableAssets {
|
|
||||||
// private String Field;
|
|
||||||
// private String Type;
|
|
||||||
// private String Null;
|
|
||||||
// private String Key;
|
|
||||||
// private String Default;
|
|
||||||
}
|
|
|
@ -1,18 +0,0 @@
|
||||||
package com.etl.data.source.domain;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* VT模型
|
|
||||||
* @author YunFei.Du
|
|
||||||
* @date 19:25 2024/4/21
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
public class VtModel {
|
|
||||||
private String value;
|
|
||||||
private String type;
|
|
||||||
}
|
|
|
@ -0,0 +1,147 @@
|
||||||
|
package com.etl.data.source.domain.resp;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.etl.common.core.annotation.Excel;
|
||||||
|
import com.etl.common.core.web.domain.BaseEntity;
|
||||||
|
import com.etl.data.source.domain.DataSource;
|
||||||
|
import com.etl.data.type.domain.DataType;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源信息对象 data_source
|
||||||
|
*
|
||||||
|
* @author Chao
|
||||||
|
* @date 2024-04-21
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@SuperBuilder
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("data_source")
|
||||||
|
public class DataSourceResp extends BaseEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源名称
|
||||||
|
*/
|
||||||
|
@Excel(name = "数据源名称")
|
||||||
|
private String dataSourceName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源系统名称
|
||||||
|
*/
|
||||||
|
@Excel(name = "数据源系统名称")
|
||||||
|
private String dataSourceSystemName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源类型
|
||||||
|
*/
|
||||||
|
@Excel(name = "数据源类型")
|
||||||
|
private Long typeId;
|
||||||
|
|
||||||
|
|
||||||
|
@Excel(name = "数据源类型")
|
||||||
|
private String dataType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源ip地址
|
||||||
|
*/
|
||||||
|
@Excel(name = "数据源ip地址")
|
||||||
|
private String dataSourceIp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 端口号
|
||||||
|
*/
|
||||||
|
@Excel(name = "端口号")
|
||||||
|
private String dataSourcePort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 连接数据库名称
|
||||||
|
*/
|
||||||
|
@Excel(name = "连接数据库名称")
|
||||||
|
private String dataSourceDatabaseName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名
|
||||||
|
*/
|
||||||
|
@Excel(name = "用户名")
|
||||||
|
private String dataSourceUsername;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 密码
|
||||||
|
*/
|
||||||
|
@Excel(name = "密码")
|
||||||
|
private String dataSourcePassword;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 额外配置
|
||||||
|
*/
|
||||||
|
@Excel(name = "额外配置")
|
||||||
|
private String additionalConfiguration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*/
|
||||||
|
@Excel(name = "状态")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化连接数量
|
||||||
|
*/
|
||||||
|
@Excel(name = "初始化连接数量")
|
||||||
|
private Long initialNumberOfConnections;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最大连接数量
|
||||||
|
*/
|
||||||
|
@Excel(name = "最大连接数量")
|
||||||
|
private Long maximumNumberOfConnections;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最大等待时间
|
||||||
|
*/
|
||||||
|
@Excel(name = "最大等待时间")
|
||||||
|
private Long maximumWaitingTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最大等待次数
|
||||||
|
*/
|
||||||
|
@Excel(name = "最大等待次数")
|
||||||
|
private Long maximumWaitingTimes;
|
||||||
|
|
||||||
|
|
||||||
|
public static DataSourceResp dataSourceBuilder(DataSource source, DataType dataType) {
|
||||||
|
return DataSourceResp.builder()
|
||||||
|
.id(source.getId())
|
||||||
|
.dataSourceName(source.getDataSourceName())
|
||||||
|
.dataSourceSystemName(source.getDataSourceSystemName())
|
||||||
|
.typeId(source.getTypeId())
|
||||||
|
.dataType(dataType.getDataType())
|
||||||
|
.dataSourceIp(source.getDataSourceIp())
|
||||||
|
.dataSourcePort(source.getDataSourcePort())
|
||||||
|
.dataSourceDatabaseName(source.getDataSourceDatabaseName())
|
||||||
|
.dataSourceUsername(source.getDataSourceUsername())
|
||||||
|
.dataSourcePassword(source.getDataSourcePassword())
|
||||||
|
.additionalConfiguration(source.getAdditionalConfiguration())
|
||||||
|
.status(source.getStatus())
|
||||||
|
.initialNumberOfConnections(source.getInitialNumberOfConnections())
|
||||||
|
.maximumNumberOfConnections(source.getMaximumNumberOfConnections())
|
||||||
|
.maximumWaitingTime(source.getMaximumWaitingTime())
|
||||||
|
.maximumWaitingTimes(source.getMaximumWaitingTimes())
|
||||||
|
.remark(source.getRemark())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,73 @@
|
||||||
|
package com.etl.data.structure.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.etl.common.core.web.domain.BaseEntity;
|
||||||
|
import com.etl.data.source.domain.DataSource;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资产结构对象 asset_structure
|
||||||
|
*
|
||||||
|
* @author Chao
|
||||||
|
* @date 2024-04-22
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@SuperBuilder
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("asset_structure")
|
||||||
|
public class AssetStructure extends BaseEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源id
|
||||||
|
*/
|
||||||
|
private Long dataSourceSystemId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源名称
|
||||||
|
*/
|
||||||
|
private String dataSourceName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源系统名称
|
||||||
|
*/
|
||||||
|
private String dataSourceSystemName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 连接数据库名称
|
||||||
|
*/
|
||||||
|
private String dataSourceDatabaseName;
|
||||||
|
|
||||||
|
public static AssetStructure dataSourceSaveBuilder(Long id, DataSource dataSource) {
|
||||||
|
return AssetStructure.builder()
|
||||||
|
.dataSourceSystemId(id)
|
||||||
|
.dataSourceName(dataSource.getDataSourceName())
|
||||||
|
.dataSourceSystemName(dataSource.getDataSourceSystemName())
|
||||||
|
.dataSourceDatabaseName(dataSource.getDataSourceDatabaseName())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AssetStructure dataSourceUpdateBuilder(AssetStructure assetStructure, Long id, DataSource dataSource) {
|
||||||
|
return AssetStructure.builder()
|
||||||
|
.id(assetStructure.getId())
|
||||||
|
.dataSourceSystemId(id)
|
||||||
|
.dataSourceName(dataSource.getDataSourceName())
|
||||||
|
.dataSourceSystemName(dataSource.getDataSourceSystemName())
|
||||||
|
.dataSourceDatabaseName(dataSource.getDataSourceDatabaseName())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
package com.etl.data.structure.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.etl.common.core.annotation.Excel;
|
||||||
|
import com.etl.common.core.web.domain.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资产结构对象表 asset_structure_table
|
||||||
|
*
|
||||||
|
* @author Chao
|
||||||
|
* @date 2024-04-22
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@SuperBuilder
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("asset_structure_table")
|
||||||
|
public class AssetStructureTable extends BaseEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据资产id
|
||||||
|
*/
|
||||||
|
@Excel(name = "数据资产id")
|
||||||
|
private Long assetStructureId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据资产表
|
||||||
|
*/
|
||||||
|
@Excel(name = "数据资产表")
|
||||||
|
private String tableName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据库数据总数
|
||||||
|
*/
|
||||||
|
@Excel(name = "表数据总数")
|
||||||
|
private Long tableDataCount;
|
||||||
|
|
||||||
|
@Excel(name = "表注释")
|
||||||
|
private String tableNameAnnotation;
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package com.etl.data.structure.domain.resp;
|
||||||
|
|
||||||
|
import com.etl.data.structure.domain.AssetStructure;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据资产返回类
|
||||||
|
*
|
||||||
|
* @author Chao
|
||||||
|
* @ClassName: AssetStructureResp 数据资产返回类
|
||||||
|
* @CreateTime: 2024/4/22 下午7:23
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@SuperBuilder
|
||||||
|
public class AssetStructureResp {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据资产
|
||||||
|
*/
|
||||||
|
private List<AssetStructure> assetStructureList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据资产表总数
|
||||||
|
*/
|
||||||
|
private Long assetStructureTableCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据资产表数据总数
|
||||||
|
*/
|
||||||
|
private Long assetStructureTableDataCount;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
package com.etl.data.type.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.etl.common.core.annotation.Excel;
|
||||||
|
import com.etl.common.core.web.domain.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源类型对象 data_type
|
||||||
|
*
|
||||||
|
* @author Chao
|
||||||
|
* @date 2024-04-21
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@SuperBuilder
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("data_type")
|
||||||
|
public class DataType extends BaseEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编号
|
||||||
|
*/
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源类型
|
||||||
|
*/
|
||||||
|
@Excel(name = "数据源类型")
|
||||||
|
private String dataType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册驱动
|
||||||
|
*/
|
||||||
|
@Excel(name = "注册驱动")
|
||||||
|
private String driverManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* jdbc前缀
|
||||||
|
*/
|
||||||
|
@Excel(name = "jdbc前缀")
|
||||||
|
private String jdbcPre;
|
||||||
|
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package com.etl.data.source;
|
package com.etl.data;
|
||||||
|
|
||||||
import com.etl.common.security.annotation.EnableCustomConfig;
|
import com.etl.common.security.annotation.EnableCustomConfig;
|
||||||
import com.etl.common.security.annotation.EnableMyFeignClients;
|
import com.etl.common.security.annotation.EnableMyFeignClients;
|
||||||
|
@ -7,9 +7,9 @@ import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统模块
|
* 数据源模块
|
||||||
*
|
*
|
||||||
* @author etl
|
* @author Chao
|
||||||
*/
|
*/
|
||||||
@EnableCustomConfig
|
@EnableCustomConfig
|
||||||
@EnableCustomSwagger2
|
@EnableCustomSwagger2
|
|
@ -1,121 +1,115 @@
|
||||||
package com.etl.data.source.controller;
|
package com.etl.data.source.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import com.etl.common.core.domain.Result;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import com.etl.common.core.utils.poi.ExcelUtil;
|
||||||
|
import com.etl.common.core.web.controller.BaseController;
|
||||||
import com.etl.data.source.domain.DataSource;
|
import com.etl.common.core.web.page.TableDataInfo;
|
||||||
import com.etl.data.source.service.IDataSourceService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import com.etl.common.log.annotation.Log;
|
import com.etl.common.log.annotation.Log;
|
||||||
import com.etl.common.log.enums.BusinessType;
|
import com.etl.common.log.enums.BusinessType;
|
||||||
import com.etl.common.security.annotation.RequiresPermissions;
|
import com.etl.common.security.annotation.RequiresPermissions;
|
||||||
import com.etl.common.core.web.controller.BaseController;
|
import com.etl.data.source.domain.DataSource;
|
||||||
import com.etl.common.core.domain.Result;
|
import com.etl.data.source.domain.resp.DataSourceResp;
|
||||||
import com.etl.common.core.utils.poi.ExcelUtil;
|
import com.etl.data.source.service.IDataSourceService;
|
||||||
import com.etl.common.core.web.page.TableDataInfo;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 【请填写功能名称】Controller
|
* 数据源信息Controller
|
||||||
*
|
*
|
||||||
* @author fei
|
* @author Chao
|
||||||
* @date 2024-04-21
|
* @date 2024-04-21
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/source")
|
@RequestMapping("/source")
|
||||||
public class DataSourceController extends BaseController
|
public class DataSourceController extends BaseController {
|
||||||
{
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IDataSourceService dataSourceService;
|
private IDataSourceService dataSourceService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询【请填写功能名称】列表
|
* 查询数据源信息列表
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("dataSource:source:list")
|
@RequiresPermissions("data:source:list")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public Result< TableDataInfo< DataSource > > list(DataSource dataSource)
|
public Result<TableDataInfo<DataSourceResp>> list(DataSource dataSource) {
|
||||||
{
|
|
||||||
startPage();
|
startPage();
|
||||||
List<DataSource> list = dataSourceService.selectDataSourceList(dataSource);
|
List<DataSourceResp> list = dataSourceService.selectDataSourceList(dataSource);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出【请填写功能名称】列表
|
* 导出数据源信息列表
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("dataSource:source:export")
|
@RequiresPermissions("data:source:export")
|
||||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
|
@Log(title = "数据源信息", businessType = BusinessType.EXPORT)
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(HttpServletResponse response, DataSource dataSource)
|
public void export(HttpServletResponse response, DataSource dataSource) {
|
||||||
{
|
List<DataSourceResp> list = dataSourceService.selectDataSourceList(dataSource);
|
||||||
List<DataSource> list = dataSourceService.selectDataSourceList(dataSource);
|
ExcelUtil<DataSourceResp> util = new ExcelUtil<DataSourceResp>(DataSourceResp.class);
|
||||||
ExcelUtil<DataSource> util = new ExcelUtil<DataSource>(DataSource.class);
|
util.exportExcel(response, list, "数据源信息数据");
|
||||||
util.exportExcel(response, list, "【请填写功能名称】数据");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取【请填写功能名称】详细信息
|
* 获取数据源信息详细信息
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("dataSource:source:query")
|
@RequiresPermissions("data:source:query")
|
||||||
@GetMapping(value = "/{id}")
|
@GetMapping(value = "/{id}")
|
||||||
public Result getInfo(@PathVariable("id") Long id)
|
public Result getInfo(@PathVariable("id") Long id) {
|
||||||
{
|
|
||||||
return success(dataSourceService.selectDataSourceById(id));
|
return success(dataSourceService.selectDataSourceById(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增【请填写功能名称】
|
* 新增数据源信息
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("dataSource:source:add")
|
@RequiresPermissions("data:source:add")
|
||||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
|
@Log(title = "数据源信息", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public Result add(@RequestBody DataSource dataSource)
|
public Result add(@RequestBody DataSource dataSource) {
|
||||||
{
|
|
||||||
return toAjax(dataSourceService.insertDataSource(dataSource));
|
return toAjax(dataSourceService.insertDataSource(dataSource));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改【请填写功能名称】
|
* 修改数据源信息
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("dataSource:source:edit")
|
@RequiresPermissions("data:source:edit")
|
||||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
|
@Log(title = "数据源信息", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public Result edit(@RequestBody DataSource dataSource)
|
public Result edit(@RequestBody DataSource dataSource) {
|
||||||
{
|
|
||||||
return toAjax(dataSourceService.updateDataSource(dataSource));
|
return toAjax(dataSourceService.updateDataSource(dataSource));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除【请填写功能名称】
|
* 删除数据源信息
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("dataSource:source:remove")
|
@RequiresPermissions("data:source:remove")
|
||||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
|
@Log(title = "数据源信息", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
public Result remove(@PathVariable Long[] ids)
|
public Result remove(@PathVariable Long[] ids) {
|
||||||
{
|
|
||||||
return toAjax(dataSourceService.deleteDataSourceByIds(ids));
|
return toAjax(dataSourceService.deleteDataSourceByIds(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 测试连接
|
* 测试链接
|
||||||
|
* @param id 数据源id
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("dataSource:source:test")
|
@RequiresPermissions("data:source:testConnection")
|
||||||
@Log(title = "测试连接", businessType = BusinessType.OTHER)
|
@PostMapping(value = "testConnection/{id}")
|
||||||
@PostMapping("/TestConnection")
|
public Result testConnection(@PathVariable("id") Long id) {
|
||||||
public Result testConnection(@RequestBody DataSource dataSource)
|
return Result.success(dataSourceService.testConnection(id));
|
||||||
{
|
|
||||||
return dataSourceService.testConnection(dataSource);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资产同步
|
||||||
|
* @param id 数据源id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("data:source:assetSynchronization")
|
||||||
|
@PostMapping(value = "assetSynchronization/{id}")
|
||||||
|
public Result assetSynchronization(@PathVariable("id") Long id) {
|
||||||
|
return Result.success(dataSourceService.assetSynchronization(id));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,59 +1,59 @@
|
||||||
package com.etl.data.source.mapper;
|
package com.etl.data.source.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.etl.data.source.domain.DataSource;
|
import com.etl.data.source.domain.DataSource;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 【请填写功能名称】Mapper接口
|
* 数据源信息Mapper接口
|
||||||
*
|
*
|
||||||
* @author fei
|
* @author Chao
|
||||||
* @date 2024-04-21
|
* @date 2024-04-21
|
||||||
*/
|
*/
|
||||||
public interface DataSourceMapper
|
public interface DataSourceMapper extends BaseMapper<DataSource> {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* 查询【请填写功能名称】
|
* 查询数据源信息
|
||||||
*
|
*
|
||||||
* @param id 【请填写功能名称】主键
|
* @param id 数据源信息主键
|
||||||
* @return 【请填写功能名称】
|
* @return 数据源信息
|
||||||
*/
|
*/
|
||||||
public DataSource selectDataSourceById(Long id);
|
public DataSource selectDataSourceById(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询【请填写功能名称】列表
|
* 查询数据源信息列表
|
||||||
*
|
*
|
||||||
* @param dataSource 【请填写功能名称】
|
* @param dataSource 数据源信息
|
||||||
* @return 【请填写功能名称】集合
|
* @return 数据源信息集合
|
||||||
*/
|
*/
|
||||||
public List<DataSource> selectDataSourceList(DataSource dataSource);
|
public List<DataSource> selectDataSourceList(DataSource dataSource);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增【请填写功能名称】
|
* 新增数据源信息
|
||||||
*
|
*
|
||||||
* @param dataSource 【请填写功能名称】
|
* @param dataSource 数据源信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int insertDataSource(DataSource dataSource);
|
public int insertDataSource(DataSource dataSource);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改【请填写功能名称】
|
* 修改数据源信息
|
||||||
*
|
*
|
||||||
* @param dataSource 【请填写功能名称】
|
* @param dataSource 数据源信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int updateDataSource(DataSource dataSource);
|
public int updateDataSource(DataSource dataSource);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除【请填写功能名称】
|
* 删除数据源信息
|
||||||
*
|
*
|
||||||
* @param id 【请填写功能名称】主键
|
* @param id 数据源信息主键
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteDataSourceById(Long id);
|
public int deleteDataSourceById(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除【请填写功能名称】
|
* 批量删除数据源信息
|
||||||
*
|
*
|
||||||
* @param ids 需要删除的数据主键集合
|
* @param ids 需要删除的数据主键集合
|
||||||
* @return 结果
|
* @return 结果
|
||||||
|
|
|
@ -1,66 +1,76 @@
|
||||||
package com.etl.data.source.service;
|
package com.etl.data.source.service;
|
||||||
|
|
||||||
import com.etl.common.core.domain.Result;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.etl.data.source.domain.DataSource;
|
import com.etl.data.source.domain.DataSource;
|
||||||
|
import com.etl.data.source.domain.resp.DataSourceResp;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 【请填写功能名称】Service接口
|
* 数据源信息Service接口
|
||||||
*
|
*
|
||||||
* @author fei
|
* @author Chao
|
||||||
* @date 2024-04-21
|
* @date 2024-04-21
|
||||||
*/
|
*/
|
||||||
public interface IDataSourceService
|
public interface IDataSourceService extends IService<DataSource> {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* 查询【请填写功能名称】
|
* 查询数据源信息
|
||||||
*
|
*
|
||||||
* @param id 【请填写功能名称】主键
|
* @param id 数据源信息主键
|
||||||
* @return 【请填写功能名称】
|
* @return 数据源信息
|
||||||
*/
|
*/
|
||||||
public DataSource selectDataSourceById(Long id);
|
public DataSource selectDataSourceById(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询【请填写功能名称】列表
|
* 查询数据源信息列表
|
||||||
*
|
*
|
||||||
* @param dataSource 【请填写功能名称】
|
* @param dataSource 数据源信息
|
||||||
* @return 【请填写功能名称】集合
|
* @return 数据源信息集合
|
||||||
*/
|
*/
|
||||||
public List<DataSource> selectDataSourceList(DataSource dataSource);
|
public List<DataSourceResp> selectDataSourceList(DataSource dataSource);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增【请填写功能名称】
|
* 新增数据源信息
|
||||||
*
|
*
|
||||||
* @param dataSource 【请填写功能名称】
|
* @param dataSource 数据源信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int insertDataSource(DataSource dataSource);
|
public int insertDataSource(DataSource dataSource);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改【请填写功能名称】
|
* 修改数据源信息
|
||||||
*
|
*
|
||||||
* @param dataSource 【请填写功能名称】
|
* @param dataSource 数据源信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int updateDataSource(DataSource dataSource);
|
public int updateDataSource(DataSource dataSource);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除【请填写功能名称】
|
* 批量删除数据源信息
|
||||||
*
|
*
|
||||||
* @param ids 需要删除的【请填写功能名称】主键集合
|
* @param ids 需要删除的数据源信息主键集合
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteDataSourceByIds(Long[] ids);
|
public int deleteDataSourceByIds(Long[] ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除【请填写功能名称】信息
|
* 删除数据源信息信息
|
||||||
*
|
*
|
||||||
* @param id 【请填写功能名称】主键
|
* @param id 数据源信息主键
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteDataSourceById(Long id);
|
public int deleteDataSourceById(Long id);
|
||||||
|
|
||||||
Result testConnection(DataSource dataSource);
|
/**
|
||||||
|
* 测试连接
|
||||||
|
* @param id 数据源id
|
||||||
|
*/
|
||||||
|
boolean testConnection(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资产同步
|
||||||
|
* @param id 数据源id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean assetSynchronization(Long id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,158 +1,420 @@
|
||||||
package com.etl.data.source.service.impl;
|
package com.etl.data.source.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.etl.common.core.domain.Result;
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.etl.common.core.utils.DateUtils;
|
import com.etl.common.core.utils.DateUtils;
|
||||||
import com.etl.data.source.domain.DataSource;
|
import com.etl.data.source.domain.DataSource;
|
||||||
|
import com.etl.data.source.domain.resp.DataSourceResp;
|
||||||
import com.etl.data.source.mapper.DataSourceMapper;
|
import com.etl.data.source.mapper.DataSourceMapper;
|
||||||
import com.etl.data.source.service.IDataSourceService;
|
import com.etl.data.source.service.IDataSourceService;
|
||||||
|
import com.etl.data.structure.domain.AssetStructure;
|
||||||
|
import com.etl.data.structure.domain.AssetStructureTable;
|
||||||
|
import com.etl.data.structure.service.IAssetStructureService;
|
||||||
|
import com.etl.data.structure.service.IAssetStructureTableService;
|
||||||
|
import com.etl.data.type.domain.DataType;
|
||||||
|
import com.etl.data.type.service.IDataTypeService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import redis.clients.jedis.Jedis;
|
||||||
|
|
||||||
|
import java.sql.*;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 【请填写功能名称】Service业务层处理
|
* 数据源信息Service业务层处理
|
||||||
*
|
*
|
||||||
* @author fei
|
* @author Chao
|
||||||
* @date 2024-04-21
|
* @date 2024-04-21
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class DataSourceServiceImpl implements IDataSourceService
|
public class DataSourceServiceImpl extends ServiceImpl<DataSourceMapper, DataSource> implements IDataSourceService {
|
||||||
{
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private DataSourceMapper dataSourceMapper;
|
private DataSourceMapper dataSourceMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IDataTypeService dataTypeService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IAssetStructureService assetStructureService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IAssetStructureTableService assetStructureTableService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询【请填写功能名称】
|
* 查询数据源信息
|
||||||
*
|
*
|
||||||
* @param id 【请填写功能名称】主键
|
* @param id 数据源信息主键
|
||||||
* @return 【请填写功能名称】
|
* @return 数据源信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public DataSource selectDataSourceById(Long id)
|
public DataSource selectDataSourceById(Long id) {
|
||||||
{
|
|
||||||
return dataSourceMapper.selectDataSourceById(id);
|
return dataSourceMapper.selectDataSourceById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询【请填写功能名称】列表
|
* 查询数据源信息列表
|
||||||
*
|
*
|
||||||
* @param dataSource 【请填写功能名称】
|
* @param dataSource 数据源信息
|
||||||
* @return 【请填写功能名称】
|
* @return 数据源信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<DataSource> selectDataSourceList(DataSource dataSource)
|
public List<DataSourceResp> selectDataSourceList(DataSource dataSource) {
|
||||||
{
|
List<DataSource> dataSources = dataSourceMapper.selectDataSourceList(dataSource);
|
||||||
return dataSourceMapper.selectDataSourceList(dataSource);
|
List<DataType> dataTypeList = dataTypeService.list();
|
||||||
|
List<DataSourceResp> dataSourceResps = new ArrayList<>();
|
||||||
|
dataSources.stream()
|
||||||
|
.flatMap(source ->
|
||||||
|
dataTypeList.stream()
|
||||||
|
.filter(dataType -> dataType.getId().equals(source.getTypeId()))
|
||||||
|
.map(dataType -> DataSourceResp.dataSourceBuilder(source, dataType))
|
||||||
|
).forEach(dataSourceResps::add);
|
||||||
|
return dataSourceResps;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增【请填写功能名称】
|
* 新增数据源信息
|
||||||
*
|
*
|
||||||
* @param dataSource 【请填写功能名称】
|
* @param dataSource 数据源信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int insertDataSource(DataSource dataSource)
|
public int insertDataSource(DataSource dataSource) {
|
||||||
{
|
|
||||||
dataSource.setCreateTime(DateUtils.getNowDate());
|
dataSource.setCreateTime(DateUtils.getNowDate());
|
||||||
return dataSourceMapper.insertDataSource(dataSource);
|
return dataSourceMapper.insertDataSource(dataSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改【请填写功能名称】
|
* 修改数据源信息
|
||||||
*
|
*
|
||||||
* @param dataSource 【请填写功能名称】
|
* @param dataSource 数据源信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int updateDataSource(DataSource dataSource)
|
public int updateDataSource(DataSource dataSource) {
|
||||||
{
|
|
||||||
dataSource.setUpdateTime(DateUtils.getNowDate());
|
dataSource.setUpdateTime(DateUtils.getNowDate());
|
||||||
return dataSourceMapper.updateDataSource(dataSource);
|
return dataSourceMapper.updateDataSource(dataSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除【请填写功能名称】
|
* 批量删除数据源信息
|
||||||
*
|
*
|
||||||
* @param ids 需要删除的【请填写功能名称】主键
|
* @param ids 需要删除的数据源信息主键
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteDataSourceByIds(Long[] ids)
|
public int deleteDataSourceByIds(Long[] ids) {
|
||||||
{
|
|
||||||
return dataSourceMapper.deleteDataSourceByIds(ids);
|
return dataSourceMapper.deleteDataSourceByIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除【请填写功能名称】信息
|
* 删除数据源信息信息
|
||||||
*
|
*
|
||||||
* @param id 【请填写功能名称】主键
|
* @param id 数据源信息主键
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteDataSourceById(Long id)
|
public int deleteDataSourceById(Long id) {
|
||||||
{
|
|
||||||
return dataSourceMapper.deleteDataSourceById(id);
|
return dataSourceMapper.deleteDataSourceById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测试连接
|
||||||
|
*
|
||||||
|
* @param id 数据源id
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Result testConnection(DataSource dataSource) {
|
public boolean testConnection(Long id) {
|
||||||
String user=dataSource.getUsername();
|
DataSource dataSource = this.getOne(
|
||||||
String password=dataSource.getPassword ();
|
new LambdaQueryWrapper<DataSource>()
|
||||||
String jdbcDriver = "com.mysql.cj.jdbc.Driver";
|
.eq(DataSource::getId, id)
|
||||||
String jdbcUrl = "jdbc:mysql://"+dataSource.getHost ()+":"+dataSource.getPort()+"/"+dataSource.getDatabaseName();
|
);
|
||||||
if (dataSource.getConnectionParam()!=null && dataSource.getConnectionParam()!=""){
|
String jdbcUrl = "";
|
||||||
jdbcUrl = jdbcUrl+"?"+dataSource.getConnectionParam();
|
String driveClass = "";
|
||||||
}
|
boolean flag = false;
|
||||||
Connection conn = null;
|
DataType dataType = dataTypeService.getOne(
|
||||||
PreparedStatement pst=null;
|
new LambdaQueryWrapper<DataType>()
|
||||||
|
.eq(DataType::getId, dataSource.getTypeId())
|
||||||
|
);
|
||||||
try {
|
try {
|
||||||
Class.forName(jdbcDriver);
|
if (dataType.getDriverManager() != null && dataType.getJdbcPre() != null) {
|
||||||
} catch (ClassNotFoundException e) {
|
if ("mysql".equals(dataType.getDataType())) {
|
||||||
return Result.error("连接失败");
|
driveClass = dataType.getDriverManager();
|
||||||
|
jdbcUrl = dataType.getJdbcPre() + dataSource.getDataSourceIp() + ":" + dataSource.getDataSourcePort() + "/" + dataSource.getDataSourceDatabaseName() + "?" + dataSource.getAdditionalConfiguration();
|
||||||
|
}
|
||||||
|
if ("oracle".equals(dataType.getDataType())) {
|
||||||
|
driveClass = dataType.getDriverManager();
|
||||||
|
jdbcUrl = dataType.getJdbcPre() + dataSource.getDataSourceIp() + ":" + dataSource.getDataSourcePort() + ":" + dataSource.getDataSourceDatabaseName();
|
||||||
|
}
|
||||||
|
if ("sqlserver".equals(dataType.getDataType())) {
|
||||||
|
driveClass = dataType.getDriverManager();
|
||||||
|
jdbcUrl = dataType.getJdbcPre() + dataSource.getDataSourceIp() + ":" + dataSource.getDataSourcePort() + ";databaseName=" + dataSource.getDataSourceDatabaseName();
|
||||||
|
}
|
||||||
|
flag = testDatasource(driveClass, jdbcUrl, dataSource.getDataSourceUsername(), dataSource.getDataSourcePassword());
|
||||||
|
} else {
|
||||||
|
// redis
|
||||||
|
//连接指定的redis
|
||||||
|
Jedis jedis = new Jedis(dataSource.getDataSourceIp(), Integer.valueOf(dataSource.getDataSourcePort()));
|
||||||
|
//如果有密码则需要下面这一行
|
||||||
|
if (dataSource.getDataSourcePassword() != null && !dataSource.getDataSourcePassword().equals("")) {
|
||||||
|
jedis.auth(dataSource.getDataSourcePassword());
|
||||||
|
}
|
||||||
|
//查看服务是否运行,运行正常的话返回一个PONG,否则返回一个连接错误
|
||||||
|
try {
|
||||||
|
jedis.ping();
|
||||||
|
flag = true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
flag = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (flag) {
|
||||||
|
this.update(
|
||||||
|
new UpdateWrapper<DataSource>()
|
||||||
|
.set("status", "S")
|
||||||
|
.eq("id", id)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
this.update(
|
||||||
|
new UpdateWrapper<DataSource>()
|
||||||
|
.set("status", "E")
|
||||||
|
.eq("id", id)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return flag;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资产同步
|
||||||
|
*
|
||||||
|
* @param id 数据源id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public boolean assetSynchronization(Long id) {
|
||||||
|
DataSource dataSource = this.getOne(
|
||||||
|
new LambdaQueryWrapper<DataSource>()
|
||||||
|
.eq(DataSource::getId, id)
|
||||||
|
);
|
||||||
|
// 查询是否存在当前
|
||||||
|
AssetStructure assetStructure = assetStructureService.getOne(
|
||||||
|
new LambdaQueryWrapper<AssetStructure>()
|
||||||
|
.eq(AssetStructure::getDataSourceSystemId, id)
|
||||||
|
);
|
||||||
|
boolean b = this.testConnection(id);
|
||||||
|
if (b) {
|
||||||
|
// 如果不存在就给他添加资产结构表
|
||||||
|
if (assetStructure == null) {
|
||||||
|
// 构建实体
|
||||||
|
AssetStructure entity = AssetStructure.dataSourceSaveBuilder(id, dataSource);
|
||||||
|
assetStructureService.save(entity);
|
||||||
|
String jdbcUrl = "";
|
||||||
|
String driveClass = "";
|
||||||
|
DataType dataType = dataTypeService.getOne(
|
||||||
|
new LambdaQueryWrapper<DataType>()
|
||||||
|
.eq(DataType::getId, dataSource.getTypeId())
|
||||||
|
);
|
||||||
|
try {
|
||||||
|
List<AssetStructureTable> assetStructureTableList = new ArrayList<>();
|
||||||
|
if (dataType.getDriverManager() != null && dataType.getJdbcPre() != null) {
|
||||||
|
if ("mysql".equals(dataType.getDataType())) {
|
||||||
|
driveClass = dataType.getDriverManager();
|
||||||
|
jdbcUrl = dataType.getJdbcPre() + dataSource.getDataSourceIp() + ":" + dataSource.getDataSourcePort() + "/" + dataSource.getDataSourceDatabaseName() + "?" + dataSource.getAdditionalConfiguration();
|
||||||
|
// 加载数据库驱动
|
||||||
|
Class.forName(driveClass);
|
||||||
|
// 连接数据库
|
||||||
|
Connection conn = DriverManager.getConnection(jdbcUrl, dataSource.getDataSourceUsername(), dataSource.getDataSourcePassword());
|
||||||
|
Statement st = conn.createStatement();
|
||||||
|
ResultSet rs = st.executeQuery("select * from information_schema.tables where TABLE_SCHEMA = " + "'" + dataSource.getDataSourceDatabaseName() + "'");
|
||||||
|
while (rs.next()) {
|
||||||
|
// 获取表名
|
||||||
|
String tableName = rs.getString("TABLE_NAME");
|
||||||
|
// 表注释
|
||||||
|
String tableNameAnnotation = rs.getString("TABLE_COMMENT");
|
||||||
|
// 添加数据
|
||||||
|
// 表数据数量
|
||||||
|
assetStructureTableList.add(
|
||||||
|
new AssetStructureTable() {{
|
||||||
|
setAssetStructureId(entity.getId());
|
||||||
|
setTableName(tableName);
|
||||||
|
setTableNameAnnotation(tableNameAnnotation);
|
||||||
|
}}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
assetStructureTableList.stream().forEach(assetStructureTable -> {
|
||||||
|
try {
|
||||||
|
ResultSet rs2 = st.executeQuery("select count(*) as countNum from " + assetStructureTable.getTableName());
|
||||||
|
while (rs2.next()) {
|
||||||
|
assetStructureTable.setTableDataCount(rs2.getLong("countNum"));
|
||||||
|
}
|
||||||
|
rs2.close();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
conn.close();
|
||||||
|
st.close();
|
||||||
|
rs.close();
|
||||||
|
// 批量插入
|
||||||
|
assetStructureTableService.saveBatch(assetStructureTableList);
|
||||||
|
}
|
||||||
|
if ("oracle".equals(dataType.getDataType())) {
|
||||||
|
driveClass = dataType.getDriverManager();
|
||||||
|
jdbcUrl = dataType.getJdbcPre() + dataSource.getDataSourceIp() + ":" + dataSource.getDataSourcePort() + ":" + dataSource.getDataSourceDatabaseName();
|
||||||
|
}
|
||||||
|
if ("sqlserver".equals(dataType.getDataType())) {
|
||||||
|
driveClass = dataType.getDriverManager();
|
||||||
|
jdbcUrl = dataType.getJdbcPre() + dataSource.getDataSourceIp() + ":" + dataSource.getDataSourcePort() + ";databaseName=" + dataSource.getDataSourceDatabaseName();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// redis
|
||||||
|
//连接指定的redis
|
||||||
|
Jedis jedis = new Jedis(dataSource.getDataSourceIp(), Integer.valueOf(dataSource.getDataSourcePort()));
|
||||||
|
//如果有密码则需要下面这一行
|
||||||
|
if (dataSource.getDataSourcePassword() != null && !dataSource.getDataSourcePassword().equals("")) {
|
||||||
|
jedis.auth(dataSource.getDataSourcePassword());
|
||||||
|
}
|
||||||
|
//查看服务是否运行,运行正常的话返回一个PONG,否则返回一个连接错误
|
||||||
|
try {
|
||||||
|
jedis.ping();
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println(e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else { // 如果他存在就给他修改
|
||||||
|
AssetStructure entity = AssetStructure.dataSourceUpdateBuilder(assetStructure, id, dataSource);
|
||||||
|
|
||||||
|
// 修改资产结构
|
||||||
|
assetStructureService.update(
|
||||||
|
entity, new LambdaUpdateWrapper<AssetStructure>()
|
||||||
|
.eq(AssetStructure::getId, entity.getId())
|
||||||
|
);
|
||||||
|
|
||||||
|
// 删除资产结构表信息
|
||||||
|
assetStructureTableService.remove(
|
||||||
|
new LambdaQueryWrapper<AssetStructureTable>()
|
||||||
|
.eq(AssetStructureTable::getAssetStructureId, entity.getId())
|
||||||
|
);
|
||||||
|
|
||||||
|
String jdbcUrl = "";
|
||||||
|
String driveClass = "";
|
||||||
|
DataType dataType = dataTypeService.getOne(
|
||||||
|
new LambdaQueryWrapper<DataType>()
|
||||||
|
.eq(DataType::getId, dataSource.getTypeId())
|
||||||
|
);
|
||||||
|
try {
|
||||||
|
List<AssetStructureTable> assetStructureTableList = new ArrayList<>();
|
||||||
|
if (dataType.getDriverManager() != null && dataType.getJdbcPre() != null) {
|
||||||
|
if ("mysql".equals(dataType.getDataType())) {
|
||||||
|
driveClass = dataType.getDriverManager();
|
||||||
|
jdbcUrl = dataType.getJdbcPre() + dataSource.getDataSourceIp() + ":" + dataSource.getDataSourcePort() + "/" + dataSource.getDataSourceDatabaseName() + "?" + dataSource.getAdditionalConfiguration();
|
||||||
|
// 加载数据库驱动
|
||||||
|
Class.forName(driveClass);
|
||||||
|
// 连接数据库
|
||||||
|
Connection conn = DriverManager.getConnection(jdbcUrl, dataSource.getDataSourceUsername(), dataSource.getDataSourcePassword());
|
||||||
|
Statement st = conn.createStatement();
|
||||||
|
ResultSet rs = st.executeQuery("select * from information_schema.tables where TABLE_SCHEMA = " + "'" + dataSource.getDataSourceDatabaseName() + "'");
|
||||||
|
while (rs.next()) {
|
||||||
|
// 获取表名
|
||||||
|
String tableName = rs.getString("TABLE_NAME");
|
||||||
|
// 表注释
|
||||||
|
String tableNameAnnotation = rs.getString("TABLE_COMMENT");
|
||||||
|
// 添加数据
|
||||||
|
// 表数据数量
|
||||||
|
assetStructureTableList.add(
|
||||||
|
new AssetStructureTable() {{
|
||||||
|
setAssetStructureId(entity.getId());
|
||||||
|
setTableName(tableName);
|
||||||
|
setTableNameAnnotation(tableNameAnnotation);
|
||||||
|
}}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
assetStructureTableList.stream().forEach(assetStructureTable -> {
|
||||||
|
try {
|
||||||
|
ResultSet rs2 = st.executeQuery("select count(*) as countNum from " + assetStructureTable.getTableName());
|
||||||
|
while (rs2.next()) {
|
||||||
|
assetStructureTable.setTableDataCount(rs2.getLong("countNum"));
|
||||||
|
}
|
||||||
|
rs2.close();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
conn.close();
|
||||||
|
st.close();
|
||||||
|
rs.close();
|
||||||
|
// 批量插入
|
||||||
|
assetStructureTableService.saveBatch(assetStructureTableList);
|
||||||
|
}
|
||||||
|
if ("oracle".equals(dataType.getDataType())) {
|
||||||
|
driveClass = dataType.getDriverManager();
|
||||||
|
jdbcUrl = dataType.getJdbcPre() + dataSource.getDataSourceIp() + ":" + dataSource.getDataSourcePort() + ":" + dataSource.getDataSourceDatabaseName();
|
||||||
|
}
|
||||||
|
if ("sqlserver".equals(dataType.getDataType())) {
|
||||||
|
driveClass = dataType.getDriverManager();
|
||||||
|
jdbcUrl = dataType.getJdbcPre() + dataSource.getDataSourceIp() + ":" + dataSource.getDataSourcePort() + ";databaseName=" + dataSource.getDataSourceDatabaseName();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// redis
|
||||||
|
//连接指定的redis
|
||||||
|
Jedis jedis = new Jedis(dataSource.getDataSourceIp(), Integer.valueOf(dataSource.getDataSourcePort()));
|
||||||
|
//如果有密码则需要下面这一行
|
||||||
|
if (dataSource.getDataSourcePassword() != null && !dataSource.getDataSourcePassword().equals("")) {
|
||||||
|
jedis.auth(dataSource.getDataSourcePassword());
|
||||||
|
}
|
||||||
|
//查看服务是否运行,运行正常的话返回一个PONG,否则返回一个连接错误
|
||||||
|
try {
|
||||||
|
jedis.ping();
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println(e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 如果连接失败并存在就给他删除
|
||||||
|
if (assetStructure != null) {
|
||||||
|
// 删除
|
||||||
|
assetStructureService.removeById(assetStructure.getId());
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测试数据源连接是否有效
|
||||||
|
*
|
||||||
|
* @param driveClass 驱动类
|
||||||
|
* @param url 连接
|
||||||
|
* @param username 用户名
|
||||||
|
* @param password 密码
|
||||||
|
* @return 布尔
|
||||||
|
*/
|
||||||
|
public static boolean testDatasource(String driveClass, String url, String username, String password) {
|
||||||
try {
|
try {
|
||||||
conn = DriverManager.getConnection(jdbcUrl, user, password);
|
Class.forName(driveClass);
|
||||||
|
DriverManager.getConnection(url, username, password);
|
||||||
pst= conn.prepareStatement ( "select * from city " );
|
return true;
|
||||||
|
} catch (Exception e) {
|
||||||
ResultSet resultSet = pst.executeQuery ( );
|
return false;
|
||||||
ResultSetMetaData resultSetMetaData = resultSet.getMetaData ( );
|
|
||||||
|
|
||||||
// 获取列数
|
|
||||||
int columnCount = resultSetMetaData.getColumnCount();
|
|
||||||
// 获取每列的信息,注意列的序列从1开始
|
|
||||||
for (int i = 1; i <= columnCount; i++) {
|
|
||||||
// 获取列名并打印
|
|
||||||
String columnName = resultSetMetaData.getColumnName(i);
|
|
||||||
System.out.print(" " + columnName + " ");
|
|
||||||
}
|
|
||||||
System.out.println();// 换行
|
|
||||||
|
|
||||||
// 将每行数据存储在Vector集合中
|
|
||||||
Vector< Vector<String> > rowData = new Vector<>();
|
|
||||||
while (resultSet.next()){
|
|
||||||
Vector<String> columnData = new Vector<>();
|
|
||||||
for (int i = 1; i <= columnCount; i++) {
|
|
||||||
columnData.add(resultSet.getString(i));
|
|
||||||
}
|
|
||||||
rowData.add(columnData);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 第一层循环遍历每行数据
|
|
||||||
for (int i = 0; i < rowData.size(); i++) {
|
|
||||||
Vector<String> columnData = rowData.get(i);
|
|
||||||
// 第二层循环遍历每行中每列数据
|
|
||||||
for (int j = 0; j < columnData.size(); j++) {
|
|
||||||
System.out.print(" " + columnData.get(j) + " ");
|
|
||||||
}
|
|
||||||
System.out.println();// 换行
|
|
||||||
}
|
|
||||||
conn.close();
|
|
||||||
}catch (Exception e){
|
|
||||||
return Result.error("连接失败");
|
|
||||||
}
|
}
|
||||||
return Result.success("连接成功");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.etl.data.structure.controller;
|
||||||
|
|
||||||
|
import com.etl.common.core.domain.Result;
|
||||||
|
import com.etl.common.security.annotation.RequiresPermissions;
|
||||||
|
import com.etl.data.structure.domain.resp.AssetStructureResp;
|
||||||
|
import com.etl.data.structure.service.IAssetStructureService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据资产 Controller 层
|
||||||
|
*
|
||||||
|
* @author Chao
|
||||||
|
* @ClassName: AssetStructureController 数据资产 Controller 层
|
||||||
|
* @CreateTime: 2024/4/22 上午10:09
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/structure")
|
||||||
|
public class AssetStructureController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IAssetStructureService assetStructureService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据源信息列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("data:structure:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
public Result<AssetStructureResp> list() {
|
||||||
|
return Result.success(assetStructureService.selectAssetSouructureList());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
package com.etl.data.structure.controller;
|
||||||
|
|
||||||
|
import com.etl.common.core.domain.Result;
|
||||||
|
import com.etl.common.security.annotation.RequiresPermissions;
|
||||||
|
import com.etl.data.structure.domain.AssetStructureTable;
|
||||||
|
import com.etl.data.structure.service.IAssetStructureTableService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据资产表 Controller 层
|
||||||
|
*
|
||||||
|
* @author Chao
|
||||||
|
* @ClassName: AssetStructureTableController 数据资产表 Controller 层
|
||||||
|
* @CreateTime: 2024/4/22 下午7:28
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/structureTable")
|
||||||
|
public class AssetStructureTableController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IAssetStructureTableService assetStructureTableService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有的表
|
||||||
|
* @param assetStructureId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("data:structureTable:list")
|
||||||
|
@PostMapping("list/{assetStructureId}")
|
||||||
|
public Result<List<AssetStructureTable>> list(@PathVariable("assetStructureId") Long assetStructureId) {
|
||||||
|
return Result.success(assetStructureTableService.selectAssetSouructureTableList(assetStructureId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.etl.data.structure.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.etl.data.structure.domain.AssetStructure;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据资产Mapper接口
|
||||||
|
*
|
||||||
|
* @author Chao
|
||||||
|
* @ClassName: AssetStructureMapper 数据资产Mapper
|
||||||
|
* @CreateTime: 2024/4/22 下午2:12
|
||||||
|
*/
|
||||||
|
public interface AssetStructureMapper extends BaseMapper<AssetStructure> {
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.etl.data.structure.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.etl.data.structure.domain.AssetStructureTable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资产结构Mapper接口
|
||||||
|
*
|
||||||
|
* @author Chao
|
||||||
|
* @ClassName: AssetStructureTableMapper 资产结构Mapper接口
|
||||||
|
* @CreateTime: 2024/4/22 下午5:23
|
||||||
|
*/
|
||||||
|
public interface AssetStructureTableMapper extends BaseMapper<AssetStructureTable> {
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.etl.data.structure.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.etl.data.structure.domain.AssetStructure;
|
||||||
|
import com.etl.data.structure.domain.resp.AssetStructureResp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据资产Service 接口
|
||||||
|
*
|
||||||
|
* @author Chao
|
||||||
|
* @ClassName: IAssetStructureService 数据资产Service 接口
|
||||||
|
* @CreateTime: 2024/4/22 下午2:08
|
||||||
|
*/
|
||||||
|
public interface IAssetStructureService extends IService<AssetStructure> {
|
||||||
|
/**
|
||||||
|
* 查询数据资产列表
|
||||||
|
*
|
||||||
|
* @return 数据资产集合
|
||||||
|
*/
|
||||||
|
AssetStructureResp selectAssetSouructureList();
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.etl.data.structure.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.etl.data.structure.domain.AssetStructureTable;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资产结构表表Service接口
|
||||||
|
*
|
||||||
|
* @author Chao
|
||||||
|
* @ClassName: IAssetStructureTableService 资产结构表表Service接口
|
||||||
|
* @CreateTime: 2024/4/22 下午5:21
|
||||||
|
*/
|
||||||
|
public interface IAssetStructureTableService extends IService<AssetStructureTable> {
|
||||||
|
/**
|
||||||
|
* 查询该数据资产表
|
||||||
|
* @param assetStructureId 数据资产id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<AssetStructureTable> selectAssetSouructureTableList(Long assetStructureId );
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
package com.etl.data.structure.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.etl.data.structure.domain.AssetStructure;
|
||||||
|
import com.etl.data.structure.domain.AssetStructureTable;
|
||||||
|
import com.etl.data.structure.domain.resp.AssetStructureResp;
|
||||||
|
import com.etl.data.structure.mapper.AssetStructureMapper;
|
||||||
|
import com.etl.data.structure.service.IAssetStructureService;
|
||||||
|
import com.etl.data.structure.service.IAssetStructureTableService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据资产Service 业务实现层
|
||||||
|
*
|
||||||
|
* @author Chao
|
||||||
|
* @ClassName: AssetStructureServiceImpl 数据资产Service 业务实现层
|
||||||
|
* @CreateTime: 2024/4/22 下午2:10
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class AssetStructureServiceImpl extends ServiceImpl<AssetStructureMapper, AssetStructure> implements IAssetStructureService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IAssetStructureTableService assetStructureTableService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据资产列表
|
||||||
|
*
|
||||||
|
* @return 数据资产列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AssetStructureResp selectAssetSouructureList() {
|
||||||
|
// 创建一个列表
|
||||||
|
List<AssetStructure> assetStructureList = this.list();
|
||||||
|
|
||||||
|
List<AssetStructureTable> assetStructureTableList = assetStructureTableService.list();
|
||||||
|
|
||||||
|
// 统计数据
|
||||||
|
long assetStructureTableCount = assetStructureTableList.size();
|
||||||
|
// 统计数据总数
|
||||||
|
long assetStructureTableDataCount;
|
||||||
|
|
||||||
|
|
||||||
|
assetStructureTableDataCount = assetStructureTableList.stream().mapToLong(AssetStructureTable::getTableDataCount).sum();
|
||||||
|
|
||||||
|
return new AssetStructureResp(){{
|
||||||
|
setAssetStructureList(assetStructureList);
|
||||||
|
setAssetStructureTableCount(assetStructureTableCount);
|
||||||
|
setAssetStructureTableDataCount(assetStructureTableDataCount);
|
||||||
|
}};
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.etl.data.structure.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.etl.data.structure.domain.AssetStructureTable;
|
||||||
|
import com.etl.data.structure.mapper.AssetStructureTableMapper;
|
||||||
|
import com.etl.data.structure.service.IAssetStructureTableService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资产结构表表Service业务实现层
|
||||||
|
*
|
||||||
|
* @author Chao
|
||||||
|
* @ClassName: AssetStructureTableServiceImpl 资产结构表表Service业务实现层
|
||||||
|
* @CreateTime: 2024/4/22 下午5:22
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class AssetStructureTableServiceImpl extends ServiceImpl<AssetStructureTableMapper, AssetStructureTable> implements IAssetStructureTableService {
|
||||||
|
/**
|
||||||
|
* 查询该数据资产表
|
||||||
|
* @param assetStructureId 数据资产id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<AssetStructureTable> selectAssetSouructureTableList(Long assetStructureId) {
|
||||||
|
List<AssetStructureTable> list = this.list(
|
||||||
|
new LambdaQueryWrapper<AssetStructureTable>()
|
||||||
|
.eq(AssetStructureTable::getAssetStructureId, assetStructureId)
|
||||||
|
);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,91 @@
|
||||||
|
package com.etl.data.type.controller;
|
||||||
|
|
||||||
|
import com.etl.common.core.domain.Result;
|
||||||
|
import com.etl.common.core.utils.poi.ExcelUtil;
|
||||||
|
import com.etl.common.core.web.controller.BaseController;
|
||||||
|
import com.etl.common.core.web.page.TableDataInfo;
|
||||||
|
import com.etl.common.log.annotation.Log;
|
||||||
|
import com.etl.common.log.enums.BusinessType;
|
||||||
|
import com.etl.common.security.annotation.RequiresPermissions;
|
||||||
|
import com.etl.data.type.domain.DataType;
|
||||||
|
import com.etl.data.type.service.IDataTypeService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源类型Controller
|
||||||
|
*
|
||||||
|
* @author Chao
|
||||||
|
* @date 2024-04-21
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/type")
|
||||||
|
public class DataTypeController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private IDataTypeService dataTypeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据源类型列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("data:type:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<TableDataInfo<DataType>> list(DataType dataType) {
|
||||||
|
startPage();
|
||||||
|
List<DataType> list = dataTypeService.selectDataTypeList(dataType);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出数据源类型列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("data:type:export")
|
||||||
|
@Log(title = "数据源类型", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, DataType dataType) {
|
||||||
|
List<DataType> list = dataTypeService.selectDataTypeList(dataType);
|
||||||
|
ExcelUtil<DataType> util = new ExcelUtil<DataType>(DataType.class);
|
||||||
|
util.exportExcel(response, list, "数据源类型数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取数据源类型详细信息
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("data:type:query")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public Result getInfo(@PathVariable("id") Long id) {
|
||||||
|
return success(dataTypeService.selectDataTypeById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据源类型
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("data:type:add")
|
||||||
|
@Log(title = "数据源类型", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public Result add(@RequestBody DataType dataType) {
|
||||||
|
return toAjax(dataTypeService.insertDataType(dataType));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改数据源类型
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("data:type:edit")
|
||||||
|
@Log(title = "数据源类型", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public Result edit(@RequestBody DataType dataType) {
|
||||||
|
return toAjax(dataTypeService.updateDataType(dataType));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除数据源类型
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("data:type:remove")
|
||||||
|
@Log(title = "数据源类型", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public Result remove(@PathVariable Long[] ids) {
|
||||||
|
return toAjax(dataTypeService.deleteDataTypeByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,62 @@
|
||||||
|
package com.etl.data.type.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.etl.data.type.domain.DataType;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源类型Mapper接口
|
||||||
|
*
|
||||||
|
* @author Chao
|
||||||
|
* @date 2024-04-21
|
||||||
|
*/
|
||||||
|
public interface DataTypeMapper extends BaseMapper<DataType> {
|
||||||
|
/**
|
||||||
|
* 查询数据源类型
|
||||||
|
*
|
||||||
|
* @param id 数据源类型主键
|
||||||
|
* @return 数据源类型
|
||||||
|
*/
|
||||||
|
public DataType selectDataTypeById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据源类型列表
|
||||||
|
*
|
||||||
|
* @param dataType 数据源类型
|
||||||
|
* @return 数据源类型集合
|
||||||
|
*/
|
||||||
|
public List<DataType> selectDataTypeList(DataType dataType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据源类型
|
||||||
|
*
|
||||||
|
* @param dataType 数据源类型
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertDataType(DataType dataType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改数据源类型
|
||||||
|
*
|
||||||
|
* @param dataType 数据源类型
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateDataType(DataType dataType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除数据源类型
|
||||||
|
*
|
||||||
|
* @param id 数据源类型主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteDataTypeById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除数据源类型
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteDataTypeByIds(Long[] ids);
|
||||||
|
}
|
|
@ -0,0 +1,62 @@
|
||||||
|
package com.etl.data.type.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.etl.data.type.domain.DataType;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源类型Service接口
|
||||||
|
*
|
||||||
|
* @author Chao
|
||||||
|
* @date 2024-04-21
|
||||||
|
*/
|
||||||
|
public interface IDataTypeService extends IService<DataType> {
|
||||||
|
/**
|
||||||
|
* 查询数据源类型
|
||||||
|
*
|
||||||
|
* @param id 数据源类型主键
|
||||||
|
* @return 数据源类型
|
||||||
|
*/
|
||||||
|
public DataType selectDataTypeById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据源类型列表
|
||||||
|
*
|
||||||
|
* @param dataType 数据源类型
|
||||||
|
* @return 数据源类型集合
|
||||||
|
*/
|
||||||
|
public List<DataType> selectDataTypeList(DataType dataType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据源类型
|
||||||
|
*
|
||||||
|
* @param dataType 数据源类型
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertDataType(DataType dataType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改数据源类型
|
||||||
|
*
|
||||||
|
* @param dataType 数据源类型
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateDataType(DataType dataType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除数据源类型
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据源类型主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteDataTypeByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除数据源类型信息
|
||||||
|
*
|
||||||
|
* @param id 数据源类型主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteDataTypeById(Long id);
|
||||||
|
}
|
|
@ -0,0 +1,102 @@
|
||||||
|
package com.etl.data.type.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.etl.common.core.utils.DateUtils;
|
||||||
|
import com.etl.data.type.domain.DataType;
|
||||||
|
import com.etl.data.type.mapper.DataTypeMapper;
|
||||||
|
import com.etl.data.type.service.IDataTypeService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源类型Service业务层处理
|
||||||
|
*
|
||||||
|
* @author Chao
|
||||||
|
* @date 2024-04-21
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class DataTypeServiceImpl extends ServiceImpl<DataTypeMapper, DataType> implements IDataTypeService {
|
||||||
|
@Autowired
|
||||||
|
private DataTypeMapper dataTypeMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据源类型
|
||||||
|
*
|
||||||
|
* @param id 数据源类型主键
|
||||||
|
* @return 数据源类型
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public DataType selectDataTypeById(Long id) {
|
||||||
|
return dataTypeMapper.selectDataTypeById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据源类型列表
|
||||||
|
*
|
||||||
|
* @param dataType 数据源类型
|
||||||
|
* @return 数据源类型
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<DataType> selectDataTypeList(DataType dataType) {
|
||||||
|
return dataTypeMapper.selectDataTypeList(dataType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据源类型
|
||||||
|
*
|
||||||
|
* @param dataType 数据源类型
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertDataType(DataType dataType) {
|
||||||
|
dataType.setCreateTime(DateUtils.getNowDate());
|
||||||
|
dataType.setDataType(lowerCase(dataType.getDataType()));
|
||||||
|
return dataTypeMapper.insertDataType(dataType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改数据源类型
|
||||||
|
*
|
||||||
|
* @param dataType 数据源类型
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateDataType(DataType dataType) {
|
||||||
|
dataType.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
dataType.setDataType(lowerCase(dataType.getDataType()));
|
||||||
|
return dataTypeMapper.updateDataType(dataType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除数据源类型
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据源类型主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteDataTypeByIds(Long[] ids) {
|
||||||
|
return dataTypeMapper.deleteDataTypeByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除数据源类型信息
|
||||||
|
*
|
||||||
|
* @param id 数据源类型主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteDataTypeById(Long id) {
|
||||||
|
return dataTypeMapper.deleteDataTypeById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将所有的大写转换成小写并清除中间所有的空格
|
||||||
|
* @param str 需要转换的参数
|
||||||
|
* @return 转换后的参数
|
||||||
|
*/
|
||||||
|
public static String lowerCase(String str){
|
||||||
|
return str.toLowerCase().replaceAll(" ","");
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,130 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.etl.data.source.mapper.DataSourceMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.etl.data.source.domain.DataSource" id="DataSourceResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="dataSourceName" column="data_source_name" />
|
||||||
|
<result property="dataSourceSystemName" column="data_source_system_name" />
|
||||||
|
<result property="typeId" column="type_id" />
|
||||||
|
<result property="dataSourceIp" column="data_source_ip" />
|
||||||
|
<result property="dataSourcePort" column="data_source_port" />
|
||||||
|
<result property="dataSourceDatabaseName" column="data_source_database_name" />
|
||||||
|
<result property="dataSourceUsername" column="data_source_username" />
|
||||||
|
<result property="dataSourcePassword" column="data_source_password" />
|
||||||
|
<result property="additionalConfiguration" column="additional_configuration" />
|
||||||
|
<result property="status" column="status" />
|
||||||
|
<result property="remark" column="remark" />
|
||||||
|
<result property="initialNumberOfConnections" column="initial_number_of_connections" />
|
||||||
|
<result property="maximumNumberOfConnections" column="maximum_number_of_connections" />
|
||||||
|
<result property="maximumWaitingTime" column="maximum_waiting_time" />
|
||||||
|
<result property="maximumWaitingTimes" column="maximum_waiting_times" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectDataSourceVo">
|
||||||
|
select id, data_source_name, data_source_system_name, type_id, data_source_ip, data_source_port, data_source_database_name, data_source_username, data_source_password, additional_configuration, status, remark, initial_number_of_connections, maximum_number_of_connections, maximum_waiting_time, maximum_waiting_times, create_by, create_time, update_by, update_time from data_source
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectDataSourceList" parameterType="com.etl.data.source.domain.DataSource" resultMap="DataSourceResult">
|
||||||
|
<include refid="selectDataSourceVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="typeId != null and typeId != ''"> and type_id = #{typeId}</if>
|
||||||
|
<if test="dataSourceName != null and dataSourceName != ''"> and data_source_name like concat('%', #{dataSourceName}, '%')</if>
|
||||||
|
<if test="dataSourceSystemName != null and dataSourceSystemName != ''"> and data_source_system_name like concat('%', #{dataSourceSystemName}, '%')</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDataSourceById" parameterType="Long" resultMap="DataSourceResult">
|
||||||
|
<include refid="selectDataSourceVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertDataSource" parameterType="com.etl.data.source.domain.DataSource" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into data_source
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="dataSourceName != null">data_source_name,</if>
|
||||||
|
<if test="dataSourceSystemName != null">data_source_system_name,</if>
|
||||||
|
<if test="typeId != null">type_id,</if>
|
||||||
|
<if test="dataSourceIp != null">data_source_ip,</if>
|
||||||
|
<if test="dataSourcePort != null">data_source_port,</if>
|
||||||
|
<if test="dataSourceDatabaseName != null">data_source_database_name,</if>
|
||||||
|
<if test="dataSourceUsername != null">data_source_username,</if>
|
||||||
|
<if test="dataSourcePassword != null">data_source_password,</if>
|
||||||
|
<if test="additionalConfiguration != null">additional_configuration,</if>
|
||||||
|
<if test="status != null">status,</if>
|
||||||
|
<if test="remark != null">remark,</if>
|
||||||
|
<if test="initialNumberOfConnections != null">initial_number_of_connections,</if>
|
||||||
|
<if test="maximumNumberOfConnections != null">maximum_number_of_connections,</if>
|
||||||
|
<if test="maximumWaitingTime != null">maximum_waiting_time,</if>
|
||||||
|
<if test="maximumWaitingTimes != null">maximum_waiting_times,</if>
|
||||||
|
<if test="createBy != null">create_by,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="updateBy != null">update_by,</if>
|
||||||
|
<if test="updateTime != null">update_time,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="dataSourceName != null">#{dataSourceName},</if>
|
||||||
|
<if test="dataSourceSystemName != null">#{dataSourceSystemName},</if>
|
||||||
|
<if test="typeId != null">#{typeId},</if>
|
||||||
|
<if test="dataSourceIp != null">#{dataSourceIp},</if>
|
||||||
|
<if test="dataSourcePort != null">#{dataSourcePort},</if>
|
||||||
|
<if test="dataSourceDatabaseName != null">#{dataSourceDatabaseName},</if>
|
||||||
|
<if test="dataSourceUsername != null">#{dataSourceUsername},</if>
|
||||||
|
<if test="dataSourcePassword != null">#{dataSourcePassword},</if>
|
||||||
|
<if test="additionalConfiguration != null">#{additionalConfiguration},</if>
|
||||||
|
<if test="status != null">#{status},</if>
|
||||||
|
<if test="remark != null">#{remark},</if>
|
||||||
|
<if test="initialNumberOfConnections != null">#{initialNumberOfConnections},</if>
|
||||||
|
<if test="maximumNumberOfConnections != null">#{maximumNumberOfConnections},</if>
|
||||||
|
<if test="maximumWaitingTime != null">#{maximumWaitingTime},</if>
|
||||||
|
<if test="maximumWaitingTimes != null">#{maximumWaitingTimes},</if>
|
||||||
|
<if test="createBy != null">#{createBy},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateDataSource" parameterType="com.etl.data.source.domain.DataSource">
|
||||||
|
update data_source
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="dataSourceName != null">data_source_name = #{dataSourceName},</if>
|
||||||
|
<if test="dataSourceSystemName != null">data_source_system_name = #{dataSourceSystemName},</if>
|
||||||
|
<if test="typeId != null">type_id = #{typeId},</if>
|
||||||
|
<if test="dataSourceIp != null">data_source_ip = #{dataSourceIp},</if>
|
||||||
|
<if test="dataSourcePort != null">data_source_port = #{dataSourcePort},</if>
|
||||||
|
<if test="dataSourceDatabaseName != null">data_source_database_name = #{dataSourceDatabaseName},</if>
|
||||||
|
<if test="dataSourceUsername != null">data_source_username = #{dataSourceUsername},</if>
|
||||||
|
<if test="dataSourcePassword != null">data_source_password = #{dataSourcePassword},</if>
|
||||||
|
<if test="additionalConfiguration != null">additional_configuration = #{additionalConfiguration},</if>
|
||||||
|
<if test="status != null">status = #{status},</if>
|
||||||
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
|
<if test="initialNumberOfConnections != null">initial_number_of_connections = #{initialNumberOfConnections},</if>
|
||||||
|
<if test="maximumNumberOfConnections != null">maximum_number_of_connections = #{maximumNumberOfConnections},</if>
|
||||||
|
<if test="maximumWaitingTime != null">maximum_waiting_time = #{maximumWaitingTime},</if>
|
||||||
|
<if test="maximumWaitingTimes != null">maximum_waiting_times = #{maximumWaitingTimes},</if>
|
||||||
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteDataSourceById" parameterType="Long">
|
||||||
|
delete from data_source where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteDataSourceByIds" parameterType="String">
|
||||||
|
delete from data_source where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
|
@ -0,0 +1,84 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.etl.data.type.mapper.DataTypeMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.etl.data.type.domain.DataType" id="DataTypeResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="dataType" column="data_type" />
|
||||||
|
<result property="driverManager" column="driver_manager" />
|
||||||
|
<result property="jdbcPre" column="jdbc_pre" />
|
||||||
|
<result property="remark" column="remark" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectDataTypeVo">
|
||||||
|
select id, data_type, driver_manager, jdbc_pre, remark, create_by, create_time, update_by, update_time from data_type
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectDataTypeList" parameterType="com.etl.data.type.domain.DataType" resultMap="DataTypeResult">
|
||||||
|
<include refid="selectDataTypeVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="dataType != null and dataType != ''"> and data_type like concat('%', #{dataType}, '%')</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDataTypeById" parameterType="Long" resultMap="DataTypeResult">
|
||||||
|
<include refid="selectDataTypeVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertDataType" parameterType="com.etl.data.type.domain.DataType" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into data_type
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="dataType != null">data_type,</if>
|
||||||
|
<if test="driverManager != null">driver_manager,</if>
|
||||||
|
<if test="jdbcPre != null">jdbc_pre,</if>
|
||||||
|
<if test="remark != null">remark,</if>
|
||||||
|
<if test="createBy != null">create_by,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="updateBy != null">update_by,</if>
|
||||||
|
<if test="updateTime != null">update_time,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="dataType != null">#{dataType},</if>
|
||||||
|
<if test="driverManager != null">#{driverManager},</if>
|
||||||
|
<if test="jdbcPre != null">#{jdbcPre},</if>
|
||||||
|
<if test="remark != null">#{remark},</if>
|
||||||
|
<if test="createBy != null">#{createBy},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateDataType" parameterType="com.etl.data.type.domain.DataType">
|
||||||
|
update data_type
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="dataType != null">data_type = #{dataType},</if>
|
||||||
|
<if test="driverManager != null">driver_manager = #{driverManager},</if>
|
||||||
|
<if test="jdbcPre != null">jdbc_pre = #{jdbcPre},</if>
|
||||||
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteDataTypeById" parameterType="Long">
|
||||||
|
delete from data_type where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteDataTypeByIds" parameterType="String">
|
||||||
|
delete from data_type where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
|
@ -1,138 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<!DOCTYPE mapper
|
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.etl.data.source.mapper.DataSourceMapper">
|
|
||||||
|
|
||||||
<resultMap type="com.etl.data.source.domain.DataSource" id="DataSourceResult">
|
|
||||||
<result property="id" column="id" />
|
|
||||||
<result property="name" column="name" />
|
|
||||||
<result property="systemName" column="systemName" />
|
|
||||||
<result property="host" column="host" />
|
|
||||||
<result property="port" column="port" />
|
|
||||||
<result property="username" column="username" />
|
|
||||||
<result property="password" column="password" />
|
|
||||||
<result property="type" column="type" />
|
|
||||||
<result property="databaseName" column="database_name" />
|
|
||||||
<result property="connectionParam" column="connection_param" />
|
|
||||||
<result property="initNum" column="init_num" />
|
|
||||||
<result property="maxNum" column="max_num" />
|
|
||||||
<result property="maxWaitTime" column="max_wait_time" />
|
|
||||||
<result property="maxWaitSize" column="max_wait_size" />
|
|
||||||
<result property="createBy" column="create_by" />
|
|
||||||
<result property="createTime" column="create_time" />
|
|
||||||
<result property="updateBy" column="update_by" />
|
|
||||||
<result property="updateTime" column="update_time" />
|
|
||||||
<result property="remark" column="remark" />
|
|
||||||
</resultMap>
|
|
||||||
|
|
||||||
<sql id="selectDataSourceVo">
|
|
||||||
select id, name, systemName, host, port, username, password, type, database_name, connection_param, init_num, max_num, max_wait_time, max_wait_size, create_by, create_time, update_by, update_time, remark from data_source
|
|
||||||
</sql>
|
|
||||||
|
|
||||||
<select id="selectDataSourceList" parameterType="com.etl.data.source.domain.DataSource" resultMap="DataSourceResult">
|
|
||||||
<include refid="selectDataSourceVo"/>
|
|
||||||
<where>
|
|
||||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
|
||||||
<if test="systemName != null and systemName != ''"> and systemName like concat('%', #{systemName}, '%')</if>
|
|
||||||
<if test="host != null and host != ''"> and host = #{host}</if>
|
|
||||||
<if test="port != null and port != ''"> and port = #{port}</if>
|
|
||||||
<if test="username != null and username != ''"> and username like concat('%', #{username}, '%')</if>
|
|
||||||
<if test="password != null and password != ''"> and password = #{password}</if>
|
|
||||||
<if test="type != null and type != ''"> and type = #{type}</if>
|
|
||||||
<if test="databaseName != null and databaseName != ''"> and database_name like concat('%', #{databaseName}, '%')</if>
|
|
||||||
<if test="connectionParam != null and connectionParam != ''"> and connection_param = #{connectionParam}</if>
|
|
||||||
<if test="initNum != null "> and init_num = #{initNum}</if>
|
|
||||||
<if test="maxNum != null "> and max_num = #{maxNum}</if>
|
|
||||||
<if test="maxWaitTime != null "> and max_wait_time = #{maxWaitTime}</if>
|
|
||||||
<if test="maxWaitSize != null "> and max_wait_size = #{maxWaitSize}</if>
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="selectDataSourceById" parameterType="Long" resultMap="DataSourceResult">
|
|
||||||
<include refid="selectDataSourceVo"/>
|
|
||||||
where id = #{id}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<insert id="insertDataSource" parameterType="com.etl.data.source.domain.DataSource">
|
|
||||||
insert into data_source
|
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="id != null">id,</if>
|
|
||||||
<if test="name != null">name,</if>
|
|
||||||
<if test="systemName != null">systemName,</if>
|
|
||||||
<if test="host != null">host,</if>
|
|
||||||
<if test="port != null">port,</if>
|
|
||||||
<if test="username != null">username,</if>
|
|
||||||
<if test="password != null">password,</if>
|
|
||||||
<if test="type != null">type,</if>
|
|
||||||
<if test="databaseName != null">database_name,</if>
|
|
||||||
<if test="connectionParam != null">connection_param,</if>
|
|
||||||
<if test="initNum != null">init_num,</if>
|
|
||||||
<if test="maxNum != null">max_num,</if>
|
|
||||||
<if test="maxWaitTime != null">max_wait_time,</if>
|
|
||||||
<if test="maxWaitSize != null">max_wait_size,</if>
|
|
||||||
<if test="createBy != null">create_by,</if>
|
|
||||||
<if test="createTime != null">create_time,</if>
|
|
||||||
<if test="updateBy != null">update_by,</if>
|
|
||||||
<if test="updateTime != null">update_time,</if>
|
|
||||||
<if test="remark != null">remark,</if>
|
|
||||||
</trim>
|
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="id != null">#{id},</if>
|
|
||||||
<if test="name != null">#{name},</if>
|
|
||||||
<if test="systemName != null">#{systemName},</if>
|
|
||||||
<if test="host != null">#{host},</if>
|
|
||||||
<if test="port != null">#{port},</if>
|
|
||||||
<if test="username != null">#{username},</if>
|
|
||||||
<if test="password != null">#{password},</if>
|
|
||||||
<if test="type != null">#{type},</if>
|
|
||||||
<if test="databaseName != null">#{databaseName},</if>
|
|
||||||
<if test="connectionParam != null">#{connectionParam},</if>
|
|
||||||
<if test="initNum != null">#{initNum},</if>
|
|
||||||
<if test="maxNum != null">#{maxNum},</if>
|
|
||||||
<if test="maxWaitTime != null">#{maxWaitTime},</if>
|
|
||||||
<if test="maxWaitSize != null">#{maxWaitSize},</if>
|
|
||||||
<if test="createBy != null">#{createBy},</if>
|
|
||||||
<if test="createTime != null">#{createTime},</if>
|
|
||||||
<if test="updateBy != null">#{updateBy},</if>
|
|
||||||
<if test="updateTime != null">#{updateTime},</if>
|
|
||||||
<if test="remark != null">#{remark},</if>
|
|
||||||
</trim>
|
|
||||||
</insert>
|
|
||||||
|
|
||||||
<update id="updateDataSource" parameterType="com.etl.data.source.domain.DataSource">
|
|
||||||
update data_source
|
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
|
||||||
<if test="name != null">name = #{name},</if>
|
|
||||||
<if test="systemName != null">systemName = #{systemName},</if>
|
|
||||||
<if test="host != null">host = #{host},</if>
|
|
||||||
<if test="port != null">port = #{port},</if>
|
|
||||||
<if test="username != null">username = #{username},</if>
|
|
||||||
<if test="password != null">password = #{password},</if>
|
|
||||||
<if test="type != null">type = #{type},</if>
|
|
||||||
<if test="databaseName != null">database_name = #{databaseName},</if>
|
|
||||||
<if test="connectionParam != null">connection_param = #{connectionParam},</if>
|
|
||||||
<if test="initNum != null">init_num = #{initNum},</if>
|
|
||||||
<if test="maxNum != null">max_num = #{maxNum},</if>
|
|
||||||
<if test="maxWaitTime != null">max_wait_time = #{maxWaitTime},</if>
|
|
||||||
<if test="maxWaitSize != null">max_wait_size = #{maxWaitSize},</if>
|
|
||||||
<if test="createBy != null">create_by = #{createBy},</if>
|
|
||||||
<if test="createTime != null">create_time = #{createTime},</if>
|
|
||||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
||||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
||||||
<if test="remark != null">remark = #{remark},</if>
|
|
||||||
</trim>
|
|
||||||
where id = #{id}
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<delete id="deleteDataSourceById" parameterType="Long">
|
|
||||||
delete from data_source where id = #{id}
|
|
||||||
</delete>
|
|
||||||
|
|
||||||
<delete id="deleteDataSourceByIds" parameterType="String">
|
|
||||||
delete from data_source where id in
|
|
||||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
||||||
#{id}
|
|
||||||
</foreach>
|
|
||||||
</delete>
|
|
||||||
</mapper>
|
|
|
@ -50,7 +50,7 @@ public class VelocityUtils {
|
||||||
VelocityContext velocityContext = new VelocityContext();
|
VelocityContext velocityContext = new VelocityContext();
|
||||||
velocityContext.put("tplCategory", genTable.getTplCategory());
|
velocityContext.put("tplCategory", genTable.getTplCategory());
|
||||||
velocityContext.put("tableName", genTable.getTableName());
|
velocityContext.put("tableName", genTable.getTableName());
|
||||||
velocityContext.put("functionName", StringUtils.isNotEmpty(functionName) ? functionName : "【请填写功能名称】");
|
velocityContext.put("functionName", StringUtils.isNotEmpty(functionName) ? functionName : "数据源");
|
||||||
velocityContext.put("ClassName", genTable.getClassName());
|
velocityContext.put("ClassName", genTable.getClassName());
|
||||||
velocityContext.put("className", StringUtils.uncapitalize(genTable.getClassName()));
|
velocityContext.put("className", StringUtils.uncapitalize(genTable.getClassName()));
|
||||||
velocityContext.put("moduleName", genTable.getModuleName());
|
velocityContext.put("moduleName", genTable.getModuleName());
|
||||||
|
|
Loading…
Reference in New Issue