feat:增加了数据资产结构(还差数据同步)
parent
1612ffd84b
commit
776e0ab77b
|
@ -14,12 +14,13 @@ spring:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 115.159.67.205:8848
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 115.159.67.205:8848
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
shared-configs:
|
shared-configs:
|
||||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
|
namespace: e47d9b61-1cb9-48b7-97b3-2692bfaf34a3
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class IpUtils {
|
||||||
ip = request.getRemoteAddr();
|
ip = request.getRemoteAddr();
|
||||||
}
|
}
|
||||||
|
|
||||||
return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : getMultistageReverseProxyIp(ip);
|
return "0:0:0:0:0:0:0:1".equals(ip) ? "115.159.67.205" : getMultistageReverseProxyIp(ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -70,7 +70,7 @@ public class IpUtils {
|
||||||
*/
|
*/
|
||||||
public static boolean internalIp (String ip) {
|
public static boolean internalIp (String ip) {
|
||||||
byte[] addr = textToNumericFormatV4(ip);
|
byte[] addr = textToNumericFormatV4(ip);
|
||||||
return internalIp(addr) || "127.0.0.1".equals(ip);
|
return internalIp(addr) || "115.159.67.205".equals(ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -197,7 +197,7 @@ public class IpUtils {
|
||||||
return InetAddress.getLocalHost().getHostAddress();
|
return InetAddress.getLocalHost().getHostAddress();
|
||||||
} catch (UnknownHostException e) {
|
} catch (UnknownHostException e) {
|
||||||
}
|
}
|
||||||
return "127.0.0.1";
|
return "115.159.67.205";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -14,26 +14,27 @@ spring:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 115.159.67.205:8848
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 115.159.67.205:8848
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
shared-configs:
|
shared-configs:
|
||||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
|
namespace: e47d9b61-1cb9-48b7-97b3-2692bfaf34a3
|
||||||
sentinel:
|
sentinel:
|
||||||
# 取消控制台懒加载
|
# 取消控制台懒加载
|
||||||
eager: true
|
eager: true
|
||||||
transport:
|
transport:
|
||||||
# 控制台地址
|
# 控制台地址
|
||||||
dashboard: 127.0.0.1:8718
|
dashboard: 115.159.67.205:8718
|
||||||
# nacos配置持久化
|
# nacos配置持久化
|
||||||
datasource:
|
datasource:
|
||||||
ds1:
|
ds1:
|
||||||
nacos:
|
nacos:
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 115.159.67.205:8848
|
||||||
dataId: sentinel-muyu-gateway
|
dataId: sentinel-muyu-gateway
|
||||||
groupId: DEFAULT_GROUP
|
groupId: DEFAULT_GROUP
|
||||||
data-type: json
|
data-type: json
|
||||||
|
|
|
@ -14,12 +14,13 @@ spring:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 115.159.67.205:8848
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 115.159.67.205:8848
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
shared-configs:
|
shared-configs:
|
||||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
|
namespace: e47d9b61-1cb9-48b7-97b3-2692bfaf34a3
|
||||||
|
|
|
@ -14,12 +14,13 @@ spring:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 115.159.67.205:8848
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 115.159.67.205:8848
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
shared-configs:
|
shared-configs:
|
||||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
|
namespace: e47d9b61-1cb9-48b7-97b3-2692bfaf34a3
|
||||||
|
|
|
@ -14,12 +14,13 @@ spring:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 115.159.67.205:8848
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 115.159.67.205:8848
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
shared-configs:
|
shared-configs:
|
||||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
|
namespace: e47d9b61-1cb9-48b7-97b3-2692bfaf34a3
|
||||||
|
|
|
@ -0,0 +1,118 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
<relativePath>../../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<groupId>com.zx</groupId>
|
||||||
|
<artifactId>muyu-kvt</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<!-- SpringCloud Alibaba Nacos -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringCloud Alibaba Nacos Config -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringCloud Alibaba Sentinel -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringBoot Actuator -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Swagger UI -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.springfox</groupId>
|
||||||
|
<artifactId>springfox-swagger-ui</artifactId>
|
||||||
|
<version>${swagger.fox.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Mysql Connector -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-j</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- MuYu Common DataSource -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-common-datasource</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- MuYu Common DataScope -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-common-datascope</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- MuYu Common Log -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-common-log</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- MuYu Common Swagger -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-common-swagger</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>muyu-modules-system</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<finalName>${project.artifactId}</finalName>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>repackage</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<!-- 加入maven deploy插件,当在deploy时,忽略些model-->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-deploy-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<skip>true</skip>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.zx;
|
||||||
|
|
||||||
|
import com.muyu.common.security.annotation.EnableCustomConfig;
|
||||||
|
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||||
|
import com.muyu.common.swagger.annotation.EnableCustomSwagger2;
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassDescription:
|
||||||
|
* @JdkVersion: 17
|
||||||
|
* @Author: zhangxu
|
||||||
|
* @Created: 2024/4/20 10:57
|
||||||
|
*/// 按两次 Shift 打开“随处搜索”对话框并输入 `show whitespaces`,
|
||||||
|
// 然后按 Enter 键。现在,您可以在代码中看到空格字符。
|
||||||
|
@EnableCustomConfig
|
||||||
|
@EnableCustomSwagger2
|
||||||
|
@EnableMyFeignClients
|
||||||
|
@SpringBootApplication
|
||||||
|
@MapperScan("com.zx.mapper")
|
||||||
|
public class MuYuKVTApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(MuYuKVTApplication.class);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.zx.controller;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassDescription:
|
||||||
|
* @JdkVersion: 17
|
||||||
|
* @Author: zhangxu
|
||||||
|
* @Created: 2024/4/23 8:39
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
public class AssetModulesController {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,129 @@
|
||||||
|
package com.zx.controller;
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
|
|
||||||
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
|
import com.muyu.common.log.annotation.Log;
|
||||||
|
import com.muyu.common.log.enums.BusinessType;
|
||||||
|
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
|
|
||||||
|
import com.zx.domain.req.JdbcClass;
|
||||||
|
import com.zx.service.Impl.KvtService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/** 控制层
|
||||||
|
* @ClassDescription:
|
||||||
|
* @JdkVersion: 17
|
||||||
|
* @Author: zhangxu
|
||||||
|
* @Created: 2024/4/20 11:21
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/jdbc")
|
||||||
|
public class KvtController extends BaseController {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private KvtService kvtService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询【请填写功能名称】列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("kvt:jdbc:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<TableDataInfo<JdbcClass>> list(JdbcClass dataSource)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<JdbcClass> list = kvtService.selectList(dataSource);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出【请填写功能名称】列表
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取【请填写功能名称】详细信息
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("kvt:jdbc:query")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public Result getInfo(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
return success(kvtService.selectJdbcById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增【请填写功能名称】
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("kvt:jdbc:add")
|
||||||
|
@Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public Result add(@RequestBody JdbcClass dataSource)
|
||||||
|
{
|
||||||
|
return toAjax(kvtService.insertJdbc(dataSource));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测试连接
|
||||||
|
*/
|
||||||
|
@Log(title = "测试连接", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/TestConn")
|
||||||
|
public Result testConnection(@RequestBody JdbcClass dataSource) throws ClassNotFoundException {
|
||||||
|
return kvtService.testConn(dataSource);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改【请填写功能名称】
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("kvt:jdbc:edit")
|
||||||
|
@Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public Result edit(@RequestBody JdbcClass dataSource)
|
||||||
|
{
|
||||||
|
return toAjax(kvtService.updateJdbc(dataSource));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除【请填写功能名称】
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("kvt:jdbc:remove")
|
||||||
|
@Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public Result remove(@PathVariable Long[] ids)
|
||||||
|
{
|
||||||
|
return toAjax(kvtService.deleteAllJdbc(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("assesList")
|
||||||
|
public Result assesList(@RequestBody JdbcClass jdbcClass){
|
||||||
|
return kvtService.assesList(jdbcClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("getDataBig")
|
||||||
|
public Result getDataBig(@RequestBody JdbcClass jdbcClass){
|
||||||
|
return kvtService.getTableList(jdbcClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("getCount")
|
||||||
|
public Result getCount(@RequestBody JdbcClass jdbcClass){
|
||||||
|
return kvtService.getCount(jdbcClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.zx.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.lang.ref.PhantomReference;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassDescription:
|
||||||
|
* @JdkVersion: 17
|
||||||
|
* @Author: zhangxu
|
||||||
|
* @Created: 2024/4/21 22:31
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class AssetsData {
|
||||||
|
|
||||||
|
private HashMap<String, String> tableAssets;
|
||||||
|
|
||||||
|
private List<Map<String,DataKvt>> kvtList;
|
||||||
|
|
||||||
|
private List<TableAssets> tableAssetsList;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.zx.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/** 类型 K T
|
||||||
|
*
|
||||||
|
* @ClassDescription:
|
||||||
|
* @JdkVersion: 17
|
||||||
|
* @Author: zhangxu
|
||||||
|
* @Created: 2024/4/20 10:03
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class DataKvt {
|
||||||
|
/**
|
||||||
|
* 值
|
||||||
|
*
|
||||||
|
* */
|
||||||
|
private String value;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 类型
|
||||||
|
* */
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,234 @@
|
||||||
|
package com.zx.domain;
|
||||||
|
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
/** 链接数据库的地址
|
||||||
|
* @ClassDescription:
|
||||||
|
* @JdkVersion: 17
|
||||||
|
* @Author: zhangxu
|
||||||
|
* @Created: 2024/4/20 9:37
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class JdbcClass extends BaseEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** $column.columnComment */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** $column.columnComment */
|
||||||
|
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||||
|
private String dataSourceName;
|
||||||
|
|
||||||
|
/** $column.columnComment */
|
||||||
|
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||||
|
private String linkAddress;
|
||||||
|
|
||||||
|
private String sql;
|
||||||
|
|
||||||
|
private String tableName;
|
||||||
|
|
||||||
|
/** $column.columnComment */
|
||||||
|
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||||
|
private String port;
|
||||||
|
|
||||||
|
/** $column.columnComment */
|
||||||
|
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||||
|
private String databaseName;
|
||||||
|
|
||||||
|
/** $column.columnComment */
|
||||||
|
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
/** $column.columnComment */
|
||||||
|
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
/** 数据连接参数 */
|
||||||
|
@Excel(name = "数据连接参数")
|
||||||
|
private String connectionParam;
|
||||||
|
|
||||||
|
/** 初始连接数量 */
|
||||||
|
@Excel(name = "初始连接数量")
|
||||||
|
private Long initNum;
|
||||||
|
|
||||||
|
/** 最大连接数量 */
|
||||||
|
@Excel(name = "最大连接数量")
|
||||||
|
private Long maxNum;
|
||||||
|
|
||||||
|
/** 最大等待时间 */
|
||||||
|
@Excel(name = "最大等待时间")
|
||||||
|
private Long maxWaitTime;
|
||||||
|
|
||||||
|
/** 最大等待次数 */
|
||||||
|
@Excel(name = "最大等待次数")
|
||||||
|
private Long maxWaitSize;
|
||||||
|
|
||||||
|
/** $column.columnComment */
|
||||||
|
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/** 数据来源名称 */
|
||||||
|
@Excel(name = "数据来源名称")
|
||||||
|
private String systemName;
|
||||||
|
|
||||||
|
public void setId(Long id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
public void setDataSourceName(String dataSourceName)
|
||||||
|
{
|
||||||
|
this.dataSourceName = dataSourceName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDataSourceName()
|
||||||
|
{
|
||||||
|
return dataSourceName;
|
||||||
|
}
|
||||||
|
public void setLinkAddress(String linkAddress)
|
||||||
|
{
|
||||||
|
this.linkAddress = linkAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLinkAddress()
|
||||||
|
{
|
||||||
|
return this.linkAddress;
|
||||||
|
}
|
||||||
|
public void setPort(String port)
|
||||||
|
{
|
||||||
|
this.port = port;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPort()
|
||||||
|
{
|
||||||
|
return port;
|
||||||
|
}
|
||||||
|
public void setDatabaseName(String databaseName)
|
||||||
|
{
|
||||||
|
this.databaseName = databaseName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDatabaseName()
|
||||||
|
{
|
||||||
|
return databaseName;
|
||||||
|
}
|
||||||
|
public void setUsername(String username)
|
||||||
|
{
|
||||||
|
this.username = username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUsername()
|
||||||
|
{
|
||||||
|
return username;
|
||||||
|
}
|
||||||
|
public void setPassword(String password)
|
||||||
|
{
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPassword()
|
||||||
|
{
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
public void setConnectionParam(String connectionParam)
|
||||||
|
{
|
||||||
|
this.connectionParam = connectionParam;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getConnectionParam()
|
||||||
|
{
|
||||||
|
return connectionParam;
|
||||||
|
}
|
||||||
|
public void setInitNum(Long initNum)
|
||||||
|
{
|
||||||
|
this.initNum = initNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getInitNum()
|
||||||
|
{
|
||||||
|
return initNum;
|
||||||
|
}
|
||||||
|
public void setMaxNum(Long maxNum)
|
||||||
|
{
|
||||||
|
this.maxNum = maxNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getMaxNum()
|
||||||
|
{
|
||||||
|
return maxNum;
|
||||||
|
}
|
||||||
|
public void setMaxWaitTime(Long maxWaitTime)
|
||||||
|
{
|
||||||
|
this.maxWaitTime = maxWaitTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getMaxWaitTime()
|
||||||
|
{
|
||||||
|
return maxWaitTime;
|
||||||
|
}
|
||||||
|
public void setMaxWaitSize(Long maxWaitSize)
|
||||||
|
{
|
||||||
|
this.maxWaitSize = maxWaitSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getMaxWaitSize()
|
||||||
|
{
|
||||||
|
return maxWaitSize;
|
||||||
|
}
|
||||||
|
public void setType(String type)
|
||||||
|
{
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType()
|
||||||
|
{
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
public void setSystemName(String systemName)
|
||||||
|
{
|
||||||
|
this.systemName = systemName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSystemName()
|
||||||
|
{
|
||||||
|
return systemName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("dataSourceName", getDataSourceName())
|
||||||
|
.append("linkAddress", getLinkAddress())
|
||||||
|
.append("port", getPort())
|
||||||
|
.append("databaseName", getDatabaseName())
|
||||||
|
.append("username", getUsername())
|
||||||
|
.append("password", getPassword())
|
||||||
|
.append("connectionParam", getConnectionParam())
|
||||||
|
.append("initNum", getInitNum())
|
||||||
|
.append("maxNum", getMaxNum())
|
||||||
|
.append("maxWaitTime", getMaxWaitTime())
|
||||||
|
.append("maxWaitSize", getMaxWaitSize())
|
||||||
|
.append("createBy", getCreateBy())
|
||||||
|
.append("createTime", getCreateTime())
|
||||||
|
.append("updateBy", getUpdateBy())
|
||||||
|
.append("updateTime", getUpdateTime())
|
||||||
|
.append("remark", getRemark())
|
||||||
|
.append("type", getType())
|
||||||
|
.append("systemName", getSystemName())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
package com.zx.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassDescription:
|
||||||
|
* @JdkVersion: 17
|
||||||
|
* @Author: zhangXu
|
||||||
|
* @Created: 2024/4/22 19:13
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class Structure {
|
||||||
|
/**
|
||||||
|
*字段
|
||||||
|
* */
|
||||||
|
private String COLUMN_NAME;
|
||||||
|
/**
|
||||||
|
*注释
|
||||||
|
* */
|
||||||
|
private String COLUMN_COMMENT;
|
||||||
|
/**
|
||||||
|
*主键
|
||||||
|
* */
|
||||||
|
private String PRIMARY;
|
||||||
|
/**
|
||||||
|
*数据类型
|
||||||
|
* */
|
||||||
|
private String DATA_TYPE;
|
||||||
|
/**
|
||||||
|
*最大长度
|
||||||
|
* */
|
||||||
|
private String CHARACTER_MAXIMUM;
|
||||||
|
/**
|
||||||
|
*是否为空
|
||||||
|
* */
|
||||||
|
private String IS_NULLABLE;
|
||||||
|
/**
|
||||||
|
*默认值
|
||||||
|
* */
|
||||||
|
private String COLUMN_DEFAULT;
|
||||||
|
/**
|
||||||
|
*类型加长度
|
||||||
|
* */
|
||||||
|
private String COLUMN_TYPE;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.zx.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassDescription:
|
||||||
|
* @JdkVersion: 17
|
||||||
|
* @Author: zhangxu
|
||||||
|
* @Created: 2024/4/21 20:05
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class TableAssets {
|
||||||
|
|
||||||
|
private String Field;
|
||||||
|
|
||||||
|
private String Type;
|
||||||
|
|
||||||
|
private String Null;
|
||||||
|
|
||||||
|
private String Key;
|
||||||
|
|
||||||
|
private String Default;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,110 @@
|
||||||
|
package com.zx.domain.req;
|
||||||
|
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassDescription:
|
||||||
|
* @JdkVersion: 17
|
||||||
|
* @Author: zhangxu
|
||||||
|
* @Created: 2024/4/22 20:40
|
||||||
|
*/
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
public class AssetModel extends BaseEntity {
|
||||||
|
/**
|
||||||
|
*主键
|
||||||
|
*
|
||||||
|
* **/
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
*数据资产id
|
||||||
|
*
|
||||||
|
* **/
|
||||||
|
private Long dataAssetId;
|
||||||
|
/**
|
||||||
|
*字段名字
|
||||||
|
*
|
||||||
|
* **/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*字段备注
|
||||||
|
* **/
|
||||||
|
private String comment;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*是否主键
|
||||||
|
* **/
|
||||||
|
private String isPrimaryKey;
|
||||||
|
/**
|
||||||
|
*数据类型
|
||||||
|
*
|
||||||
|
* **/
|
||||||
|
private String type;
|
||||||
|
/**
|
||||||
|
*映射数据字典
|
||||||
|
*
|
||||||
|
* **/
|
||||||
|
private String mappingType;
|
||||||
|
/**
|
||||||
|
*长度
|
||||||
|
*
|
||||||
|
* **/
|
||||||
|
private String length;
|
||||||
|
/**
|
||||||
|
*小数位
|
||||||
|
*
|
||||||
|
* **/
|
||||||
|
private String decimalPlaces;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*是否不可以为空
|
||||||
|
* **/
|
||||||
|
private String isNull;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*是否是字典
|
||||||
|
* **/
|
||||||
|
private String isDict;
|
||||||
|
/**
|
||||||
|
*是否是默认值
|
||||||
|
*
|
||||||
|
* **/
|
||||||
|
private String defaultValue;
|
||||||
|
/**
|
||||||
|
*字典key
|
||||||
|
*
|
||||||
|
* **/
|
||||||
|
private String dictKey;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("dataAssetId", getDataAssetId())
|
||||||
|
.append("name", getName())
|
||||||
|
.append("comment", getComment())
|
||||||
|
.append("isPrimaryKey", getIsPrimaryKey())
|
||||||
|
.append("type", getType())
|
||||||
|
.append("mappingType", getMappingType())
|
||||||
|
.append("length", getLength())
|
||||||
|
.append("decimalPlaces", getDecimalPlaces())
|
||||||
|
.append("isNull", getIsNull())
|
||||||
|
.append("isDict", getIsDict())
|
||||||
|
.append("defaultValue", getDefaultValue())
|
||||||
|
.append("dictKey", getDictKey())
|
||||||
|
.append("createBy", getCreateBy())
|
||||||
|
.append("createTime", getCreateTime())
|
||||||
|
.append("updateBy", getUpdateBy())
|
||||||
|
.append("updateTime", getUpdateTime())
|
||||||
|
.append("remark", getRemark())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,239 @@
|
||||||
|
package com.zx.domain.req;
|
||||||
|
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/** 链接数据库的地址
|
||||||
|
* @ClassDescription:
|
||||||
|
* @JdkVersion: 17
|
||||||
|
* @Author: zhangxu
|
||||||
|
* @Created: 2024/4/20 9:37
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class JdbcClass extends BaseEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** $column.columnComment */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** $column.columnComment */
|
||||||
|
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||||
|
private String dataSourceName;
|
||||||
|
|
||||||
|
/** $column.columnComment */
|
||||||
|
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||||
|
private String linkAddress;
|
||||||
|
|
||||||
|
private String sql;
|
||||||
|
|
||||||
|
private String tableName;
|
||||||
|
|
||||||
|
/** $column.columnComment */
|
||||||
|
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||||
|
private String port;
|
||||||
|
|
||||||
|
/** $column.columnComment */
|
||||||
|
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||||
|
private String databaseName;
|
||||||
|
|
||||||
|
/** $column.columnComment */
|
||||||
|
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
/** $column.columnComment */
|
||||||
|
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
/** 数据连接参数 */
|
||||||
|
@Excel(name = "数据连接参数")
|
||||||
|
private String connectionParam;
|
||||||
|
|
||||||
|
/** 初始连接数量 */
|
||||||
|
@Excel(name = "初始连接数量")
|
||||||
|
private Long initNum;
|
||||||
|
|
||||||
|
/** 最大连接数量 */
|
||||||
|
@Excel(name = "最大连接数量")
|
||||||
|
private Long maxNum;
|
||||||
|
|
||||||
|
/** 最大等待时间 */
|
||||||
|
@Excel(name = "最大等待时间")
|
||||||
|
private Long maxWaitTime;
|
||||||
|
|
||||||
|
/** 最大等待次数 */
|
||||||
|
@Excel(name = "最大等待次数")
|
||||||
|
private Long maxWaitSize;
|
||||||
|
|
||||||
|
/** $column.columnComment */
|
||||||
|
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/** 数据来源名称 */
|
||||||
|
@Excel(name = "数据来源名称")
|
||||||
|
private String systemName;
|
||||||
|
|
||||||
|
|
||||||
|
private List<String> tableAssetsList;
|
||||||
|
|
||||||
|
public void setId(Long id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
public void setDataSourceName(String dataSourceName)
|
||||||
|
{
|
||||||
|
this.dataSourceName = dataSourceName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDataSourceName()
|
||||||
|
{
|
||||||
|
return dataSourceName;
|
||||||
|
}
|
||||||
|
public void setLinkAddress(String linkAddress)
|
||||||
|
{
|
||||||
|
this.linkAddress = linkAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLinkAddress()
|
||||||
|
{
|
||||||
|
return this.linkAddress;
|
||||||
|
}
|
||||||
|
public void setPort(String port)
|
||||||
|
{
|
||||||
|
this.port = port;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPort()
|
||||||
|
{
|
||||||
|
return port;
|
||||||
|
}
|
||||||
|
public void setDatabaseName(String databaseName)
|
||||||
|
{
|
||||||
|
this.databaseName = databaseName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDatabaseName()
|
||||||
|
{
|
||||||
|
return databaseName;
|
||||||
|
}
|
||||||
|
public void setUsername(String username)
|
||||||
|
{
|
||||||
|
this.username = username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUsername()
|
||||||
|
{
|
||||||
|
return username;
|
||||||
|
}
|
||||||
|
public void setPassword(String password)
|
||||||
|
{
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPassword()
|
||||||
|
{
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
public void setConnectionParam(String connectionParam)
|
||||||
|
{
|
||||||
|
this.connectionParam = connectionParam;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getConnectionParam()
|
||||||
|
{
|
||||||
|
return connectionParam;
|
||||||
|
}
|
||||||
|
public void setInitNum(Long initNum)
|
||||||
|
{
|
||||||
|
this.initNum = initNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getInitNum()
|
||||||
|
{
|
||||||
|
return initNum;
|
||||||
|
}
|
||||||
|
public void setMaxNum(Long maxNum)
|
||||||
|
{
|
||||||
|
this.maxNum = maxNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getMaxNum()
|
||||||
|
{
|
||||||
|
return maxNum;
|
||||||
|
}
|
||||||
|
public void setMaxWaitTime(Long maxWaitTime)
|
||||||
|
{
|
||||||
|
this.maxWaitTime = maxWaitTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getMaxWaitTime()
|
||||||
|
{
|
||||||
|
return maxWaitTime;
|
||||||
|
}
|
||||||
|
public void setMaxWaitSize(Long maxWaitSize)
|
||||||
|
{
|
||||||
|
this.maxWaitSize = maxWaitSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getMaxWaitSize()
|
||||||
|
{
|
||||||
|
return maxWaitSize;
|
||||||
|
}
|
||||||
|
public void setType(String type)
|
||||||
|
{
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType()
|
||||||
|
{
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
public void setSystemName(String systemName)
|
||||||
|
{
|
||||||
|
this.systemName = systemName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSystemName()
|
||||||
|
{
|
||||||
|
return systemName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("dataSourceName", getDataSourceName())
|
||||||
|
.append("linkAddress", getLinkAddress())
|
||||||
|
.append("port", getPort())
|
||||||
|
.append("databaseName", getDatabaseName())
|
||||||
|
.append("username", getUsername())
|
||||||
|
.append("password", getPassword())
|
||||||
|
.append("connectionParam", getConnectionParam())
|
||||||
|
.append("initNum", getInitNum())
|
||||||
|
.append("maxNum", getMaxNum())
|
||||||
|
.append("maxWaitTime", getMaxWaitTime())
|
||||||
|
.append("maxWaitSize", getMaxWaitSize())
|
||||||
|
.append("createBy", getCreateBy())
|
||||||
|
.append("createTime", getCreateTime())
|
||||||
|
.append("updateBy", getUpdateBy())
|
||||||
|
.append("updateTime", getUpdateTime())
|
||||||
|
.append("remark", getRemark())
|
||||||
|
.append("type", getType())
|
||||||
|
.append("systemName", getSystemName())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
package com.zx.mapper;
|
||||||
|
import com.zx.domain.req.JdbcClass;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/** 持久层
|
||||||
|
* @ClassDescription:
|
||||||
|
* @JdkVersion: 17
|
||||||
|
* @Author: zhangxu
|
||||||
|
* @Created: 2024/4/20 11:18
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface KvtMapper {
|
||||||
|
/**
|
||||||
|
* 查询 id
|
||||||
|
* */
|
||||||
|
public JdbcClass selectJdbcById(Long id);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询列表
|
||||||
|
* */
|
||||||
|
public List<JdbcClass> selectList(JdbcClass jdbcClass);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
* */
|
||||||
|
public int insertJdbc(JdbcClass jdbcClass);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
* */
|
||||||
|
public int updateJdbc(JdbcClass jdbcClass);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
* */
|
||||||
|
public int deleteJdbc(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批删
|
||||||
|
* */
|
||||||
|
public int deleteAllJdbc(Long[] ids);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,64 @@
|
||||||
|
package com.zx.service.Impl;
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.zx.domain.req.JdbcClass;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/** 业务层
|
||||||
|
* @ClassDescription:
|
||||||
|
* @JdkVersion: 17
|
||||||
|
* @Author: zhangxu
|
||||||
|
* @Created: 2024/4/20 11:18
|
||||||
|
*/
|
||||||
|
public interface KvtService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询 id
|
||||||
|
* */
|
||||||
|
public JdbcClass selectJdbcById(Long id);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询列表
|
||||||
|
* */
|
||||||
|
|
||||||
|
public List<JdbcClass> selectList(JdbcClass jdbcClass);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
* */
|
||||||
|
public int insertJdbc(JdbcClass jdbcClass);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
* */
|
||||||
|
public int updateJdbc(JdbcClass jdbcClass);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
* */
|
||||||
|
public int deleteJdbc(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批删
|
||||||
|
* */
|
||||||
|
public int deleteAllJdbc(Long[] ids);
|
||||||
|
|
||||||
|
|
||||||
|
Result testConn(JdbcClass jdbcClass) throws ClassNotFoundException;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Result assesList(JdbcClass jdbcClass);
|
||||||
|
|
||||||
|
|
||||||
|
Result getTableList(JdbcClass jdbcClass);
|
||||||
|
|
||||||
|
|
||||||
|
Result getCount(JdbcClass jdbcClass);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,325 @@
|
||||||
|
package com.zx.service.Impl;
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.utils.DateUtils;
|
||||||
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
|
import com.zx.domain.AssetsData;
|
||||||
|
import com.zx.domain.DataKvt;
|
||||||
|
import com.zx.domain.req.JdbcClass;
|
||||||
|
import com.zx.domain.TableAssets;
|
||||||
|
import com.zx.mapper.KvtMapper;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.sql.*;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/** 实现层
|
||||||
|
* @ClassDescription:
|
||||||
|
* @JdkVersion: 17
|
||||||
|
* @Author: zhangxu
|
||||||
|
* @Created: 2024/4/20 11:21
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class KvtServiceImpl implements KvtService{
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private KvtMapper kvtMapper;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JdbcClass selectJdbcById(Long id) {
|
||||||
|
return kvtMapper.selectJdbcById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<JdbcClass> selectList(JdbcClass jdbcClass) {
|
||||||
|
List<JdbcClass> jdbcClasses = kvtMapper.selectList(jdbcClass);
|
||||||
|
jdbcClasses.stream().map(jdbcClass1 -> {
|
||||||
|
// 获取JdbcClass对象中的数据库连接信息
|
||||||
|
String user= jdbcClass.getUsername();
|
||||||
|
String pwd= jdbcClass.getPassword();
|
||||||
|
String driver="com.mysql.cj.jdbc.Driver";
|
||||||
|
// 构造数据库连接URL
|
||||||
|
String url="jdbc:mysql://"+jdbcClass.getLinkAddress()+":"+jdbcClass.getPort()+"/"+jdbcClass.getDatabaseName();
|
||||||
|
Connection connection =null;
|
||||||
|
Result result = null;
|
||||||
|
try {
|
||||||
|
result = this.testConn(jdbcClass);
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
if (result.getCode()==200){
|
||||||
|
try {
|
||||||
|
Class.forName(driver);
|
||||||
|
connection = DriverManager.getConnection(url,user,pwd);
|
||||||
|
List<String> list = new ArrayList<>();
|
||||||
|
String sql="SELECT table_name FROM information_schema.tables WHERE table_schema = '"+jdbcClass.getDatabaseName()+"'";
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement(sql);
|
||||||
|
ResultSet resultSet = preparedStatement.executeQuery();
|
||||||
|
while (resultSet.next()){
|
||||||
|
list.add(resultSet.getString("table_name"));
|
||||||
|
}
|
||||||
|
jdbcClass.setTableAssetsList(list);
|
||||||
|
preparedStatement.close();
|
||||||
|
} catch (ClassNotFoundException | SQLException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}).toList();
|
||||||
|
return jdbcClasses;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int insertJdbc(JdbcClass jdbcClass) {
|
||||||
|
jdbcClass.setCreateTime(DateUtils.getNowDate());
|
||||||
|
jdbcClass.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
int i = kvtMapper.insertJdbc(jdbcClass);
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int updateJdbc(JdbcClass jdbcClass) {
|
||||||
|
jdbcClass.setCreateTime(DateUtils.getNowDate());
|
||||||
|
jdbcClass.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
int i = kvtMapper.updateJdbc(jdbcClass);
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int deleteJdbc(Long id) {
|
||||||
|
return kvtMapper.deleteJdbc(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int deleteAllJdbc(Long[] ids) {
|
||||||
|
return kvtMapper.deleteAllJdbc(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result testConn(JdbcClass jdbcClass) throws ClassNotFoundException {
|
||||||
|
// 获取JdbcClass对象中的数据库连接信息
|
||||||
|
String user= jdbcClass.getUsername();
|
||||||
|
String pwd= jdbcClass.getPassword();
|
||||||
|
String driver="com.mysql.cj.jdbc.Driver";
|
||||||
|
// 构造数据库连接URL
|
||||||
|
String url="jdbc:mysql://"+jdbcClass.getLinkAddress()+":"+jdbcClass.getPort()+"/"+jdbcClass.getDatabaseName();
|
||||||
|
// 如果有额外的连接参数,则附加到URL后
|
||||||
|
if (jdbcClass.getConnectionParam()!=null && jdbcClass.getConnectionParam()!=""){
|
||||||
|
url=url+"?"+jdbcClass.getConnectionParam();
|
||||||
|
}
|
||||||
|
Connection connection=null;
|
||||||
|
try {
|
||||||
|
// 加载数据库驱动
|
||||||
|
Class.forName(driver);
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
// 如果驱动类未找到,返回连接失败信息
|
||||||
|
return Result.error("连接失败,请检查");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
// 尝试获取数据库连接并关闭
|
||||||
|
connection= DriverManager.getConnection(url,user,pwd);
|
||||||
|
connection.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 如果连接过程中出现异常,返回连接失败信息
|
||||||
|
return Result.error("连接失败");
|
||||||
|
}
|
||||||
|
// 连接成功,返回成功信息
|
||||||
|
return Result.success("连接成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result assesList(JdbcClass jdbcClass) {
|
||||||
|
AssetsData assets = getAssets(jdbcClass);
|
||||||
|
return Result.success(assets);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result getTableList(JdbcClass jdbcClass) {
|
||||||
|
AssetsData data = getData(jdbcClass);
|
||||||
|
return Result.success(data);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*查询一共多少条数据
|
||||||
|
*
|
||||||
|
* */
|
||||||
|
@Override
|
||||||
|
public Result getCount(JdbcClass jdbcClass) {
|
||||||
|
String user =jdbcClass.getUsername();
|
||||||
|
String pwd=jdbcClass.getPassword();
|
||||||
|
String driver="com.mysql.cj.jdbc.Driver";
|
||||||
|
String jdbcUrl="jdbc:mysql://"+jdbcClass.getLinkAddress()+":"+jdbcClass.getPort()+"/"+jdbcClass.getDatabaseName();
|
||||||
|
Connection connection=null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
Class.forName(driver);
|
||||||
|
connection=DriverManager.getConnection(jdbcUrl,user,pwd);
|
||||||
|
} catch (ClassNotFoundException | SQLException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
String sql=" SELECT COUNT(*)FROM information_schema.tables WHERE table_schema =?";
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement(sql);
|
||||||
|
preparedStatement.setString(1,jdbcClass.getDatabaseName());
|
||||||
|
ResultSet resultSet = preparedStatement.executeQuery();
|
||||||
|
int anInt = resultSet.getInt(1);
|
||||||
|
return Result.success(anInt);
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}finally {
|
||||||
|
try {
|
||||||
|
connection.close();
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public AssetsData getData(JdbcClass jdbcClass){
|
||||||
|
String user=jdbcClass.getUsername();
|
||||||
|
String pwd=jdbcClass.getPassword();
|
||||||
|
String driver="com.mysql.cj.jdbc.Driver";
|
||||||
|
String jdbcUrl="jdbc:mysql://"+jdbcClass.getLinkAddress()+":"+jdbcClass.getPort()+"/"+jdbcClass.getDatabaseName();
|
||||||
|
Connection connection=null;
|
||||||
|
List<Map<String,DataKvt>> list = new ArrayList<>();
|
||||||
|
HashMap<String, String> hashMap = new HashMap<>();
|
||||||
|
try {
|
||||||
|
Class.forName(driver);
|
||||||
|
connection=DriverManager.getConnection(jdbcUrl,pwd,user);
|
||||||
|
} catch (ClassNotFoundException | SQLException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement(jdbcClass.getSql());
|
||||||
|
ResultSet resultSet = preparedStatement.executeQuery();
|
||||||
|
ResultSetMetaData metaData = resultSet.getMetaData();
|
||||||
|
for (int i = 0; i < metaData.getColumnCount(); i++) {
|
||||||
|
String substring = metaData.getColumnClassName(i).substring(metaData.getColumnClassName(i).indexOf("java.lang") + 10);
|
||||||
|
hashMap.put(metaData.getColumnName(i),substring);
|
||||||
|
}
|
||||||
|
int columnCount = metaData.getColumnCount();
|
||||||
|
while (resultSet.next()){
|
||||||
|
Map<String,DataKvt> map = new HashMap<>();
|
||||||
|
for (int i = 0; i < columnCount; i++) {
|
||||||
|
//根据列索引或列名获取数据
|
||||||
|
String columnName = metaData.getColumnName(i);
|
||||||
|
String type = hashMap.get(columnName);
|
||||||
|
Object value = resultSet.getObject(i);
|
||||||
|
if (value==null){
|
||||||
|
map.put(columnName,new DataKvt("",type));
|
||||||
|
}else {
|
||||||
|
map.put(columnName,new DataKvt(value.toString(),""));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
list.add(map);
|
||||||
|
}
|
||||||
|
preparedStatement.close();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
AssetsData assetsData = new AssetsData();
|
||||||
|
assetsData.setKvtList(list);
|
||||||
|
assetsData.setTableAssets(hashMap);
|
||||||
|
return assetsData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TableAssets> getTableAssets(JdbcClass jdbcClass){
|
||||||
|
// 初始化数据库连接信息
|
||||||
|
String user= jdbcClass.getUsername();
|
||||||
|
String pwd= jdbcClass.getPassword();
|
||||||
|
String driver="com.mysql.cj.jdbc.Driver";
|
||||||
|
String url="jdbc:mysql://"+jdbcClass.getLinkAddress()+":"+jdbcClass.getPort()+"/"+jdbcClass.getDatabaseName();
|
||||||
|
|
||||||
|
// 定义空的connection
|
||||||
|
Connection connection=null;
|
||||||
|
List<TableAssets> tableAssets = new ArrayList<>();
|
||||||
|
|
||||||
|
// 尝试加载驱动并建立数据库连接
|
||||||
|
try {
|
||||||
|
Class.forName(driver);
|
||||||
|
connection=DriverManager.getConnection(url,user,pwd);
|
||||||
|
} catch (SQLException|ClassNotFoundException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
// 执行SQL查询,获取表的描述信息
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("SHOW COLUMNS FROM" + jdbcClass.getTableName());
|
||||||
|
ResultSet resultSet = preparedStatement.executeQuery();
|
||||||
|
ResultSetMetaData metaData = resultSet.getMetaData();
|
||||||
|
|
||||||
|
// 遍历查询结果,填充TableAssets对象列表
|
||||||
|
while (resultSet.next()){
|
||||||
|
TableAssets tableAsset = new TableAssets();
|
||||||
|
tableAsset.setField(resultSet.getString(1));
|
||||||
|
tableAsset.setType(resultSet.getString(2));
|
||||||
|
tableAsset.setNull(resultSet.getString(3));
|
||||||
|
tableAsset.setKey(resultSet.getString(4));
|
||||||
|
tableAsset.setDefault(resultSet.getString(5));
|
||||||
|
tableAssets.add(tableAsset); // 此处应该是将tableAsset添加到list,而不是add(tableAsset)。
|
||||||
|
}
|
||||||
|
preparedStatement.close();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return tableAssets;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public AssetsData getAssets(JdbcClass jdbcClass){
|
||||||
|
String user = jdbcClass.getUsername();
|
||||||
|
String password = jdbcClass.getPassword();
|
||||||
|
String jdbcDriver = "com.mysql.cj.jdbc.Driver";
|
||||||
|
String jdbcUrl = "jdbc:mysql://"+jdbcClass.getLinkAddress()+":"+jdbcClass.getPort()+"/"+jdbcClass.getDatabaseName();
|
||||||
|
Connection conn = null;
|
||||||
|
List<Map<String, DataKvt>> kvtList = new ArrayList<>();
|
||||||
|
HashMap<String, String> map = new HashMap<>();
|
||||||
|
List<TableAssets> tableAssets = getTableAssets(jdbcClass);
|
||||||
|
try {
|
||||||
|
Class.forName(jdbcDriver);
|
||||||
|
conn = DriverManager.getConnection(jdbcUrl, user, password);
|
||||||
|
PreparedStatement preparedStatement = conn.prepareStatement("select * from "+ jdbcClass.getTableName()+"+where 1=1");
|
||||||
|
ResultSet resultSet = preparedStatement.executeQuery();
|
||||||
|
ResultSetMetaData rsd = resultSet.getMetaData();
|
||||||
|
for(int i = 1; i <= rsd.getColumnCount(); i++) {
|
||||||
|
String substring = rsd.getColumnClassName(i).substring(rsd.getColumnClassName(i).indexOf("java.lang.") + 10);
|
||||||
|
System.out.print("java类型:"+substring);
|
||||||
|
System.out.print(" 数据库类型:"+rsd.getColumnTypeName(i));
|
||||||
|
System.out.print(" 字段名称:"+rsd.getColumnName(i));
|
||||||
|
System.out.println();
|
||||||
|
map.put(rsd.getColumnName(i),substring);
|
||||||
|
}
|
||||||
|
preparedStatement.close();
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
AssetsData assetsModule = new AssetsData();
|
||||||
|
assetsModule.setKvtList(kvtList);
|
||||||
|
assetsModule.setTableAssets(map);
|
||||||
|
assetsModule.setTableAssetsList(tableAssets);
|
||||||
|
return assetsModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公共用户名
|
||||||
|
* 密码
|
||||||
|
* 地址
|
||||||
|
* */
|
||||||
|
public void method(JdbcClass jdbcClass){
|
||||||
|
String user=jdbcClass.getUsername();
|
||||||
|
String pwd=jdbcClass.getPassword();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,2 @@
|
||||||
|
Spring Boot Version: ${spring-boot.version}
|
||||||
|
Spring Application Name: ${spring.application.name}
|
|
@ -0,0 +1,29 @@
|
||||||
|
# Tomcat
|
||||||
|
server:
|
||||||
|
port: 9205
|
||||||
|
|
||||||
|
# Spring
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
# 应用名称
|
||||||
|
name: muyu-kvt
|
||||||
|
profiles:
|
||||||
|
# 环境配置
|
||||||
|
active: dev
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
# 服务注册地址
|
||||||
|
server-addr: 115.159.67.205:8848
|
||||||
|
config:
|
||||||
|
# 配置中心地址
|
||||||
|
server-addr: 115.159.67.205:8848
|
||||||
|
# 配置文件格式
|
||||||
|
file-extension: yml
|
||||||
|
# 共享配置
|
||||||
|
shared-configs:
|
||||||
|
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
|
namespace: e47d9b61-1cb9-48b7-97b3-2692bfaf34a3
|
||||||
|
logging:
|
||||||
|
level:
|
||||||
|
com.zx.mapper: DEBUG
|
|
@ -0,0 +1,101 @@
|
||||||
|
<?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.zx.mapper.KvtMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.zx.domain.req.JdbcClass" id="DataSourceResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="dataSourceName" column="data_source_name" />
|
||||||
|
<result property="linkAddress" column="link_address" />
|
||||||
|
<result property="port" column="port" />
|
||||||
|
<result property="databaseName" column="database_name" />
|
||||||
|
<result property="username" column="username" />
|
||||||
|
<result property="password" column="password" />
|
||||||
|
<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, data_source_name, link_address, port, database_name, username, password, create_by, create_time, update_by, update_time, remark from jdbc
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectList" parameterType="com.zx.domain.req.JdbcClass" resultMap="DataSourceResult">
|
||||||
|
<include refid="selectDataSourceVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="dataSourceName != null and dataSourceName != ''"> and data_source_name like concat('%', #{dataSourceName}, '%')</if>
|
||||||
|
<if test="linkAddress != null and linkAddress != ''"> and link_address = #{linkAddress}</if>
|
||||||
|
<if test="port != null and port != ''"> and port = #{port}</if>
|
||||||
|
<if test="databaseName != null and databaseName != ''"> and database_name like concat('%', #{databaseName}, '%')</if>
|
||||||
|
<if test="username != null and username != ''"> and username like concat('%', #{username}, '%')</if>
|
||||||
|
<if test="password != null and password != ''"> and password = #{password}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectJdbcById" parameterType="Long" resultMap="DataSourceResult">
|
||||||
|
<include refid="selectDataSourceVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertJdbc" parameterType="com.zx.domain.req.JdbcClass" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into jdbc
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="dataSourceName != null">data_source_name,</if>
|
||||||
|
<if test="linkAddress != null">link_address,</if>
|
||||||
|
<if test="port != null">port,</if>
|
||||||
|
<if test="databaseName != null">database_name,</if>
|
||||||
|
<if test="username != null">username,</if>
|
||||||
|
<if test="password != null">password,</if>
|
||||||
|
<if test="createBy != null and createBy != ''">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="dataSourceName != null">#{dataSourceName},</if>
|
||||||
|
<if test="linkAddress != null">#{linkAddress},</if>
|
||||||
|
<if test="port != null">#{port},</if>
|
||||||
|
<if test="databaseName != null">#{databaseName},</if>
|
||||||
|
<if test="username != null">#{username},</if>
|
||||||
|
<if test="password != null">#{password},</if>
|
||||||
|
<if test="createBy != null and createBy != ''">#{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="updateJdbc" parameterType="com.zx.domain.req.JdbcClass">
|
||||||
|
update data_source
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="dataSourceName != null">data_source_name = #{dataSourceName},</if>
|
||||||
|
<if test="linkAddress != null">link_address = #{linkAddress},</if>
|
||||||
|
<if test="port != null">port = #{port},</if>
|
||||||
|
<if test="databaseName != null">database_name = #{databaseName},</if>
|
||||||
|
<if test="username != null">username = #{username},</if>
|
||||||
|
<if test="password != null">password = #{password},</if>
|
||||||
|
<if test="createBy != null and createBy != ''">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="deleteJdbc" parameterType="Long">
|
||||||
|
delete from jdbc where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteAllJdbc" parameterType="String">
|
||||||
|
delete from jdbc where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
|
@ -18,5 +18,12 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
public class MuYuSystemApplication {
|
public class MuYuSystemApplication {
|
||||||
public static void main (String[] args) {
|
public static void main (String[] args) {
|
||||||
SpringApplication.run(MuYuSystemApplication.class, args);
|
SpringApplication.run(MuYuSystemApplication.class, args);
|
||||||
|
System.out.println("(♥◠‿◠)ノ゙ 系统模块启动成功 ლ(´ڡ`ლ)゙ \n" +
|
||||||
|
" .-------. ____ __ \n" +
|
||||||
|
" | _ _ \\ \\ \\ / / \n" +
|
||||||
|
" | ( ' ) | \\ _. / ' \n" +
|
||||||
|
" |(_ o _) / _( )_ .' \n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,15 +14,16 @@ spring:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 115.159.67.205:8848
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 115.159.67.205:8848
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
shared-configs:
|
shared-configs:
|
||||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
|
namespace: e47d9b61-1cb9-48b7-97b3-2692bfaf34a3
|
||||||
logging:
|
logging:
|
||||||
level:
|
level:
|
||||||
com.muyu.system.mapper: DEBUG
|
com.muyu.system.mapper: DEBUG
|
||||||
|
|
|
@ -14,12 +14,13 @@ spring:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 115.159.67.205:8848
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 115.159.67.205:8848
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
shared-configs:
|
shared-configs:
|
||||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
|
namespace: e47d9b61-1cb9-48b7-97b3-2692bfaf34a3
|
||||||
|
|
3
pom.xml
3
pom.xml
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
<name>muyu</name>
|
<name>muyu</name>
|
||||||
|
|
||||||
<description>若依微服务系统</description>
|
<description>微服务系统</description>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<muyu.version>3.6.3</muyu.version>
|
<muyu.version>3.6.3</muyu.version>
|
||||||
|
@ -215,6 +215,7 @@
|
||||||
<module>muyu-visual</module>
|
<module>muyu-visual</module>
|
||||||
<module>muyu-modules</module>
|
<module>muyu-modules</module>
|
||||||
<module>muyu-common</module>
|
<module>muyu-common</module>
|
||||||
|
<module>muyu-modules/muyu-kvt</module>
|
||||||
</modules>
|
</modules>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
|
|
@ -67,8 +67,8 @@ create table sys_user (
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- 初始化-用户信息表数据
|
-- 初始化-用户信息表数据
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
insert into sys_user values(1, 103, 'admin', '若依', '00', 'ry@163.com', '15888888888', '1', '', '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', sysdate(), 'admin', sysdate(), '', null, '管理员');
|
insert into sys_user values(1, 103, 'admin', '若依', '00', 'ry@163.com', '15888888888', '1', '', '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '115.159.67.205', sysdate(), 'admin', sysdate(), '', null, '管理员');
|
||||||
insert into sys_user values(2, 105, 'ry', '若依', '00', 'ry@qq.com', '15666666666', '1', '', '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', sysdate(), 'admin', sysdate(), '', null, '测试员');
|
insert into sys_user values(2, 105, 'ry', '若依', '00', 'ry@qq.com', '15666666666', '1', '', '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '115.159.67.205', sysdate(), 'admin', sysdate(), '', null, '测试员');
|
||||||
|
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
|
|
|
@ -40,7 +40,7 @@ insert into config_info(id, data_id, group_id, content, md5, gmt_create, gmt_mod
|
||||||
(5,'muyu-system-dev.yml','DEFAULT_GROUP','# spring配置\nspring:\n redis:\n host: localhost\n port: 6379\n password:\n datasource:\n druid:\n stat-view-servlet:\n enabled: true\n loginUsername: admin\n loginPassword: 123456\n dynamic:\n druid:\n initial-size: 5\n min-idle: 5\n maxActive: 20\n maxWait: 60000\n timeBetweenEvictionRunsMillis: 60000\n minEvictableIdleTimeMillis: 300000\n validationQuery: SELECT 1 FROM DUAL\n testWhileIdle: true\n testOnBorrow: false\n testOnReturn: false\n poolPreparedStatements: true\n maxPoolPreparedStatementPerConnectionSize: 20\n filters: stat,slf4j\n connectionProperties: druid.stat.mergeSql\\=true;druid.stat.slowSqlMillis\\=5000\n datasource:\n # 主库数据源\n master:\n driver-class-name: com.mysql.cj.jdbc.Driver\n url: jdbc:mysql://localhost:3306/ry-cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\n username: root\n password: root\n # 从库数据源\n # slave:\n # username: \n # password: \n # url: \n # driver-class-name: \n\n# mybatis配置\nmybatis:\n # 搜索指定包别名\n typeAliasesPackage: com.muyu.system\n # 配置mapper的扫描,找到所有的mapper.xml映射文件\n mapperLocations: classpath:mapper/**/*.xml\n\n# swagger配置\nswagger:\n title: 系统模块接口文档\n license: Powered By muyu\n licenseUrl: https://muyu.vip','48e0ed4a040c402bdc2444213a82c910','2020-11-20 00:00:00','2022-09-29 02:49:09','nacos','0:0:0:0:0:0:0:1','','','系统模块','null','null','yaml','',''),
|
(5,'muyu-system-dev.yml','DEFAULT_GROUP','# spring配置\nspring:\n redis:\n host: localhost\n port: 6379\n password:\n datasource:\n druid:\n stat-view-servlet:\n enabled: true\n loginUsername: admin\n loginPassword: 123456\n dynamic:\n druid:\n initial-size: 5\n min-idle: 5\n maxActive: 20\n maxWait: 60000\n timeBetweenEvictionRunsMillis: 60000\n minEvictableIdleTimeMillis: 300000\n validationQuery: SELECT 1 FROM DUAL\n testWhileIdle: true\n testOnBorrow: false\n testOnReturn: false\n poolPreparedStatements: true\n maxPoolPreparedStatementPerConnectionSize: 20\n filters: stat,slf4j\n connectionProperties: druid.stat.mergeSql\\=true;druid.stat.slowSqlMillis\\=5000\n datasource:\n # 主库数据源\n master:\n driver-class-name: com.mysql.cj.jdbc.Driver\n url: jdbc:mysql://localhost:3306/ry-cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\n username: root\n password: root\n # 从库数据源\n # slave:\n # username: \n # password: \n # url: \n # driver-class-name: \n\n# mybatis配置\nmybatis:\n # 搜索指定包别名\n typeAliasesPackage: com.muyu.system\n # 配置mapper的扫描,找到所有的mapper.xml映射文件\n mapperLocations: classpath:mapper/**/*.xml\n\n# swagger配置\nswagger:\n title: 系统模块接口文档\n license: Powered By muyu\n licenseUrl: https://muyu.vip','48e0ed4a040c402bdc2444213a82c910','2020-11-20 00:00:00','2022-09-29 02:49:09','nacos','0:0:0:0:0:0:0:1','','','系统模块','null','null','yaml','',''),
|
||||||
(6,'muyu-gen-dev.yml','DEFAULT_GROUP','# spring配置\nspring:\n redis:\n host: localhost\n port: 6379\n password:\n datasource:\n driver-class-name: com.mysql.cj.jdbc.Driver\n url: jdbc:mysql://localhost:3306/ry-cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\n username: root\n password: root\n\n# mybatis配置\nmybatis:\n # 搜索指定包别名\n typeAliasesPackage: com.muyu.gen.domain\n # 配置mapper的扫描,找到所有的mapper.xml映射文件\n mapperLocations: classpath:mapper/**/*.xml\n\n# swagger配置\nswagger:\n title: 代码生成接口文档\n license: Powered By muyu\n licenseUrl: https://muyu.vip\n\n# 代码生成\ngen:\n # 作者\n author: muyu\n # 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool\n packageName: com.muyu.system\n # 自动去除表前缀,默认是false\n autoRemovePre: false\n # 表前缀(生成类名不会包含表前缀,多个用逗号分隔)\n tablePrefix: sys_\n','eb592420b3fceae1402881887b8a6a0d','2020-11-20 00:00:00','2022-09-29 02:49:42','nacos','0:0:0:0:0:0:0:1','','','代码生成','null','null','yaml','',''),
|
(6,'muyu-gen-dev.yml','DEFAULT_GROUP','# spring配置\nspring:\n redis:\n host: localhost\n port: 6379\n password:\n datasource:\n driver-class-name: com.mysql.cj.jdbc.Driver\n url: jdbc:mysql://localhost:3306/ry-cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\n username: root\n password: root\n\n# mybatis配置\nmybatis:\n # 搜索指定包别名\n typeAliasesPackage: com.muyu.gen.domain\n # 配置mapper的扫描,找到所有的mapper.xml映射文件\n mapperLocations: classpath:mapper/**/*.xml\n\n# swagger配置\nswagger:\n title: 代码生成接口文档\n license: Powered By muyu\n licenseUrl: https://muyu.vip\n\n# 代码生成\ngen:\n # 作者\n author: muyu\n # 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool\n packageName: com.muyu.system\n # 自动去除表前缀,默认是false\n autoRemovePre: false\n # 表前缀(生成类名不会包含表前缀,多个用逗号分隔)\n tablePrefix: sys_\n','eb592420b3fceae1402881887b8a6a0d','2020-11-20 00:00:00','2022-09-29 02:49:42','nacos','0:0:0:0:0:0:0:1','','','代码生成','null','null','yaml','',''),
|
||||||
(7,'muyu-job-dev.yml','DEFAULT_GROUP','# spring配置\nspring:\n redis:\n host: localhost\n port: 6379\n password: \n datasource:\n driver-class-name: com.mysql.cj.jdbc.Driver\n url: jdbc:mysql://localhost:3306/ry-cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\n username: root\n password: root\n\n# mybatis配置\nmybatis:\n # 搜索指定包别名\n typeAliasesPackage: com.muyu.job.domain\n # 配置mapper的扫描,找到所有的mapper.xml映射文件\n mapperLocations: classpath:mapper/**/*.xml\n\n# swagger配置\nswagger:\n title: 定时任务接口文档\n license: Powered By muyu\n licenseUrl: https://muyu.vip\n','edcf0e3fe13fea07b4ec08b1088f30b3','2020-11-20 00:00:00','2022-09-29 02:50:50','nacos','0:0:0:0:0:0:0:1','','','定时任务','null','null','yaml','',''),
|
(7,'muyu-job-dev.yml','DEFAULT_GROUP','# spring配置\nspring:\n redis:\n host: localhost\n port: 6379\n password: \n datasource:\n driver-class-name: com.mysql.cj.jdbc.Driver\n url: jdbc:mysql://localhost:3306/ry-cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\n username: root\n password: root\n\n# mybatis配置\nmybatis:\n # 搜索指定包别名\n typeAliasesPackage: com.muyu.job.domain\n # 配置mapper的扫描,找到所有的mapper.xml映射文件\n mapperLocations: classpath:mapper/**/*.xml\n\n# swagger配置\nswagger:\n title: 定时任务接口文档\n license: Powered By muyu\n licenseUrl: https://muyu.vip\n','edcf0e3fe13fea07b4ec08b1088f30b3','2020-11-20 00:00:00','2022-09-29 02:50:50','nacos','0:0:0:0:0:0:0:1','','','定时任务','null','null','yaml','',''),
|
||||||
(8,'muyu-file-dev.yml','DEFAULT_GROUP','# 本地文件上传 \r\nfile:\r\n domain: http://127.0.0.1:9300\r\n path: D:/muyu/uploadPath\r\n prefix: /statics\r\n\r\n# FastDFS配置\r\nfdfs:\r\n domain: http://8.129.231.12\r\n soTimeout: 3000\r\n connectTimeout: 2000\r\n trackerList: 8.129.231.12:22122\r\n\r\n# Minio配置\r\nminio:\r\n url: http://8.129.231.12:9000\r\n accessKey: minioadmin\r\n secretKey: minioadmin\r\n bucketName: test','5382b93f3d8059d6068c0501fdd41195','2020-11-20 00:00:00','2020-12-21 21:01:59',NULL,'0:0:0:0:0:0:0:1','','','文件服务','null','null','yaml',NULL,''),
|
(8,'muyu-file-dev.yml','DEFAULT_GROUP','# 本地文件上传 \r\nfile:\r\n domain: http://115.159.67.205:9300\r\n path: D:/muyu/uploadPath\r\n prefix: /statics\r\n\r\n# FastDFS配置\r\nfdfs:\r\n domain: http://8.129.231.12\r\n soTimeout: 3000\r\n connectTimeout: 2000\r\n trackerList: 8.129.231.12:22122\r\n\r\n# Minio配置\r\nminio:\r\n url: http://8.129.231.12:9000\r\n accessKey: minioadmin\r\n secretKey: minioadmin\r\n bucketName: test','5382b93f3d8059d6068c0501fdd41195','2020-11-20 00:00:00','2020-12-21 21:01:59',NULL,'0:0:0:0:0:0:0:1','','','文件服务','null','null','yaml',NULL,''),
|
||||||
(9,'sentinel-muyu-gateway','DEFAULT_GROUP','[\r\n {\r\n \"resource\": \"muyu-auth\",\r\n \"count\": 500,\r\n \"grade\": 1,\r\n \"limitApp\": \"default\",\r\n \"strategy\": 0,\r\n \"controlBehavior\": 0\r\n },\r\n {\r\n \"resource\": \"muyu-system\",\r\n \"count\": 1000,\r\n \"grade\": 1,\r\n \"limitApp\": \"default\",\r\n \"strategy\": 0,\r\n \"controlBehavior\": 0\r\n },\r\n {\r\n \"resource\": \"muyu-gen\",\r\n \"count\": 200,\r\n \"grade\": 1,\r\n \"limitApp\": \"default\",\r\n \"strategy\": 0,\r\n \"controlBehavior\": 0\r\n },\r\n {\r\n \"resource\": \"muyu-job\",\r\n \"count\": 300,\r\n \"grade\": 1,\r\n \"limitApp\": \"default\",\r\n \"strategy\": 0,\r\n \"controlBehavior\": 0\r\n }\r\n]','9f3a3069261598f74220bc47958ec252','2020-11-20 00:00:00','2020-11-20 00:00:00',NULL,'0:0:0:0:0:0:0:1','','','限流策略','null','null','json',NULL,'');
|
(9,'sentinel-muyu-gateway','DEFAULT_GROUP','[\r\n {\r\n \"resource\": \"muyu-auth\",\r\n \"count\": 500,\r\n \"grade\": 1,\r\n \"limitApp\": \"default\",\r\n \"strategy\": 0,\r\n \"controlBehavior\": 0\r\n },\r\n {\r\n \"resource\": \"muyu-system\",\r\n \"count\": 1000,\r\n \"grade\": 1,\r\n \"limitApp\": \"default\",\r\n \"strategy\": 0,\r\n \"controlBehavior\": 0\r\n },\r\n {\r\n \"resource\": \"muyu-gen\",\r\n \"count\": 200,\r\n \"grade\": 1,\r\n \"limitApp\": \"default\",\r\n \"strategy\": 0,\r\n \"controlBehavior\": 0\r\n },\r\n {\r\n \"resource\": \"muyu-job\",\r\n \"count\": 300,\r\n \"grade\": 1,\r\n \"limitApp\": \"default\",\r\n \"strategy\": 0,\r\n \"controlBehavior\": 0\r\n }\r\n]','9f3a3069261598f74220bc47958ec252','2020-11-20 00:00:00','2020-11-20 00:00:00',NULL,'0:0:0:0:0:0:0:1','','','限流策略','null','null','json',NULL,'');
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue