|
|
@ -203,12 +203,17 @@ const parseConditionV2 = async ( |
|
|
|
filter.comparison_op === 'notempty' |
|
|
|
filter.comparison_op === 'notempty' |
|
|
|
) |
|
|
|
) |
|
|
|
filter.value = ''; |
|
|
|
filter.value = ''; |
|
|
|
const field = customWhereClause |
|
|
|
let field = customWhereClause |
|
|
|
? filter.value |
|
|
|
? filter.value |
|
|
|
: alias |
|
|
|
: alias |
|
|
|
? `${alias}.${column.column_name}` |
|
|
|
? `${alias}.${column.column_name}` |
|
|
|
: column.column_name; |
|
|
|
: column.column_name; |
|
|
|
const val = customWhereClause ? customWhereClause : filter.value; |
|
|
|
let val = customWhereClause ? customWhereClause : filter.value; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (column.uidt === UITypes.Formula) { |
|
|
|
|
|
|
|
[field, val] = [val, field]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return qb => { |
|
|
|
return qb => { |
|
|
|
switch (filter.comparison_op) { |
|
|
|
switch (filter.comparison_op) { |
|
|
|
case 'eq': |
|
|
|
case 'eq': |
|
|
@ -218,17 +223,27 @@ const parseConditionV2 = async ( |
|
|
|
qb = qb.whereNot(field, val); |
|
|
|
qb = qb.whereNot(field, val); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 'like': |
|
|
|
case 'like': |
|
|
|
|
|
|
|
if (column.uidt === UITypes.Formula) { |
|
|
|
|
|
|
|
val = `%${val}%`.replace("%'", '%').replace("'%", '%'); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
val = `%${val}%`; |
|
|
|
|
|
|
|
} |
|
|
|
qb = qb.where( |
|
|
|
qb = qb.where( |
|
|
|
field, |
|
|
|
field, |
|
|
|
qb?.client?.config?.client === 'pg' ? 'ilike' : 'like', |
|
|
|
qb?.client?.config?.client === 'pg' ? 'ilike' : 'like', |
|
|
|
`%${val}%` |
|
|
|
val |
|
|
|
); |
|
|
|
); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 'nlike': |
|
|
|
case 'nlike': |
|
|
|
|
|
|
|
if (column.uidt === UITypes.Formula) { |
|
|
|
|
|
|
|
val = `%${val}%`.replace("%'", '%').replace("'%", '%'); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
val = `%${val}%`; |
|
|
|
|
|
|
|
} |
|
|
|
qb = qb.whereNot( |
|
|
|
qb = qb.whereNot( |
|
|
|
field, |
|
|
|
field, |
|
|
|
qb?.client?.config?.client === 'pg' ? 'ilike' : 'like', |
|
|
|
qb?.client?.config?.client === 'pg' ? 'ilike' : 'like', |
|
|
|
`%${val}%` |
|
|
|
val |
|
|
|
); |
|
|
|
); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 'gt': |
|
|
|
case 'gt': |
|
|
|