add function handler filter from to and etc
This commit is contained in:
@ -106,16 +106,32 @@ export default class CommonHelper {
|
||||
|
||||
for (let p in param.filter) {
|
||||
let f = String(param.filter[p])
|
||||
let fr = param.filter[p]
|
||||
|
||||
if (p != 'any') {
|
||||
if (!validate(f)) {
|
||||
whereAttrPre.push("LOWER(" + p + ") = :" + p);
|
||||
f = f.toLowerCase();
|
||||
} else {
|
||||
whereAttrPre.push(p + " = :" + p);
|
||||
}
|
||||
let found = false;
|
||||
if (fr['from']) {
|
||||
whereAttrPre.push(p + " >= :" + p + '_from');
|
||||
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 {
|
||||
filter_any = true;
|
||||
filter_any_val = f;
|
||||
@ -149,10 +165,10 @@ export default class CommonHelper {
|
||||
}
|
||||
|
||||
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) {
|
||||
whereVal['filter_like'] = '%' + filter_any_val.toLowerCase() + '%';
|
||||
whereVal['filter_like'] = '%' + filter_any_val + '%';
|
||||
}
|
||||
}
|
||||
} catch (e: any) {
|
||||
@ -186,7 +202,7 @@ export default class CommonHelper {
|
||||
whereVal['filter_eq'] = param.filter.toLowerCase();
|
||||
}
|
||||
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