feat: refs #7119 add 'id' filter option and enhance bank policy model with dmsFk field
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jorge Penadés 2025-01-24 10:46:35 +01:00
parent f8e4561a59
commit 3fba81b41e
2 changed files with 9 additions and 5 deletions

View File

@ -69,13 +69,14 @@ module.exports = Self => {
switch (param) {
case 'search':
return {or: [{'v.id': value}, {numberPlate: {like: `%${value}%`}}]};
case 'id':
return {'v.id': value};
case 'description':
case 'tradeMark':
case 'numberPlate':
case 'chassis':
case 'leasing':
return {[param]: {like: `%${value}%`}};
case 'id':
case 'companyFk':
case 'warehouseFk':
case 'countryCodeFk':
@ -83,9 +84,9 @@ module.exports = Self => {
case 'vehicleTypeFk':
return {[param]: value};
}
}) || {};
});
const myFilter = mergeFilters(filter, {where});
filter = mergeFilters(filter, {where});
const stmt = new ParameterizedSQL(`
SELECT v.id,
@ -116,9 +117,9 @@ module.exports = Self => {
) sub ON sub.vehicleFk = v.id AND sub.rn = 1
`);
const sqlWhere = conn.makeWhere(myFilter.where);
const sqlWhere = conn.makeWhere(filter.where);
stmt.merge(sqlWhere);
stmt.merge(conn.makePagination(myFilter));
stmt.merge(conn.makePagination(filter));
const sql = ParameterizedSQL.join([stmt], ';');

View File

@ -13,6 +13,9 @@
},
"ref": {
"type": "string"
},
"dmsFk": {
"type": "number"
}
}
}