Trying to use 2 tables. Please help me how to append the second resultset to first one
EX - Первая таблица имеет CusID ReqID Amount
Вторая таблица имеет CusID ReqID ItemName Rate UPC
fun resultSetToList(rs: ResultSet): List<Map<String, Any>> {
val md = rs.metaData
val columns = md.columnCount
val rows = ArrayList<Map<String, Any>>()
while (rs.next()) {
val row = HashMap<String, Any>(columns)
for (i in 1..columns) {
row[md.getColumnName(i)] = rs.getObject(i)
//calling sub query
getRequestorItemDetails(wcsExternalCustomerId, rs.getObject(i))
}
rows.add(row)
}
return rows
}
Вторая функция для вызова другого запроса
fun getRequestorItemDetails(wcsExternalCustomerId : String, RequestorId : Any) : Any {
var listset : Any = ""
val results = jdbcTemplate.query(
"SELECT ItemName, Quantity, Rate, UPC FROM table WHERE CustomerId = ? and RequestorId = ? ",
wcsExternalCustomerId, RequestorId)
{
rs: ResultSet, _: Int ->
listset = resultSetToList(rs)
}
return listset