fine:()类型转换

master
Yueng 2024-09-01 10:40:55 +08:00
parent f50f85502f
commit 725f1d3d1c
3 changed files with 9 additions and 5 deletions

View File

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

View File

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

View File

@ -151,7 +151,7 @@ public class DataRunNameServiceImpl implements DataRunNameService {
* @return
*/
@Override
public List<DataValue> findTableValue(String basicId, String dataId) {
public List<DataValue> findTableValue(String basicId, String dataId,String tableName) {
DataName byId = dataNameService.getById(dataId);
MySqlQuery mySqlQuery = new MySqlQuery();
mySqlQuery.setDataSourceId(String.valueOf(basicId));
@ -167,7 +167,7 @@ public class DataRunNameServiceImpl implements DataRunNameService {
List<DataValue> list = new ArrayList<>();
try {
PreparedStatement preparedStatement = conn.prepareStatement("select field,type,annotation FROM tablefie WHERE table_id="+basicId);
PreparedStatement preparedStatement = conn.prepareStatement("select field,type,annotation FROM "+tableName+" WHERE table_id="+basicId);
ResultSet resultSet = preparedStatement.executeQuery();
ResultSetMetaData metaData = resultSet.getMetaData();