新增MySQL和pg数据库的同步
This commit is contained in:
@@ -30,9 +30,9 @@ public class dbController {
|
|||||||
if (vToken.isValidToken(token)) {
|
if (vToken.isValidToken(token)) {
|
||||||
DbConfig dbConfig = dbConfigService.getById(dbId);
|
DbConfig dbConfig = dbConfigService.getById(dbId);
|
||||||
JdbcTemplate jdbcTemplate = DataSourceConfig.createJdbcTemplate(dbConfig);
|
JdbcTemplate jdbcTemplate = DataSourceConfig.createJdbcTemplate(dbConfig);
|
||||||
|
// 补充参数传递,修复SQL参数绑定问题
|
||||||
String querySql = "SELECT table_name FROM information_schema.tables WHERE table_schema = ?";
|
String querySql = "SELECT table_name FROM information_schema.tables WHERE table_schema = ?";
|
||||||
// 执行通用查询
|
List<Map<String, Object>> result = jdbcTemplate.queryForList(querySql, dbConfig.getDbSchema());
|
||||||
List<Map<String, Object>> result = jdbcTemplate.queryForList(querySql);
|
|
||||||
List<String> data = result.stream()
|
List<String> data = result.stream()
|
||||||
.map(row -> row.values().iterator().next().toString())
|
.map(row -> row.values().iterator().next().toString())
|
||||||
.toList();
|
.toList();
|
||||||
|
|||||||
Reference in New Issue
Block a user