From 1f80bdc8ab9ca0028454bef25d5929b253248ea0 Mon Sep 17 00:00:00 2001 From: Abdul Rahman Reza Date: Mon, 13 Jan 2025 15:43:13 +0700 Subject: [PATCH] add handle filter dinamic like --- src/helpers/common.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/helpers/common.ts b/src/helpers/common.ts index 5284eb9..4416c65 100644 --- a/src/helpers/common.ts +++ b/src/helpers/common.ts @@ -93,6 +93,11 @@ export default class CommonHelper { whereVal[p + '_to'] = fr['to']; found = true; } + if (fr['like']) { + whereAttrPre.push('LOWER(' + p + ') like :' + p + '_like'); + whereVal[p + '_like'] = '%' + fr['like'].toLowerCase() + '%';; + found = true; + } if (!found) { whereAttrPre.push("LOWER(" + p + ") = :" + p); @@ -157,7 +162,7 @@ export default class CommonHelper { if (param.col_any_like.length > 0) { const liker = []; 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 ') + ')';