8032-devToTest_2440 #3009
|
@ -10,7 +10,7 @@ BEGIN
|
|||
SELECT * FROM (
|
||||
SELECT cc.client clientFk, ci.grade
|
||||
FROM creditClassification cc
|
||||
JOIN creditInsurance ci ON cc.id = ci.creditClassification
|
||||
JOIN creditInsurance ci ON cc.id = ci.creditClassificationFk
|
||||
WHERE dateEnd IS NULL
|
||||
ORDER BY ci.creationDate DESC
|
||||
LIMIT 10000000000000000000) t1
|
||||
|
|
|
@ -5,7 +5,7 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`creditInsurance_afterIn
|
|||
BEGIN
|
||||
UPDATE `client` c
|
||||
JOIN vn.creditClassification cc ON cc.client = c.id
|
||||
SET creditInsurance = NEW.credit WHERE cc.id = NEW.creditClassification;
|
||||
SET creditInsurance = NEW.credit WHERE cc.id = NEW.creditClassificationFk;
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`creditInsurance_beforeInsert`
|
||||
BEFORE INSERT ON `creditInsurance`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
IF NEW.creditClassificationFk THEN
|
||||
SET NEW.creditClassification = NEW.creditClassificationFk;
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -5,7 +5,7 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`solunionCAP_afterInsert
|
|||
BEGIN
|
||||
UPDATE client c
|
||||
JOIN creditClassification cc ON cc.client = c.id
|
||||
JOIN creditInsurance ci ON ci.creditClassification = cc.id
|
||||
JOIN creditInsurance ci ON ci.creditClassificationFk = cc.id
|
||||
SET creditInsurance = ci.credit * 2 WHERE ci.id = NEW.creditInsurance;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -6,12 +6,12 @@ BEGIN
|
|||
IF NEW.dateLeaving IS NOT NULL THEN
|
||||
UPDATE client c
|
||||
JOIN creditClassification cc ON cc.client = c.id
|
||||
JOIN creditInsurance ci ON ci.creditClassification = cc.id
|
||||
JOIN creditInsurance ci ON ci.creditClassificationFk = cc.id
|
||||
SET creditInsurance = ci.credit WHERE ci.id = OLD.creditInsurance;
|
||||
ELSE
|
||||
UPDATE client c
|
||||
JOIN creditClassification cc ON cc.client = c.id
|
||||
JOIN creditInsurance ci ON ci.creditClassification = cc.id
|
||||
JOIN creditInsurance ci ON ci.creditClassificationFk = cc.id
|
||||
SET creditInsurance = ci.credit * 2 WHERE ci.id = OLD.creditInsurance;
|
||||
END IF;
|
||||
END$$
|
||||
|
|
|
@ -5,7 +5,7 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`solunionCAP_beforeDelet
|
|||
BEGIN
|
||||
UPDATE client c
|
||||
JOIN creditClassification cc ON cc.client = c.id
|
||||
JOIN creditInsurance ci ON ci.creditClassification = cc.id
|
||||
JOIN creditInsurance ci ON ci.creditClassificationFk = cc.id
|
||||
SET creditInsurance = ci.credit WHERE ci.id = OLD.creditInsurance;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE vn.creditInsurance
|
||||
CHANGE creditClassification creditClassification__ int(11) DEFAULT NULL COMMENT '@deprecated 2024-09-11';
|
Loading…
Reference in New Issue