multiple id search is added

This commit is contained in:
병준 박 2022-09-01 03:46:02 +00:00
parent 67ee99ab60
commit 33b4baccf5
5 changed files with 50 additions and 8 deletions

View File

@ -36,7 +36,7 @@ tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
tokio-cron-scheduler = { version = "0" }
uuid = { version = "0", features = ["serde", "v4", "v5"] }
beteran-protobuf-rust = { git = "https://gitlab.loafle.net/bet/beteran-protobuf-rust.git", tag = "v0.1.87-snapshot" }
beteran-common-rust = { git = "https://gitlab.loafle.net/bet/beteran-common-rust.git", tag = "v0.1.73-snapshot" }
beteran-protobuf-rust = { git = "https://gitlab.loafle.net/bet/beteran-protobuf-rust.git", tag = "v0.1.89-snapshot" }
beteran-common-rust = { git = "https://gitlab.loafle.net/bet/beteran-common-rust.git", tag = "v0.1.75-snapshot" }
[build-dependencies]

View File

@ -222,6 +222,22 @@ impl Composition {
write!(&mut query_where, "akbh.vendor_id = {}", sp)
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
}
if !s.vendor_ids.is_empty() {
if !query_where.is_empty() {
write!(&mut query_where, " AND ")
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
}
write!(
&mut query_where,
"akbh.vendor_id IN ({})",
s.vendor_ids
.iter()
.map(|v| v.to_string())
.collect::<Vec<String>>()
.join(",")
)
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
}
if let Some(sp) = &s.vendor_name {
if !query_where.is_empty() {
@ -248,6 +264,22 @@ impl Composition {
write!(&mut query_where, "akbh.game_id = {}", sp)
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
}
if !s.game_ids.is_empty() {
if !query_where.is_empty() {
write!(&mut query_where, " AND ")
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
}
write!(
&mut query_where,
"akbh.game_id IN ({})",
s.game_ids
.iter()
.map(|v| v.to_string())
.collect::<Vec<String>>()
.join(",")
)
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
}
if let Some(sp) = &s.game_name {
if !query_where.is_empty() {

View File

@ -108,12 +108,16 @@ pub struct FindAllSearch {
///
pub vendor_id: Option<i64>,
///
pub vendor_ids: Vec<i64>,
///
pub vendor_name: Option<String>,
///
pub vendor_name_like: Option<String>,
///
pub game_id: Option<i64>,
///
pub game_ids: Vec<i64>,
///
pub game_name: Option<String>,
///
pub game_name_like: Option<String>,

View File

@ -5,6 +5,15 @@ impl From<&compositions::betting::models::BettingHistoryModel>
for bpr::models::api::betting::BettingHistoryModel
{
fn from(d: &compositions::betting::models::BettingHistoryModel) -> Self {
let member = Some(bpr::models::api::betting::betting_history_model::Member {
site_id: d.m_site_id.to_string(),
member_class_id: d.m_member_class_id.to_string(),
member_level_id: d.m_member_level_id.to_string(),
parent_member_id: d.m_parent_member_id.map(|v| v.to_string()),
nickname: d.m_nickname.clone(),
mobile_phone_number: d.m_mobile_phone_number.clone(),
});
bpr::models::api::betting::BettingHistoryModel {
id: d.id.clone(),
vendor_id: d.vendor_id as u64,
@ -29,12 +38,7 @@ impl From<&compositions::betting::models::BettingHistoryModel>
category: d.category.clone(),
created_at: d.created_at as u64,
utc_created_at: d.utc_created_at as u64,
m_site_id: d.m_site_id.to_string(),
m_member_class_id: d.m_member_class_id.to_string(),
m_member_level_id: d.m_member_level_id.to_string(),
m_parent_member_id: d.m_parent_member_id.map(|v| v.to_string()),
m_nickname: d.m_nickname.clone(),
m_mobile_phone_number: d.m_mobile_phone_number.clone(),
member,
}
}
}

View File

@ -112,9 +112,11 @@ impl Service {
Some(s) => Some(compositions::betting::models::FindAllSearch {
member_id: s.member_id,
vendor_id: s.vendor_id.map(|v| v as i64),
vendor_ids: s.vendor_ids.iter().map(|v| *v as i64).collect(),
vendor_name: s.vendor_name,
vendor_name_like: s.vendor_name_like,
game_id: s.game_id.map(|v| v as i64),
game_ids: s.game_ids.iter().map(|v| *v as i64).collect(),
game_name: s.game_name,
game_name_like: s.game_name_like,
game_category: s.game_category,