add function handler filter from to and etc
This commit is contained in:
@ -78,16 +78,32 @@ export default class CommonHelper {
|
|||||||
|
|
||||||
for (let p in param.filter) {
|
for (let p in param.filter) {
|
||||||
let f = String(param.filter[p])
|
let f = String(param.filter[p])
|
||||||
|
let fr = param.filter[p]
|
||||||
|
|
||||||
if (p != 'any') {
|
if (p != 'any') {
|
||||||
if (!validate(f)) {
|
if (!validate(f)) {
|
||||||
whereAttrPre.push("LOWER(" + p + ") = :" + p);
|
let found = false;
|
||||||
f = f.toLowerCase();
|
if (fr['from']) {
|
||||||
} else {
|
whereAttrPre.push(p + " >= :" + p + '_from');
|
||||||
whereAttrPre.push(p + " = :" + p);
|
whereVal[p + '_from'] = fr['from'];
|
||||||
}
|
found = true;
|
||||||
|
}
|
||||||
|
if (fr['to']) {
|
||||||
|
whereAttrPre.push(p + " <= :" + p + '_to');
|
||||||
|
whereVal[p + '_to'] = fr['to'];
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
|
||||||
whereVal[p] = f;
|
if (!found) {
|
||||||
|
whereAttrPre.push("LOWER(" + p + ") = :" + p);
|
||||||
|
f = f.toLowerCase();
|
||||||
|
|
||||||
|
whereVal[p] = f;
|
||||||
|
}
|
||||||
|
} else {//uuid only
|
||||||
|
whereAttrPre.push(p + " = :" + p);
|
||||||
|
whereVal[p] = f;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
filter_any = true;
|
filter_any = true;
|
||||||
filter_any_val = f;
|
filter_any_val = f;
|
||||||
@ -121,10 +137,10 @@ export default class CommonHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (param.col_any_eq.length > 0) {
|
if (param.col_any_eq.length > 0) {
|
||||||
whereVal['filter_eq'] = filter_any_val.toLowerCase();
|
whereVal['filter_eq'] = filter_any_val;
|
||||||
}
|
}
|
||||||
if (param.col_any_like.length > 0) {
|
if (param.col_any_like.length > 0) {
|
||||||
whereVal['filter_like'] = '%' + filter_any_val.toLowerCase() + '%';
|
whereVal['filter_like'] = '%' + filter_any_val + '%';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
@ -158,7 +174,7 @@ export default class CommonHelper {
|
|||||||
whereVal['filter_eq'] = param.filter.toLowerCase();
|
whereVal['filter_eq'] = param.filter.toLowerCase();
|
||||||
}
|
}
|
||||||
if (param.col_any_like.length > 0) {
|
if (param.col_any_like.length > 0) {
|
||||||
whereVal['filter_like'] = '%' + param.filter.toLowerCase() + '%';
|
whereVal['filter_like'] = '%' + param.filter + '%';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user