fix: business overlapping
gitea/salix/pipeline/pr-master This commit looks good
Details
gitea/salix/pipeline/pr-master This commit looks good
Details
This commit is contained in:
parent
a303d22a18
commit
ea0b0dc779
|
@ -12,23 +12,21 @@ BEGIN
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
IF !(OLD.started <=> NEW.started AND OLD.ended <=> NEW.ended) THEN
|
IF !(OLD.started <=> NEW.started AND OLD.ended <=> NEW.ended) THEN
|
||||||
|
SELECT util.hasDateOverlapped(
|
||||||
SELECT COUNT(*) > 0 INTO isOverlapping
|
started,
|
||||||
FROM business b
|
ended,
|
||||||
WHERE (util.hasDateOverlapped(
|
|
||||||
NEW.started,
|
NEW.started,
|
||||||
IFNULL(NEW.ended, b.started),
|
IFNULL(NEW.ended, b.started)
|
||||||
b.started,
|
) isOverlapped INTO isOverlapping
|
||||||
IFNULL(b.ended, NEW.started))
|
FROM vn.business b
|
||||||
OR (NEW.ended <=> NULL AND b.ended <=> NULL))
|
WHERE workerFk = NEW.workerFK
|
||||||
AND b.id <> OLD.id
|
AND b.id <> NEW.id
|
||||||
AND workerFk = OLD.workerFk;
|
ORDER BY isOverlapped DESC
|
||||||
|
LIMIT 1;
|
||||||
|
|
||||||
IF isOverlapping THEN
|
IF isOverlapping THEN
|
||||||
CALL util.throw ('IS_OVERLAPPING');
|
CALL util.throw ('IS_OVERLAPPING');
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
Loading…
Reference in New Issue