修改返回值操作
parent
db933679ac
commit
dc073bf778
|
@ -25,7 +25,7 @@ public class DataValueController {
|
||||||
//获取字段值
|
//获取字段值
|
||||||
@PostMapping("/findTableValueList")
|
@PostMapping("/findTableValueList")
|
||||||
public Result findTableValueList(@RequestParam("basicId") Long basicId,@RequestParam("tableName") String tableName ) {
|
public Result findTableValueList(@RequestParam("basicId") Long basicId,@RequestParam("tableName") String tableName ) {
|
||||||
List<List<DataValue>> list= dataValueService.findTableValueList(basicId,tableName);
|
List<DataValue> list= dataValueService.findTableValueList(basicId,tableName);
|
||||||
return Result.success(list);
|
return Result.success(list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,5 +7,5 @@ import java.util.List;
|
||||||
public interface DataValueService {
|
public interface DataValueService {
|
||||||
List< List<DataValue> >findTableValue(Long basicId, String sql);
|
List< List<DataValue> >findTableValue(Long basicId, String sql);
|
||||||
|
|
||||||
List<List<DataValue>> findTableValueList(Long basicId, String tableName);
|
List<DataValue> findTableValueList(Long basicId, String tableName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class DataValueServiceImpl implements DataValueService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<List<DataValue>> findTableValueList(Long basicId, String tableName) {
|
public List<DataValue> findTableValueList(Long basicId, String tableName) {
|
||||||
Source source = sourceService.getInfo(basicId);
|
Source source = sourceService.getInfo(basicId);
|
||||||
String host = source.getHost();
|
String host = source.getHost();
|
||||||
String port = source.getPort();
|
String port = source.getPort();
|
||||||
|
@ -86,11 +86,10 @@ public class DataValueServiceImpl implements DataValueService {
|
||||||
String url = "jdbc:" + databaseType + "://" + host + ":" + port + "/" + databaseName + "?" + source.getConnectionParams();
|
String url = "jdbc:" + databaseType + "://" + host + ":" + port + "/" + databaseName + "?" + source.getConnectionParams();
|
||||||
String user = source.getUsername();
|
String user = source.getUsername();
|
||||||
String password = source.getPassword();
|
String password = source.getPassword();
|
||||||
List<List<DataValue>> list = new ArrayList<>();
|
|
||||||
Connection conn=null;
|
Connection conn=null;
|
||||||
|
ArrayList<DataValue> dataValues = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
ArrayList<DataValue> dataValues = new ArrayList<>();
|
|
||||||
conn = DriverManager.getConnection(url, user, password);
|
conn = DriverManager.getConnection(url, user, password);
|
||||||
try {
|
try {
|
||||||
PreparedStatement preparedStatement = conn.prepareStatement("SELECT * FROM " + tableName);
|
PreparedStatement preparedStatement = conn.prepareStatement("SELECT * FROM " + tableName);
|
||||||
|
@ -120,7 +119,7 @@ public class DataValueServiceImpl implements DataValueService {
|
||||||
.build();
|
.build();
|
||||||
dataValues.add(build);
|
dataValues.add(build);
|
||||||
}
|
}
|
||||||
list.add(dataValues);
|
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
@ -130,6 +129,6 @@ public class DataValueServiceImpl implements DataValueService {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return list;
|
return dataValues;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue