Compare commits
2 Commits
Author | SHA1 | Date |
---|---|---|
|
690e5f8ffa | |
|
776e0ab77b |
|
@ -14,12 +14,13 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 115.159.67.205:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
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
|
||||
|
|
|
@ -58,7 +58,7 @@ public class IpUtils {
|
|||
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) {
|
||||
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();
|
||||
} catch (UnknownHostException e) {
|
||||
}
|
||||
return "127.0.0.1";
|
||||
return "115.159.67.205";
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -14,26 +14,27 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 115.159.67.205:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
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
|
||||
sentinel:
|
||||
# 取消控制台懒加载
|
||||
eager: true
|
||||
transport:
|
||||
# 控制台地址
|
||||
dashboard: 127.0.0.1:8718
|
||||
dashboard: 115.159.67.205:8718
|
||||
# nacos配置持久化
|
||||
datasource:
|
||||
ds1:
|
||||
nacos:
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 115.159.67.205:8848
|
||||
dataId: sentinel-muyu-gateway
|
||||
groupId: DEFAULT_GROUP
|
||||
data-type: json
|
||||
|
|
|
@ -14,12 +14,13 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 115.159.67.205:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
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
|
||||
|
|
|
@ -14,12 +14,13 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 115.159.67.205:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
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
|
||||
|
|
|
@ -14,12 +14,13 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 115.159.67.205:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
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
|
||||
|
|
|
@ -0,0 +1,124 @@
|
|||
<?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>
|
||||
|
||||
<!-- PostgreSQL JDBC驱动 -->
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 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,98 @@
|
|||
package com.zx.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
|
||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.common.log.annotation.Log;
|
||||
import com.muyu.common.log.enums.BusinessType;
|
||||
import com.zx.domain.req.AssetModel;
|
||||
import com.zx.service.Impl.AssetModelService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
import static com.muyu.common.core.domain.Result.success;
|
||||
import static com.muyu.common.core.utils.PageUtils.startPage;
|
||||
|
||||
/**
|
||||
* @ClassDescription:
|
||||
* @JdkVersion: 17
|
||||
* @Author: zhangxu
|
||||
* @Created: 2024/4/23 8:39
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/model")
|
||||
public class AssetModulesController extends BaseController {
|
||||
@Autowired
|
||||
private AssetModelService assetModulesService;
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<AssetModel>> list(AssetModel assetModel)
|
||||
{
|
||||
startPage();
|
||||
List<AssetModel> list = assetModulesService.selectAssetModelList(assetModel);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出【请填写功能名称】列表
|
||||
*/
|
||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, AssetModel assetModel)
|
||||
{
|
||||
List<AssetModel> list = assetModulesService.selectAssetModelList(assetModel);
|
||||
ExcelUtil<AssetModel> util = new ExcelUtil<AssetModel>(AssetModel.class);
|
||||
util.exportExcel(response, list, "【请填写功能名称】数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取【请填写功能名称】详细信息
|
||||
*/
|
||||
@GetMapping(value = "/{id}")
|
||||
public Result getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(assetModulesService.selectAssetModelById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增【请填写功能名称】
|
||||
*/
|
||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add(@RequestBody AssetModel assetModel)
|
||||
{
|
||||
return toAjax(assetModulesService.insertAssetModel(assetModel));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改【请填写功能名称】
|
||||
*/
|
||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public Result edit(@RequestBody AssetModel assetModel)
|
||||
{
|
||||
return toAjax(assetModulesService.updateAssetModel(assetModel));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除【请填写功能名称】
|
||||
*/
|
||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public Result remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(assetModulesService.deleteAssetModelByIds(ids));
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,135 @@
|
|||
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("system:source:list")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<JdbcClass>> list(JdbcClass jdbcClass)
|
||||
{
|
||||
startPage();
|
||||
List<JdbcClass> list = kvtService.selectList(jdbcClass);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PostMapping("/AssetsList")
|
||||
public Result assetsList(@RequestBody JdbcClass jdbcClass)
|
||||
{
|
||||
return kvtService.assesList(jdbcClass);
|
||||
}
|
||||
|
||||
@PostMapping("/SynchronousData")
|
||||
public Result synchronousData(@RequestBody JdbcClass jdbcClass)
|
||||
{
|
||||
return kvtService.synchronousData(jdbcClass);
|
||||
}
|
||||
/**
|
||||
* 数据结构
|
||||
* */
|
||||
@PostMapping("/DataAssetList")
|
||||
public Result dataAssetList(@RequestBody JdbcClass jdbcClass)
|
||||
{
|
||||
return kvtService.dattaList(jdbcClass);
|
||||
}
|
||||
|
||||
@PostMapping("/AssetModelList")
|
||||
public Result assetModelList(@RequestBody JdbcClass jdbcClass)
|
||||
{
|
||||
return kvtService.assrtModelList(jdbcClass);
|
||||
}
|
||||
|
||||
@PostMapping("/StructureList")
|
||||
public Result structureList(@RequestBody JdbcClass jdbcClass)
|
||||
{
|
||||
return kvtService.getTableList(jdbcClass);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取【请填写功能名称】详细信息
|
||||
*/
|
||||
@RequiresPermissions("system:source:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public Result getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(kvtService.selectJdbcById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增【请填写功能名称】
|
||||
*/
|
||||
@RequiresPermissions("system:source:add")
|
||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add(@RequestBody JdbcClass jdbcClass)
|
||||
{
|
||||
return toAjax(kvtService.insertJdbc(jdbcClass));
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试连接
|
||||
*/
|
||||
@Log(title = "测试连接", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/TestConnection")
|
||||
public Result testConnection(@RequestBody JdbcClass jdbcClass) throws ClassNotFoundException {
|
||||
return kvtService.testConn(jdbcClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改【请填写功能名称】
|
||||
*/
|
||||
@RequiresPermissions("system:source:edit")
|
||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public Result edit(@RequestBody JdbcClass jdbcClass)
|
||||
{
|
||||
return toAjax(kvtService.updateJdbc(jdbcClass));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除【请填写功能名称】
|
||||
*/
|
||||
@RequiresPermissions("system:source:remove")
|
||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public Result remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(kvtService.deleteAllJdbc(ids));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -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,67 @@
|
|||
package com.zx.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassDescription:
|
||||
* @JdkVersion: 17
|
||||
* @Author: zhangxu
|
||||
* @Created: 2024/4/21 20:05
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class TableAssets {
|
||||
|
||||
/**
|
||||
* 字段名
|
||||
*/
|
||||
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 defaultValue;
|
||||
/**
|
||||
* 是否字典
|
||||
*/
|
||||
private String isDict;
|
||||
/**
|
||||
* 字典key
|
||||
*/
|
||||
private String dictKey;
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -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,246 @@
|
|||
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;
|
||||
/**
|
||||
* 连接驱动
|
||||
* */
|
||||
private String jdbcDriver;
|
||||
|
||||
/** $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;
|
||||
|
||||
private Long count;
|
||||
|
||||
/** 最大等待次数 */
|
||||
@Excel(name = "最大等待次数")
|
||||
private Long maxWaitSize;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
private String type;
|
||||
|
||||
/** 数据来源名称 */
|
||||
@Excel(name = "数据来源名称")
|
||||
private String systemName;
|
||||
|
||||
private String modeName;
|
||||
|
||||
|
||||
|
||||
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,38 @@
|
|||
package com.zx.domain.response;
|
||||
|
||||
import com.zx.domain.TableAssets;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassDescription:
|
||||
* @JdkVersion: 17
|
||||
* @Author: zhangxu
|
||||
* @Created: 2024/4/23 14:29
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class TableDetail {
|
||||
/**
|
||||
* 表名称
|
||||
* */
|
||||
private String tableName;
|
||||
/**
|
||||
*表备注
|
||||
* */
|
||||
private String tableComment;
|
||||
/**
|
||||
*数量
|
||||
* */
|
||||
private Long tableCount;
|
||||
/**
|
||||
*整体
|
||||
* */
|
||||
private List<TableAssets> tableAssetsList;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
package com.zx.mapper;
|
||||
|
||||
import com.zx.domain.req.DataAsset;
|
||||
import feign.Param;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import javax.lang.model.type.ArrayType;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassDescription:
|
||||
* @JdkVersion: 17
|
||||
* @Author: zhangxu
|
||||
* @Created: 2024/4/23 14:33
|
||||
*/
|
||||
@Mapper
|
||||
public interface DataAssetMapper {
|
||||
/**
|
||||
* 查询【请填写功能名称】
|
||||
*
|
||||
* @param id 【请填写功能名称】主键
|
||||
* @return 【请填写功能名称】
|
||||
*/
|
||||
public DataAsset selectDataAssetById(Long id);
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】列表
|
||||
*
|
||||
* @param dataAsset 【请填写功能名称】
|
||||
* @return 【请填写功能名称】集合
|
||||
*/
|
||||
public List<DataAsset> selectDataAssetList(DataAsset dataAsset);
|
||||
|
||||
/**
|
||||
* 新增【请填写功能名称】
|
||||
*
|
||||
* @param dataAsset 【请填写功能名称】
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDataAsset(DataAsset dataAsset);
|
||||
|
||||
/**
|
||||
* 修改【请填写功能名称】
|
||||
*
|
||||
* @param dataAsset 【请填写功能名称】
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDataAsset(DataAsset dataAsset);
|
||||
|
||||
/**
|
||||
* 删除【请填写功能名称】
|
||||
*
|
||||
* @param id 【请填写功能名称】主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDataAssetById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除【请填写功能名称】
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDataAssetByIds(Long[] ids);
|
||||
|
||||
void batchInsert(@Param("dataAssets") ArrayList<DataAsset> dataAssets);
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package com.zx.mapper;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
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,96 @@
|
|||
package com.zx.service.Impl;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.DateUtils;
|
||||
import com.zx.domain.req.DataAsset;
|
||||
import com.zx.domain.req.JdbcClass;
|
||||
import com.zx.mapper.DataAssetMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassDescription:
|
||||
* @JdkVersion: 17
|
||||
* @Author: zhangxu
|
||||
* @Created: 2024/4/23 14:40
|
||||
*/
|
||||
public class DataAssetServiceImpl implements DataAssetService{
|
||||
|
||||
@Autowired
|
||||
private DataAssetMapper dataAssetMapper;
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】
|
||||
*
|
||||
* @param id 【请填写功能名称】主键
|
||||
* @return 【请填写功能名称】
|
||||
*/
|
||||
@Override
|
||||
public DataAsset selectDataAssetById(Long id)
|
||||
{
|
||||
return dataAssetMapper.selectDataAssetById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】列表
|
||||
*
|
||||
* @param dataAsset 【请填写功能名称】
|
||||
* @return 【请填写功能名称】
|
||||
*/
|
||||
@Override
|
||||
public List<DataAsset> selectDataAssetList(DataAsset dataAsset)
|
||||
{
|
||||
return dataAssetMapper.selectDataAssetList(dataAsset);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增【请填写功能名称】
|
||||
*
|
||||
* @param dataAsset 【请填写功能名称】
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertDataAsset(DataAsset dataAsset)
|
||||
{
|
||||
dataAsset.setCreateTime(DateUtils.getNowDate());
|
||||
return dataAssetMapper.insertDataAsset(dataAsset);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改【请填写功能名称】
|
||||
*
|
||||
* @param dataAsset 【请填写功能名称】
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateDataAsset(DataAsset dataAsset)
|
||||
{
|
||||
dataAsset.setUpdateTime(DateUtils.getNowDate());
|
||||
return dataAssetMapper.updateDataAsset(dataAsset);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除【请填写功能名称】
|
||||
*
|
||||
* @param ids 需要删除的【请填写功能名称】主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteDataAssetByIds(Long[] ids)
|
||||
{
|
||||
return dataAssetMapper.deleteDataAssetByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除【请填写功能名称】信息
|
||||
*
|
||||
* @param id 【请填写功能名称】主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteDataAssetById(Long id)
|
||||
{
|
||||
return dataAssetMapper.deleteDataAssetById(id);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
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);
|
||||
|
||||
|
||||
|
||||
Result synchronousData(JdbcClass jdbcClass);
|
||||
|
||||
Result dattaList(JdbcClass jdbcClass);
|
||||
|
||||
Result assrtModelList(JdbcClass jdbcClass);
|
||||
}
|
|
@ -0,0 +1,472 @@
|
|||
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.AssetModel;
|
||||
import com.zx.domain.req.DataAsset;
|
||||
import com.zx.domain.req.JdbcClass;
|
||||
|
||||
import com.zx.mapper.AssetModelMapper;
|
||||
import com.zx.mapper.DataAssetMapper;
|
||||
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.Date;
|
||||
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;
|
||||
|
||||
@Autowired
|
||||
private DataAssetMapper dataAssetMapper;
|
||||
|
||||
@Autowired
|
||||
private AssetModelMapper assetModelMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public JdbcClass selectJdbcById(Long id) {
|
||||
return kvtMapper.selectJdbcById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JdbcClass> selectList(JdbcClass jdbcClass) {
|
||||
List<JdbcClass> jdbcClasses = kvtMapper.selectList(jdbcClass);
|
||||
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("连接成功");
|
||||
|
||||
if (jdbcClass.getType().equals("MySql")){
|
||||
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.success("连接成功");
|
||||
}
|
||||
}else {
|
||||
String user= jdbcClass.getUsername();
|
||||
String pwd= jdbcClass.getPassword();
|
||||
String driver="org.postgresql.Driver";
|
||||
String uel="jdbc:postgresql://"+jdbcClass.getLinkAddress()+":"+jdbcClass.getPort()+"/"+jdbcClass.getDatabaseName();
|
||||
if (jdbcClass.getConnectionParam()!=null&&jdbcClass.getConnectionParam()!=""){
|
||||
uel=uel+"?"+jdbcClass.getConnectionParam();
|
||||
}
|
||||
Connection connection=null;
|
||||
try {
|
||||
Class.forName(driver);
|
||||
} catch (ClassNotFoundException e) {
|
||||
return Result.error("连接失败");
|
||||
}
|
||||
try {
|
||||
connection=DriverManager.getConnection(uel,pwd,user);
|
||||
connection.close();
|
||||
} catch (SQLException 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<AssetModel> getTableAssets(JdbcClass jdbcClass,String tableName){
|
||||
// 初始化数据库连接信息
|
||||
String user= jdbcClass.getUsername();
|
||||
String pwd= jdbcClass.getPassword();
|
||||
String driver="";
|
||||
String url="";
|
||||
url="jdbc:"+jdbcClass.getType().toLowerCase()+"://"+jdbcClass.getLinkAddress()+":"+jdbcClass.getPort()+"/"+jdbcClass.getDatabaseName();
|
||||
if (jdbcClass.getType().equals("mysql")){
|
||||
driver="com.mysql.cj.jdbc.Driver";
|
||||
}else if (jdbcClass.getType().equals("oracle")){
|
||||
driver="oracle.jdbc.driver.OracleDriver";
|
||||
}else if (jdbcClass.getType().equals("sqlserver")){
|
||||
driver="com.microsoft.sqlserver.jdbc.SQLServerDriver";
|
||||
}else if (jdbcClass.getType().equals("postgresql")){
|
||||
driver="org.postgresql.Driver";
|
||||
}
|
||||
if (jdbcClass.getType().equals("oracle")){
|
||||
url="jdbc:oracle:thin:@"+jdbcClass.getLinkAddress()+":"+jdbcClass.getPort()+":"+jdbcClass.getDatabaseName();
|
||||
}
|
||||
if (jdbcClass.getType().equals("postgresql")){
|
||||
url="jdbc:postgresql://"+jdbcClass.getLinkAddress()+":"+jdbcClass.getPort()+"/"+jdbcClass.getDatabaseName();
|
||||
}
|
||||
if (jdbcClass.getType().equals("sqlserver")){
|
||||
url="jdbc:sqlserver://"+jdbcClass.getLinkAddress()+":"+jdbcClass.getPort()+";DatabaseName="+jdbcClass.getDatabaseName();
|
||||
}
|
||||
if (jdbcClass.getType().equals("mysql")){
|
||||
url="jdbc:mysql://"+jdbcClass.getLinkAddress()+":"+jdbcClass.getPort()+"/"+jdbcClass.getDatabaseName();
|
||||
}
|
||||
|
||||
|
||||
// 定义空的connection
|
||||
Connection connection=null;
|
||||
List<AssetModel> assetsData = new ArrayList<>();
|
||||
HashMap<String, String> hashMap = new HashMap<>();
|
||||
|
||||
// 尝试加载驱动并建立数据库连接
|
||||
try {
|
||||
Class.forName(jdbcClass.getJdbcDriver());
|
||||
connection=DriverManager.getConnection(url,user,pwd);
|
||||
} catch (SQLException|ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
try {
|
||||
// 执行SQL查询,获取表的描述信息
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT COLUMN_NAME,DATA_TYPE,IS_NULLABLE,COLUMN_KEY,COLUMN_DEFAULT,COLUMN_COMMENT,CHARACTER_MAXIMUM_LENGTH,NUMERIC_PRECISION,NUMERIC_SCALE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = '"+jdbcClass.getDatabaseName()+"' AND TABLE_NAME = '"+tableName+"'");
|
||||
ResultSet resultSet = preparedStatement.executeQuery();
|
||||
ResultSetMetaData metaData = resultSet.getMetaData();
|
||||
|
||||
// 遍历查询结果,填充TableAssets对象列表
|
||||
while (resultSet.next()){
|
||||
AssetModel assetModel = new AssetModel();
|
||||
assetModel.setComment(resultSet.getString("COLUMN_COMMENT"));
|
||||
assetModel.setName(resultSet.getString("COLUMN_NAME"));
|
||||
if (resultSet.getString("CHARACTER_MAXIMUM_LENGTH")!=null){
|
||||
assetModel.setLength(resultSet.getString("CHARACTER_MAXIMUM_LENGTH"));
|
||||
}else if (resultSet.getString("NUMERIC_PRECISION")!=null){
|
||||
assetModel.setLength(resultSet.getString("NUMERIC_PRECISION"));
|
||||
}else{
|
||||
assetModel.setLength("-");
|
||||
}
|
||||
if (resultSet.getString("NUMERIC_SCALE")!=null){
|
||||
assetModel.setDecimalPlaces(resultSet.getString("NUMERIC_SCALE"));
|
||||
}else{
|
||||
assetModel.setDecimalPlaces("-");
|
||||
}
|
||||
|
||||
//是否不可为空
|
||||
if (resultSet.getString("IS_NULLABLE").equals("NO")){
|
||||
assetModel.setIsNull("N");
|
||||
}else{
|
||||
assetModel.setIsNull("Y");
|
||||
}
|
||||
//是否有默认值
|
||||
if (resultSet.getString("COLUMN_DEFAULT")!=null){
|
||||
assetModel.setDefaultValue(resultSet.getString("COLUMN_DEFAULT"));
|
||||
}else{
|
||||
assetModel.setDefaultValue("-");
|
||||
}
|
||||
assetModel.setIsDict("");
|
||||
assetModel.setDictKey("");
|
||||
assetModel.setType(resultSet.getString("DATA_TYPE"));
|
||||
//是否主键
|
||||
if ("PRI".equals(resultSet.getString("COLUMN_KEY"))){
|
||||
assetModel.setIsPrimaryKey("Y");
|
||||
}else{
|
||||
assetModel.setIsPrimaryKey("N");
|
||||
}
|
||||
assetModel.setCreateBy(SecurityUtils.getUsername());
|
||||
assetModel.setCreateTime(new Date());
|
||||
assetModel.setMappingType("String");
|
||||
assetsData.add(assetModel);
|
||||
}
|
||||
preparedStatement.close();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return assetsData;
|
||||
}
|
||||
|
||||
|
||||
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<AssetModel> tableAssets = getTableAssets(jdbcClass,jdbcClass.getTableName());
|
||||
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);
|
||||
}
|
||||
for (AssetModel tableAsset : tableAssets) {
|
||||
tableAsset.setMappingType(map.get(tableAsset.getType()));
|
||||
}
|
||||
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);
|
||||
return assetsModule;
|
||||
}
|
||||
|
||||
/**
|
||||
* 公共用户名
|
||||
* 密码
|
||||
* 地址
|
||||
* */
|
||||
public void method(JdbcClass jdbcClass){
|
||||
String user=jdbcClass.getUsername();
|
||||
String pwd=jdbcClass.getPassword();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 数据的同步
|
||||
* */
|
||||
|
||||
@Override
|
||||
public Result synchronousData(JdbcClass jdbcClass) {
|
||||
String mysql = "SELECT TABLE_NAME t_name,TABLE_COMMENT table_comment,TABLE_ROWS table_rows,(SELECT count(*) FROM INFORMATION_SCHEMA.columns WHERE TABLE_SCHEMA = '"+jdbcClass.getDatabaseName()+"' and TABLE_NAME=t_name) fields FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='"+jdbcClass.getDatabaseName()+"'";
|
||||
String user = jdbcClass.getUsername();
|
||||
String pwd = jdbcClass.getPassword();
|
||||
String jdbc = "com.mysql.cj.jdbc.Driver";
|
||||
String jdbcUrl = "jdbc:mysql://" + jdbcClass.getLinkAddress() + ":" + jdbcClass.getPort() + "/" + jdbcClass.getDatabaseName();
|
||||
Connection connection = null;
|
||||
ArrayList<DataAsset> dataAssets = new ArrayList<>();
|
||||
try {
|
||||
Class.forName(jdbc);
|
||||
connection = DriverManager.getConnection(jdbcUrl, user, pwd);
|
||||
PreparedStatement preparedStatement = connection.prepareStatement(mysql);
|
||||
ResultSet resultSet = preparedStatement.executeQuery();
|
||||
while (resultSet.next()) {
|
||||
DataAsset dataAsset = new DataAsset();
|
||||
dataAsset.setTableName(resultSet.getString("t_name"));
|
||||
dataAsset.setTableComment(resultSet.getString("table_comment"));
|
||||
dataAsset.setTableCount(Long.valueOf(resultSet.getString("table_rows")));
|
||||
dataAsset.setFields(Long.valueOf(resultSet.getString("fields")));
|
||||
dataAsset.setDataSourceId(jdbcClass.getId());
|
||||
dataAsset.setCreateBy(SecurityUtils.getUsername());
|
||||
dataAsset.setCreateTime(new java.util.Date());
|
||||
dataAssets.add(dataAsset);
|
||||
}
|
||||
dataAssetMapper.batchInsert(dataAssets);
|
||||
for (DataAsset dataAsset : dataAssets) {
|
||||
List<AssetModel> tableAssets = getTableAssets(jdbcClass, dataAsset.getTableName());
|
||||
tableAssets.stream().forEach(assetModel -> assetModel.setDataAssetId(dataAsset.getId()));
|
||||
assetModelMapper.batchInsert(tableAssets);
|
||||
}
|
||||
} catch ( SQLException | ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Result dattaList (JdbcClass jdbcClass){
|
||||
DataAsset dataAsset = new DataAsset();
|
||||
dataAsset.setDataSourceId(jdbcClass.getId());
|
||||
List<DataAsset> dataAssets = dataAssetMapper.selectDataAssetList(dataAsset);
|
||||
return Result.success(dataAssets);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result assrtModelList (JdbcClass jdbcClass){
|
||||
AssetModel assetModel = new AssetModel();
|
||||
assetModel.setDataAssetId(jdbcClass.getId());
|
||||
List<AssetModel> assetModels = assetModelMapper.selectAssetModelList(assetModel);
|
||||
return Result.success(assetModels);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -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 static void main (String[] args) {
|
||||
SpringApplication.run(MuYuSystemApplication.class, args);
|
||||
System.out.println("(♥◠‿◠)ノ゙ 系统模块启动成功 ლ(´ڡ`ლ)゙ \n" +
|
||||
" .-------. ____ __ \n" +
|
||||
" | _ _ \\ \\ \\ / / \n" +
|
||||
" | ( ' ) | \\ _. / ' \n" +
|
||||
" |(_ o _) / _( )_ .' \n");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -14,15 +14,16 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 115.159.67.205:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
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.muyu.system.mapper: DEBUG
|
||||
|
|
|
@ -14,12 +14,13 @@ spring:
|
|||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 115.159.67.205:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
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
|
||||
|
|
3
pom.xml
3
pom.xml
|
@ -10,7 +10,7 @@
|
|||
|
||||
<name>muyu</name>
|
||||
|
||||
<description>若依微服务系统</description>
|
||||
<description>微服务系统</description>
|
||||
|
||||
<properties>
|
||||
<muyu.version>3.6.3</muyu.version>
|
||||
|
@ -215,6 +215,7 @@
|
|||
<module>muyu-visual</module>
|
||||
<module>muyu-modules</module>
|
||||
<module>muyu-common</module>
|
||||
<module>muyu-modules/muyu-kvt</module>
|
||||
</modules>
|
||||
<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(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(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', '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','',''),
|
||||
(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','',''),
|
||||
(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,'');
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue