Bereich Tooltip Bereich und Standort enthalten
This commit is contained in:
@@ -13,7 +13,45 @@ export default async function handler(req, res) {
|
||||
return res.status(400).json({ error: "idMaps (Parameter 'm') ist erforderlich" });
|
||||
}
|
||||
|
||||
let query = "SELECT * FROM location_coordinates WHERE idMaps = ?";
|
||||
//let query = "SELECT * FROM location_coordinates WHERE idMaps = ?";
|
||||
/* let query = `
|
||||
SELECT
|
||||
l.name,
|
||||
l.shortname,
|
||||
lc.idMaps
|
||||
FROM
|
||||
talas_v5.location l
|
||||
JOIN
|
||||
talas_v5.location_coordinates lc
|
||||
ON
|
||||
l.idlocation = lc.idlocation
|
||||
WHERE
|
||||
lc.idMap = ?
|
||||
`; */
|
||||
/* let query = `
|
||||
SELECT * FROM talas_v5.location l JOIN talas_v5.location_coordinates lc ON l.idlocation = lc.idlocation WHERE lc.idMaps=?;
|
||||
`; */
|
||||
|
||||
let query = `
|
||||
SELECT
|
||||
l.idlocation,
|
||||
l.name AS location_name,
|
||||
lc.idMaps,
|
||||
a.name AS area_name,
|
||||
lc.x,
|
||||
lc.y
|
||||
FROM
|
||||
talas_v5.location l
|
||||
JOIN
|
||||
talas_v5.location_coordinates lc
|
||||
ON l.idlocation = lc.idlocation
|
||||
JOIN
|
||||
talas_v5.area a
|
||||
ON l.idarea = a.idarea
|
||||
WHERE
|
||||
lc.idMaps = ?;
|
||||
`;
|
||||
|
||||
const queryParams = [idMaps];
|
||||
|
||||
if (idLocation) {
|
||||
@@ -32,10 +70,12 @@ export default async function handler(req, res) {
|
||||
if (results.length > 0) {
|
||||
// Ergebnisse formatieren und zurückgeben
|
||||
const formattedResults = results.map((row) => ({
|
||||
idLocation: row.idLocation,
|
||||
idLocation: row.idlocation, // Prüfe hier auf korrekten Spaltennamen
|
||||
x: row.x,
|
||||
y: row.y,
|
||||
idMaps: row.idMaps,
|
||||
location_name: row.location_name, // Hinzufügen des Alias aus der SQL-Abfrage
|
||||
area_name: row.area_name, // Hinzufügen des Alias aus der SQL-Abfrage
|
||||
}));
|
||||
|
||||
res.status(200).json(formattedResults);
|
||||
|
||||
Reference in New Issue
Block a user