From 92007eca6b92cce791c5b87efdc345da3e05ebd0 Mon Sep 17 00:00:00 2001 From: ljl <17743125563@163.com> Date: Tue, 17 Oct 2023 07:02:38 +0800 Subject: [PATCH] basic: fix BasicQueryOpKind. --- basic/src/basic_enumeration.rs | 8 ++++---- basic/src/dto.rs | 4 ++-- spi/spi-search/src/serv/es/search_es_item_serv.rs | 4 ++-- spi/spi-search/src/serv/pg/search_pg_item_serv.rs | 12 ++++++------ 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/basic/src/basic_enumeration.rs b/basic/src/basic_enumeration.rs index 8f6de704c..ad03ae64c 100644 --- a/basic/src/basic_enumeration.rs +++ b/basic/src/basic_enumeration.rs @@ -44,9 +44,9 @@ pub enum BasicQueryOpKind { #[oai(rename = "not_in")] NotIn, #[oai(rename = "is_null")] - IsNUll, + IsNull, #[oai(rename = "is_not_null")] - IsNotNUll, + IsNotNull, #[oai(rename = "is_not_null_or_empty")] IsNullOrEmpty, } @@ -64,8 +64,8 @@ impl BasicQueryOpKind { BasicQueryOpKind::NotLike => "NOT LIKE".to_string(), BasicQueryOpKind::In => "IN".to_string(), BasicQueryOpKind::NotIn => "NOT IN".to_string(), - BasicQueryOpKind::IsNUll => "IS NULL".to_string(), - BasicQueryOpKind::IsNotNUll => "IS NOT NULL".to_string(), + BasicQueryOpKind::IsNull => "IS NULL".to_string(), + BasicQueryOpKind::IsNotNull => "IS NOT NULL".to_string(), BasicQueryOpKind::IsNullOrEmpty => "IS NULL".to_string(), } } diff --git a/basic/src/dto.rs b/basic/src/dto.rs index fd743e8cd..4f7758642 100644 --- a/basic/src/dto.rs +++ b/basic/src/dto.rs @@ -76,8 +76,8 @@ impl BasicQueryCondInfo { } BasicQueryOpKind::In => check_val.as_array().map(|check_val_arr| check_val_arr.contains(&cond.value)).unwrap_or(false), BasicQueryOpKind::NotIn => check_val.as_array().map(|check_val_arr| check_val_arr.contains(&cond.value)).unwrap_or(false), - BasicQueryOpKind::IsNUll => false, - BasicQueryOpKind::IsNotNUll => false, + BasicQueryOpKind::IsNull => false, + BasicQueryOpKind::IsNotNull => false, BasicQueryOpKind::IsNullOrEmpty => false, }, None => false, diff --git a/spi/spi-search/src/serv/es/search_es_item_serv.rs b/spi/spi-search/src/serv/es/search_es_item_serv.rs index 06ff31604..8348c8536 100644 --- a/spi/spi-search/src/serv/es/search_es_item_serv.rs +++ b/spi/spi-search/src/serv/es/search_es_item_serv.rs @@ -586,8 +586,8 @@ fn gen_query_dsl(search_req: &SearchItemSearchReq) -> TardisResult { } BasicQueryOpKind::NotLike => {} BasicQueryOpKind::NotIn => {} - BasicQueryOpKind::IsNUll => {} - BasicQueryOpKind::IsNotNUll => {} + BasicQueryOpKind::IsNull => {} + BasicQueryOpKind::IsNotNull => {} BasicQueryOpKind::IsNullOrEmpty => {} } } diff --git a/spi/spi-search/src/serv/pg/search_pg_item_serv.rs b/spi/spi-search/src/serv/pg/search_pg_item_serv.rs index cbb9ca8f8..c37844e2b 100644 --- a/spi/spi-search/src/serv/pg/search_pg_item_serv.rs +++ b/spi/spi-search/src/serv/pg/search_pg_item_serv.rs @@ -315,9 +315,9 @@ pub async fn search(search_req: &mut SearchItemSearchReq, funs: &TardisFunsInst, for val in value { sql_vals.push(val); } - } else if ext_item.op == BasicQueryOpKind::IsNUll { + } else if ext_item.op == BasicQueryOpKind::IsNull { where_fragments.push(format!("ext ->> '{}' is null", ext_item.field)); - } else if ext_item.op == BasicQueryOpKind::IsNotNUll { + } else if ext_item.op == BasicQueryOpKind::IsNotNull { where_fragments.push(format!("ext ->> '{}' is not null", ext_item.field)); } else if ext_item.op == BasicQueryOpKind::IsNullOrEmpty { where_fragments.push(format!("(ext ->> '{}' is null or ext ->> '{}' = '')", ext_item.field, ext_item.field)); @@ -427,9 +427,9 @@ pub async fn search(search_req: &mut SearchItemSearchReq, funs: &TardisFunsInst, for val in value { sql_vals.push(val); } - } else if ext_item.op == BasicQueryOpKind::IsNUll { + } else if ext_item.op == BasicQueryOpKind::IsNull { where_fragments.push(format!("ext ->> '{}' is null", ext_item.field)); - } else if ext_item.op == BasicQueryOpKind::IsNotNUll { + } else if ext_item.op == BasicQueryOpKind::IsNotNull { where_fragments.push(format!("ext ->> '{}' is not null", ext_item.field)); } else if ext_item.op == BasicQueryOpKind::IsNullOrEmpty { where_fragments.push(format!("(ext ->> '{}' is null or ext ->> '{}' = '')", ext_item.field, ext_item.field)); @@ -498,9 +498,9 @@ pub async fn search(search_req: &mut SearchItemSearchReq, funs: &TardisFunsInst, sql_vals.push(Value::from(format!("{val}%"))); } } - } else if ext_item.op == BasicQueryOpKind::IsNUll { + } else if ext_item.op == BasicQueryOpKind::IsNull { sql_and_where.push(format!("{} is null", ext_item.field)); - } else if ext_item.op == BasicQueryOpKind::IsNotNUll { + } else if ext_item.op == BasicQueryOpKind::IsNotNull { sql_and_where.push(format!("{} is not null", ext_item.field)); } else if ext_item.op == BasicQueryOpKind::IsNullOrEmpty { sql_and_where.push(format!("({} is null or {} = '')", ext_item.field, ext_item.field));