links liste

This commit is contained in:
2026-02-16 09:35:42 +01:00
parent 3f1e5aacc9
commit f14f92fdd8

View File

@@ -29,11 +29,14 @@ $endpointUnionSql = "
'module' AS endpoint_type,
mp.id AS endpoint_id,
mp.name AS port_name,
CONCAT(d.name, ' / ', m.name) AS owner_name,
d.id AS owner_device_id
CONCAT(IFNULL(MIN(d.name), 'Unzugeordnet'), ' / ', m.name) AS owner_name,
MIN(d.id) AS owner_device_id
FROM module_ports mp
JOIN modules m ON m.id = mp.module_id
JOIN devices d ON d.id = m.device_id
LEFT JOIN device_port_modules dpm ON dpm.module_id = m.id
LEFT JOIN device_ports dp ON dp.id = dpm.device_port_id
LEFT JOIN devices d ON d.id = dp.device_id
GROUP BY mp.id, mp.name, m.name
UNION ALL
SELECT
'outlet' AS endpoint_type,
@@ -149,10 +152,12 @@ if ($deviceId > 0) {
FROM device_ports dp
WHERE dp.device_id = ?
UNION ALL
SELECT mp.id
SELECT DISTINCT mp.id
FROM module_ports mp
JOIN modules m ON m.id = mp.module_id
WHERE m.device_id = ?
JOIN device_port_modules dpm ON dpm.module_id = m.id
JOIN device_ports dp ON dp.id = dpm.device_port_id
WHERE dp.device_id = ?
) p",
"ii",
[$deviceId, $deviceId]
@@ -193,10 +198,12 @@ if ($deviceId > 0) {
FROM device_ports dp
WHERE dp.device_id = ?
UNION ALL
SELECT CONCAT(m.name, ' / ', mp.name) AS name, NULL AS vlan_config, (1000000 + mp.id) AS sort_id
SELECT DISTINCT CONCAT(m.name, ' / ', mp.name) AS name, NULL AS vlan_config, (1000000 + mp.id) AS sort_id
FROM module_ports mp
JOIN modules m ON m.id = mp.module_id
WHERE m.device_id = ?
JOIN device_port_modules dpm ON dpm.module_id = m.id
JOIN device_ports dp ON dp.id = dpm.device_port_id
WHERE dp.device_id = ?
) p
ORDER BY sort_id
LIMIT 12",