Merge branch 'dev' into 4024-client_defaulter
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
096f225656
|
@ -0,0 +1,8 @@
|
|||
ALTER TABLE `vn`.`creditInsurance` ADD creditClassificationFk int(11) NULL;
|
||||
|
||||
UPDATE `vn`.`creditInsurance` AS `destiny`
|
||||
SET `destiny`.`creditClassificationFk`= (SELECT creditClassification FROM `vn`.`creditInsurance` AS `origin` WHERE `origin`.id = `destiny`.id);
|
||||
|
||||
ALTER TABLE `vn`.`creditInsurance`
|
||||
ADD CONSTRAINT `creditInsurance_creditClassificationFk` FOREIGN KEY (`creditClassificationFk`)
|
||||
REFERENCES `vn`.`creditClassification` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
@ -0,0 +1,11 @@
|
|||
DELIMITER $$
|
||||
$$
|
||||
CREATE DEFINER=`root`@`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 ;
|
|
@ -458,7 +458,7 @@ INSERT INTO `vn`.`creditClassification`(`id`, `client`, `dateStart`, `dateEnd`)
|
|||
(4, 1104, CURDATE(), CURDATE()),
|
||||
(5, 1105, CURDATE(), CURDATE());
|
||||
|
||||
INSERT INTO `vn`.`creditInsurance`(`id`, `creditClassification`, `credit`, `creationDate`, `grade`)
|
||||
INSERT INTO `vn`.`creditInsurance`(`id`, `creditClassificationFk`, `credit`, `creationDate`, `grade`)
|
||||
VALUES
|
||||
(1, 1, 3000, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), NULL),
|
||||
(2, 2, 6000, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), NULL),
|
||||
|
|
|
@ -38,7 +38,7 @@ module.exports = Self => {
|
|||
}, myOptions);
|
||||
|
||||
await models.CreditInsurance.create({
|
||||
creditClassification: newClassification.id,
|
||||
creditClassificationFk: newClassification.id,
|
||||
credit: data.credit,
|
||||
grade: data.grade
|
||||
}, myOptions);
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
"insurances": {
|
||||
"type": "hasMany",
|
||||
"model": "CreditInsurance",
|
||||
"foreignKey": "creditClassification"
|
||||
"foreignKey": "creditClassificationFk"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -24,7 +24,7 @@ module.exports = function(Self) {
|
|||
let filter = {
|
||||
fields: ['grade'],
|
||||
where: {
|
||||
creditClassification: this.creditClassification
|
||||
creditClassificationFk: this.creditClassificationFk
|
||||
},
|
||||
order: 'created DESC'
|
||||
};
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
"classification": {
|
||||
"type": "belongsTo",
|
||||
"model": "CreditClassification",
|
||||
"foreignKey": "creditClassification"
|
||||
"foreignKey": "creditClassificationFk"
|
||||
}
|
||||
},
|
||||
"scope": {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<vn-crud-model
|
||||
vn-id="model"
|
||||
url="CreditInsurances"
|
||||
link="{creditClassification: $ctrl.$params.classificationId}"
|
||||
link="{creditClassificationFk: $ctrl.$params.classificationId}"
|
||||
limit="20"
|
||||
data="insurances"
|
||||
auto-load="true">
|
||||
|
|
Loading…
Reference in New Issue