This commit is contained in:
parent
5b2b6a15ad
commit
40d5e8662b
|
@ -1,6 +1,5 @@
|
||||||
const {ParameterizedSQL} = require('loopback-connector');
|
const {ParameterizedSQL} = require('loopback-connector');
|
||||||
const {buildFilter, mergeFilters} = require('vn-loopback/util/filter');
|
const {buildFilter} = require('vn-loopback/util/filter');
|
||||||
// const {models} = require('vn-loopback/server/server');
|
|
||||||
|
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
Self.remoteMethod('filter', {
|
Self.remoteMethod('filter', {
|
||||||
|
@ -41,12 +40,13 @@ module.exports = Self => {
|
||||||
const where = buildFilter(filter?.where, (param, value) => {
|
const where = buildFilter(filter?.where, (param, value) => {
|
||||||
switch (param) {
|
switch (param) {
|
||||||
case 'search':
|
case 'search':
|
||||||
return {or: [
|
return {
|
||||||
{'pc.code': {like: `%${value}%`}},
|
or: [
|
||||||
{'t.name': {like: `%${value}%`}},
|
{'pc.code': {like: `%${value}%`}},
|
||||||
{'p.name': {like: `%${value}%`}},
|
{'t.name': {like: `%${value}%`}},
|
||||||
{'c.country': {like: `%${value}%`}}
|
{'p.name': {like: `%${value}%`}},
|
||||||
]
|
{'c.country': {like: `%${value}%`}}
|
||||||
|
]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}) ?? {};
|
}) ?? {};
|
||||||
|
|
Loading…
Reference in New Issue