This commit is contained in:
Benjamin Toby
2024-12-26 18:39:17 +01:00
parent 9dbaca5ebe
commit e4590e74d9
4 changed files with 12 additions and 5 deletions
@@ -35,8 +35,12 @@ function sqlGenerator({ tableName, genObject }) {
typeof queryObj.value == "number"
) {
const valueParsed = String(queryObj.value);
if (queryObj.equality == "LIKE") {
str = `LOWER(${finalFieldName}) LIKE LOWER('%${valueParsed}%')`;
} else if (queryObj.equality == "NOT EQUAL") {
str = `${finalFieldName} != ?`;
sqlSearhValues.push(valueParsed);
} else {
sqlSearhValues.push(valueParsed);
}
@@ -49,6 +53,9 @@ function sqlGenerator({ tableName, genObject }) {
strArray.push(
`LOWER(${finalFieldName}) LIKE LOWER('%${valueParsed}%')`
);
} else if (queryObj.equality == "NOT EQUAL") {
strArray.push(`${finalFieldName} != ?`);
sqlSearhValues.push(valueParsed);
} else {
strArray.push(`${finalFieldName} = ?`);
sqlSearhValues.push(valueParsed);
+2 -2
View File
@@ -917,7 +917,7 @@ export type ServerQueryParam = {
strategy: "ASC" | "DESC";
};
searchOperator?: "AND" | "OR";
searchEquality?: "EQUAL" | "LIKE";
searchEquality?: "EQUAL" | "LIKE" | "NOT EQUAL";
addUserId?: {
fieldName: string;
};
@@ -931,7 +931,7 @@ export type ServerQueryQueryObject<T extends object = {
[key in keyof T]: {
value: string | string[];
operator?: "AND" | "OR";
equality?: "EQUAL" | "LIKE";
equality?: "EQUAL" | "LIKE" | "NOT EQUAL";
tableName?: string;
};
};
+2 -2
View File
@@ -1095,7 +1095,7 @@ export type ServerQueryParam = {
strategy: "ASC" | "DESC";
};
searchOperator?: "AND" | "OR";
searchEquality?: "EQUAL" | "LIKE";
searchEquality?: "EQUAL" | "LIKE" | "NOT EQUAL";
addUserId?: {
fieldName: string;
};
@@ -1109,7 +1109,7 @@ export type ServerQueryQueryObject<T extends object = { [key: string]: any }> =
[key in keyof T]: {
value: string | string[];
operator?: "AND" | "OR";
equality?: "EQUAL" | "LIKE";
equality?: "EQUAL" | "LIKE" | "NOT EQUAL";
tableName?: string;
};
};