7129-fixFilter #2766
|
@ -91,25 +91,23 @@ 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 {'r.id': value};
|
return {'id': value};
|
||||||
case 'from':
|
case 'from':
|
||||||
return {'r.created': {gte: value}};
|
return {'created': {gte: value}};
|
||||||
case 'to':
|
case 'to':
|
||||||
return {'r.created': {lte: value}};
|
return {'created': {lte: value}};
|
||||||
case 'm3':
|
case 'm3':
|
||||||
return {'r.m3': value};
|
return {'m3': value};
|
||||||
case 'description':
|
case 'description':
|
||||||
return {'r.description': {like: `%${value}%`}};
|
return {'description': {like: `%${value}%`}};
|
||||||
case 'warehouseFk':
|
case 'warehouseFk':
|
||||||
param = `v.${param}`;
|
param = `${param}`;
|
||||||
return {[param]: value};
|
return {[param]: value};
|
||||||
case 'workerFk':
|
|
||||||
case 'vehicleFk':
|
|
||||||
case 'agencyModeFk':
|
case 'agencyModeFk':
|
||||||
param = `r.${param}`;
|
param = `${param}`;
|
||||||
return {[param]: value};
|
return {[param]: value};
|
||||||
case 'isOk':
|
case 'isOk':
|
||||||
return {'r.isOk': value};
|
return {'isOk': value};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -119,34 +117,38 @@ module.exports = Self => {
|
||||||
let stmt;
|
let stmt;
|
||||||
|
|
||||||
stmt = new ParameterizedSQL(
|
stmt = new ParameterizedSQL(
|
||||||
`SELECT
|
`SELECT *
|
||||||
r.id,
|
FROM(
|
||||||
r.workerFk,
|
SELECT
|
||||||
r.created,
|
r.id,
|
||||||
r.vehicleFk,
|
r.workerFk,
|
||||||
r.agencyModeFk,
|
r.created,
|
||||||
r.time,
|
r.vehicleFk,
|
||||||
r.isOk,
|
r.agencyModeFk,
|
||||||
r.kmStart,
|
r.time,
|
||||||
r.kmEnd,
|
r.isOk,
|
||||||
r.started,
|
r.kmStart,
|
||||||
r.finished,
|
r.kmEnd,
|
||||||
r.gestdocFk,
|
r.started,
|
||||||
r.cost,
|
r.finished,
|
||||||
r.m3,
|
r.gestdocFk,
|
||||||
r.description,
|
r.cost,
|
||||||
am.name agencyName,
|
r.m3,
|
||||||
u.name AS workerUserName,
|
r.description,
|
||||||
v.numberPlate AS vehiclePlateNumber,
|
am.name agencyName,
|
||||||
Date_format(r.time, '%H:%i') hour,
|
u.name workerUserName,
|
||||||
eu.email
|
v.numberPlate vehiclePlateNumber,
|
||||||
FROM route r
|
Date_format(r.time, '%H:%i') hour,
|
||||||
LEFT JOIN agencyMode am ON am.id = r.agencyModeFk
|
eu.email,
|
||||||
LEFT JOIN agency a ON a.id = am.agencyFk
|
v.warehouseFk
|
||||||
LEFT JOIN vehicle v ON v.id = r.vehicleFk
|
FROM route r
|
||||||
LEFT JOIN worker w ON w.id = r.workerFk
|
LEFT JOIN agencyMode am ON am.id = r.agencyModeFk
|
||||||
LEFT JOIN account.user u ON u.id = w.id
|
LEFT JOIN agency a ON a.id = am.agencyFk
|
||||||
LEFT JOIN account.emailUser eu ON eu.userFk = r.workerFk`
|
LEFT JOIN vehicle v ON v.id = r.vehicleFk
|
||||||
|
LEFT JOIN worker w ON w.id = r.workerFk
|
||||||
|
LEFT JOIN account.user u ON u.id = w.id
|
||||||
|
LEFT JOIN account.emailUser eu ON eu.userFk = r.workerFk
|
||||||
|
) sub`
|
||||||
);
|
);
|
||||||
|
|
||||||
stmt.merge(conn.makeSuffix(filter));
|
stmt.merge(conn.makeSuffix(filter));
|
||||||
|
|
Loading…
Reference in New Issue