bug fixed

This commit is contained in:
병준 박 2022-08-11 05:34:20 +00:00
parent 5515841d49
commit 1ed800e196

View File

@ -78,7 +78,7 @@ impl Composition {
ml.deleted_at as ml_deleted_at, ml.deleted_at as ml_deleted_at,
_m.id as _m_id, _m.id as _m_id,
_m.member_site_id as _m_member_site_id, _m.site_id as _m_site_id,
_m.member_class_id as _m_member_class_id, _m.member_class_id as _m_member_class_id,
_m.member_level_id as _m_member_level_id, _m.member_level_id as _m_member_level_id,
_m.username as _m_username, _m.username as _m_username,
@ -176,7 +176,7 @@ impl Composition {
ml.deleted_at as ml_deleted_at, ml.deleted_at as ml_deleted_at,
_m.id as _m_id, _m.id as _m_id,
_m.member_site_id as _m_member_site_id, _m.site_id as _m_site_id,
_m.member_class_id as _m_member_class_id, _m.member_class_id as _m_member_class_id,
_m.member_level_id as _m_member_level_id, _m.member_level_id as _m_member_level_id,
_m.username as _m_username, _m.username as _m_username,
@ -194,13 +194,13 @@ impl Composition {
_m.deleted_at as _m_deleted_at _m.deleted_at as _m_deleted_at
FROM members as m FROM members as m
JOIN sites s INNER JOIN sites s
ON s.id = m.site_id ON s.id = m.site_id
JOIN member_classes mc INNER JOIN member_classes mc
ON mc.id = m.member_class_id ON mc.id = m.member_class_id
JOIN member_levels ml INNER JOIN member_levels ml
ON ml.id = m.member_level_id ON ml.id = m.member_level_id
JOIN members _m LEFT OUTER JOIN members _m
ON _m.id = m.referrer_member_id ON _m.id = m.referrer_member_id
" "
) )
@ -286,10 +286,12 @@ impl Composition {
} }
if !query_where.is_empty() { if !query_where.is_empty() {
write!(&mut query, "{}", query_where) write!(&mut query, " where {}", query_where)
.map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?; .map_err(|e| diesel::result::Error::QueryBuilderError(e.to_string().into()))?;
} }
println!("query: {}", query);
match sql_query(query).get_results::<models::MemberModel>(conn) { match sql_query(query).get_results::<models::MemberModel>(conn) {
Ok(m) => Ok(m), Ok(m) => Ok(m),
Err(e) => match e { Err(e) => match e {