feat: refs #8057 Requested changes
gitea/salix/pipeline/pr-dev Build queued... Details

This commit is contained in:
Guillermo Bonet 2024-11-18 08:58:38 +01:00
parent b9397c527d
commit 353ca659cd
3 changed files with 9 additions and 6 deletions

View File

@ -14,9 +14,10 @@ BEGIN
SELECT p.geoFk INTO vGeoFk SELECT p.geoFk INTO vGeoFk
FROM address a FROM address a
JOIN town t ON t.provinceFk = a.provinceFk JOIN town t ON t.provinceFk = a.provinceFk
JOIN postCode p ON p.townFk = t.id AND p.`code` = a.postalCode JOIN postCode p ON p.townFk = t.id
WHERE a.id = vSelf WHERE a.id = vSelf
ORDER BY (a.city SOUNDS LIKE t.`name`) DESC ORDER BY (a.city SOUNDS LIKE t.name) DESC,
(p.code = a.postalCode) DESC
LIMIT 1; LIMIT 1;
RETURN vGeoFk; RETURN vGeoFk;

View File

@ -15,9 +15,9 @@ BEGIN
FROM client c FROM client c
JOIN town t ON t.provinceFk = c.provinceFk JOIN town t ON t.provinceFk = c.provinceFk
JOIN postCode p ON p.townFk = t.id JOIN postCode p ON p.townFk = t.id
AND p.`code` = c.postcode
WHERE c.id = vSelf WHERE c.id = vSelf
ORDER BY (c.city SOUNDS LIKE t.`name`) DESC ORDER BY (c.city SOUNDS LIKE t.name) DESC,
(p.code = c.postcode) DESC
LIMIT 1; LIMIT 1;
RETURN vGeoFk; RETURN vGeoFk;

View File

@ -15,9 +15,11 @@ BEGIN
FROM supplier s FROM supplier s
JOIN town t ON t.provinceFk = s.provinceFk JOIN town t ON t.provinceFk = s.provinceFk
JOIN postCode p ON p.townFk = t.id JOIN postCode p ON p.townFk = t.id
AND p.`code` = s.postCode LEFT JOIN supplierAddress sad ON sad.supplierFk = s.id
WHERE s.id = vSelf WHERE s.id = vSelf
ORDER BY (s.city SOUNDS LIKE t.`name`) DESC ORDER BY (s.city SOUNDS LIKE t.name) DESC,
(p.code = s.postCode) DESC,
(p.code = sad.postalCode) DESC
LIMIT 1; LIMIT 1;
RETURN vGeoFk; RETURN vGeoFk;