diff --git a/src/compositions/member/composition.rs b/src/compositions/member/composition.rs index 562d1c3..83bc0fc 100644 --- a/src/compositions/member/composition.rs +++ b/src/compositions/member/composition.rs @@ -78,7 +78,7 @@ impl Composition { ml.deleted_at as ml_deleted_at, _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_level_id as _m_member_level_id, _m.username as _m_username, @@ -176,7 +176,7 @@ impl Composition { ml.deleted_at as ml_deleted_at, _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_level_id as _m_member_level_id, _m.username as _m_username, @@ -194,13 +194,13 @@ impl Composition { _m.deleted_at as _m_deleted_at FROM members as m - JOIN sites s + INNER JOIN sites s ON s.id = m.site_id - JOIN member_classes mc + INNER JOIN member_classes mc ON mc.id = m.member_class_id - JOIN member_levels ml + INNER JOIN member_levels ml ON ml.id = m.member_level_id - JOIN members _m + LEFT OUTER JOIN members _m ON _m.id = m.referrer_member_id " ) @@ -286,10 +286,12 @@ impl Composition { } 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()))?; } + println!("query: {}", query); + match sql_query(query).get_results::(conn) { Ok(m) => Ok(m), Err(e) => match e {