Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into dev
gitea/salix/dev This commit looks good Details

This commit is contained in:
Carlos Jimenez Ruiz 2019-09-24 14:39:22 +02:00
commit 0c27b90c5d
6 changed files with 28 additions and 8 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

@ -96,7 +96,12 @@ module.exports = Self => {
let where = buildFilter(ctx.args, (param, value) => { let where = buildFilter(ctx.args, (param, value) => {
switch (param) { switch (param) {
case 'search': case 'search':
return {'o.id': value}; return /^\d+$/.test(value)
? {'o.id': value}
: {or: [
{'c.name': {like: `%${value}%`}}
]};
// return {'o.id': value};
case 'from': case 'from':
return {'o.date_send': {gte: value}}; return {'o.date_send': {gte: value}};
case 'to': case 'to':

View File

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

View File

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

View File

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

View File

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