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