add handle filter dinamic like

This commit is contained in:
2025-01-13 15:43:13 +07:00
parent d12b14c5d4
commit 1f80bdc8ab

View File

@ -93,6 +93,11 @@ export default class CommonHelper {
whereVal[p + '_to'] = fr['to']; whereVal[p + '_to'] = fr['to'];
found = true; found = true;
} }
if (fr['like']) {
whereAttrPre.push('LOWER(' + p + ') like :' + p + '_like');
whereVal[p + '_like'] = '%' + fr['like'].toLowerCase() + '%';;
found = true;
}
if (!found) { if (!found) {
whereAttrPre.push("LOWER(" + p + ") = :" + p); whereAttrPre.push("LOWER(" + p + ") = :" + p);
@ -157,7 +162,7 @@ export default class CommonHelper {
if (param.col_any_like.length > 0) { if (param.col_any_like.length > 0) {
const liker = []; const liker = [];
for (let c of param.col_any_like) { for (let c of param.col_any_like) {
liker.push(c + ' like :filter_like'); liker.push('LOWER(' + c + ') like :filter_like');
} }
const like = '(' + liker.join(' or ') + ')'; const like = '(' + liker.join(' or ') + ')';