fine:()类型转换

master
Yueng 2024-08-31 01:19:37 +08:00
parent 1f780b3626
commit 541c95ed82
5 changed files with 9 additions and 8 deletions

View File

@ -66,8 +66,8 @@ public class DataRunNameController {
*/ */
@PostMapping("/findTableValue") @PostMapping("/findTableValue")
@Operation(summary = "获取数据库名",description = "返回所有数据库以及所有表的结果集") @Operation(summary = "获取数据库名",description = "返回所有数据库以及所有表的结果集")
public Result<List<DataValue>> findTableValue(@RequestParam(name = "basicId") String basicId){ public Result<List<DataValue>> findTableValue(@RequestParam(name = "basicId") String basicId,@RequestParam(name = "dataName") String dataName){
return Result.success(dataRunNameService.findTableValue(basicId)); return Result.success(dataRunNameService.findTableValue(basicId,dataName));
} }
} }

View File

@ -38,5 +38,5 @@ public interface DataRunNameService {
* @param basicId ID * @param basicId ID
* @return * @return
*/ */
List<DataValue> findTableValue(String basicId); List<DataValue> findTableValue(String basicId, String dataName);
} }

View File

@ -39,7 +39,8 @@ public class DataNameServiceImpl
public List<DataName> extractDataName() { public List<DataName> extractDataName() {
String sql = null; String sql = null;
DruidDataSource druidDataSource = JdbcHelper.getConnRs(); String dataName= "core_data_warehouse";
DruidDataSource druidDataSource = JdbcHelper.getConnRs(dataName);
sql = "SHOW DATABASES;"; sql = "SHOW DATABASES;";
try { try {
assert druidDataSource != null; assert druidDataSource != null;

View File

@ -153,11 +153,11 @@ public class DataRunNameServiceImpl implements DataRunNameService {
* @return * @return
*/ */
@Override @Override
public List<DataValue> findTableValue(String basicId) { public List<DataValue> findTableValue(String basicId, String dataName) {
MySqlQuery mySqlQuery = new MySqlQuery(); MySqlQuery mySqlQuery = new MySqlQuery();
mySqlQuery.setDataSourceId(String.valueOf(basicId)); mySqlQuery.setDataSourceId(String.valueOf(basicId));
DruidDataSource connRs1 = JdbcHelper.getConnRs(); DruidDataSource connRs1 = JdbcHelper.getConnRs(dataName);
DruidPooledConnection conn = null; DruidPooledConnection conn = null;
try { try {
conn = connRs1.getConnection(); conn = connRs1.getConnection();

View File

@ -54,11 +54,11 @@ public class JdbcHelper {
* *
* @return * @return
*/ */
public static DruidDataSource getConnRs() { public static DruidDataSource getConnRs(String dataName) {
try { try {
DruidDataSource druidDataSource = new DruidDataSource(); DruidDataSource druidDataSource = new DruidDataSource();
druidDataSource.setUrl("jdbc:mysql://21.12.0.10:3306/core_data_warehouse?useUnicode=true&characterEncoding" + druidDataSource.setUrl("jdbc:mysql://21.12.0.10:3306/"+dataName+"?useUnicode=true&characterEncoding" +
"=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8"); "=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8");
druidDataSource.setUsername("root"); druidDataSource.setUsername("root");
druidDataSource.setPassword("Bwie-8666"); druidDataSource.setPassword("Bwie-8666");