ids as Value and not String

This commit is contained in:
Lukas-Heiligenbrunner 2020-02-28 09:13:42 +01:00
parent fbc53b97f5
commit cb5db3dddd
2 changed files with 3 additions and 4 deletions

View File

@ -28,19 +28,19 @@ class DeviceRequest : PostRequest() {
val deviceid = deviceset.getInt("DeviceID")
val cityid = deviceset.getInt("CityID")
if (cityid == -1) {
sb.append("{\"deviceid\":\"").append(deviceid).append("\",\"cityid\":\"").append(cityid).append("\"}")
sb.append("{\"deviceid\":").append(deviceid).append(",\"cityid\":").append(cityid).append("}")
}
else {
val devicename = deviceset.getString("DeviceName")
val devicelocation = deviceset.getString("DeviceLocation")
sb.append("{\"deviceid\":\"").append(deviceid).append("\",\"devicename\":\"").append(devicename).append("\",\"devicelocation\":\"").append(devicelocation).append("\",\"devices\":[")
sb.append("{\"deviceid\":").append(deviceid).append(",\"devicename\":\"").append(devicename).append("\",\"devicelocation\":\"").append(devicelocation).append("\",\"devices\":[")
val devicecities = jdbc.executeQuery("SELECT * FROM `device_city` INNER JOIN `cities` ON device_city.CityID=cities.id WHERE `DeviceID`='$deviceid'")
while (devicecities.next()) {
val cityidd = devicecities.getInt("id")
val cityname = devicecities.getString("name")
val wastetype = devicecities.getString("wastetype")
val zone = devicecities.getString("zone")
sb.append("{\"cityid\":\"").append(cityidd).append("\",\"cityname\":\"").append(cityname).append("\",\"wastetype\":\"").append(wastetype).append("\",\"zone\":\"").append(zone).append("\"}")
sb.append("{\"cityid\":").append(cityidd).append(",\"cityname\":\"").append(cityname).append("\",\"wastetype\":\"").append(wastetype).append("\",\"zone\":\"").append(zone).append("\"}")
if (!devicecities.isLast) {
sb.append(",")
}

View File

@ -36,7 +36,6 @@ class Device {
var devicelocation = data.data[i].devicelocation;
var row = "<tr><td>" + id + "</td><td>" + devicename + "</td><td>" + devicelocation + "</td><td>";
for (var n = 0; n < data.data[i].devices.length; n++) {
var cityname = data.data[i].devices[n].cityname;
var cityzone = data.data[i].devices[n].zone;