Refactor #1682 modificar modelos componentRate y componentTypeRate

This commit is contained in:
Bernat 2019-09-24 13:45:54 +02:00
parent faf355fab8
commit bf5a9967cf
5 changed files with 22 additions and 7 deletions

View File

@ -0,0 +1,15 @@
CREATE
OR REPLACE ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `vn`.`component` AS
SELECT
`t`.`Id_Componente` AS `id`,
`t`.`Componente` AS `name`,
`t`.`tarifa_componentes_series_id` AS `typeFk`,
`t`.`tarifa_class` AS `classRate`,
`t`.`tax` AS `tax`,
`t`.`is_renewable` AS `isRenewable`,
`t`.`code` AS `code`
FROM
`bi`.`tarifa_componentes` `t`;

View File

@ -3,7 +3,7 @@
"base": "VnModel",
"options": {
"mysql": {
"table": "componentRate"
"table": "component"
}
},
"properties": {
@ -24,7 +24,7 @@
"isRenewable": {
"type": "Number"
},
"componentTypeRate": {
"typeFk": {
"type": "Number"
},
"code": {
@ -35,7 +35,7 @@
"componentType": {
"type": "belongsTo",
"model": "ComponentTypeRate",
"foreignKey": "componentTypeRate"
"foreignKey": "typeFk"
}
},
"acls": [

View File

@ -3,7 +3,7 @@
"base": "VnModel",
"options": {
"mysql": {
"table": "componentTypeRate"
"table": "componentType"
}
},
"properties": {

View File

@ -17,7 +17,7 @@ class Controller {
include: {
relation: 'componentRate',
scope: {
fields: ['componentTypeRate', 'name'],
fields: ['typeFk', 'name'],
include: {
relation: 'componentType',
scope: {

View File

@ -133,8 +133,8 @@ module.exports = {
i.tag6, i.value6, i.tag7, i.value7
FROM vn.sale s
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
LEFT JOIN componentRate cr ON cr.id = sc.componentFk
LEFT JOIN componentTypeRate ctr ON ctr.id = cr.componentTypeRate
LEFT JOIN component cr ON cr.id = sc.componentFk
LEFT JOIN componentType ctr ON ctr.id = cr.typeFk
LEFT JOIN item i ON i.id = s.itemFk
LEFT JOIN ticket t ON t.id = s.ticketFk
LEFT JOIN origin o ON o.id = i.originFk