diff --git a/src/compositions/member/composition.rs b/src/compositions/member/composition.rs index 8b08e1a..4660897 100644 --- a/src/compositions/member/composition.rs +++ b/src/compositions/member/composition.rs @@ -34,76 +34,76 @@ impl Composition { match sql_query( " SELECT - m.id as m_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, - m.password as m_password, - m.nickname as m_nickname, - m.mobile_phone_number as m_mobile_phone_number, - m.state as m_state, - m.state_changed_at as m_state_changed_at, - m.referrer_member_id as m_referrer_member_id, - m.referred_count as m_referred_count, - m.last_signined_ip as m_last_signined_ip, - m.last_signined_at as m_last_signined_at, - m.created_at as m_created_at, - m.updated_at as m_updated_at, - m.deleted_at as m_deleted_at, + m.id as m_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, + m.password as m_password, + m.nickname as m_nickname, + m.mobile_phone_number as m_mobile_phone_number, + m.state as m_state, + m.state_changed_at as m_state_changed_at, + m.referrer_member_id as m_referrer_member_id, + m.referred_count as m_referred_count, + m.last_signined_ip as m_last_signined_ip, + m.last_signined_at as m_last_signined_at, + m.created_at as m_created_at, + m.updated_at as m_updated_at, + m.deleted_at as m_deleted_at, - s.id as s_id, - s.url as s_url, - s.name as s_name, - s.path as s_path, - s.show as s_show, - s.can_use as s_can_use, - s.memo as s_memo, - s.expires_at as s_expires_at, - s.created_at as s_created_at, - s.updated_at as s_updated_at, + s.id as s_id, + s.url as s_url, + s.name as s_name, + s.path as s_path, + s.show as s_show, + s.can_use as s_can_use, + s.memo as s_memo, + s.expires_at as s_expires_at, + s.created_at as s_created_at, + s.updated_at as s_updated_at, - mc.id as mc_id, - mc.parent_id as mc_parent_id, - mc.name as mc_name, - mc.created_at as mc_created_at, - mc.updated_at as mc_updated_at, - mc.deleted_at as mc_deleted_at, + mc.id as mc_id, + mc.parent_id as mc_parent_id, + mc.name as mc_name, + mc.created_at as mc_created_at, + mc.updated_at as mc_updated_at, + mc.deleted_at as mc_deleted_at, - ml.id as ml_id, - ml.name as ml_name, - ml.sort_order as ml_sort_order, - ml.created_at as ml_created_at, - ml.updated_at as ml_updated_at, - ml.deleted_at as ml_deleted_at, + ml.id as ml_id, + ml.name as ml_name, + ml.sort_order as ml_sort_order, + ml.created_at as ml_created_at, + ml.updated_at as ml_updated_at, + ml.deleted_at as ml_deleted_at, - _m.id as _m_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, - _m.password as _m_password, - _m.nickname as _m_nickname, - _m.mobile_phone_number as _m_mobile_phone_number, - _m.state as _m_state, - _m.state_changed_at as _m_state_changed_at, - _m.referrer_member_id as _m_referrer_member_id, - _m.referred_count as _m_referred_count, - _m.last_signined_ip as _m_last_signined_ip, - _m.last_signined_at as _m_last_signined_at, - _m.created_at as _m_created_at, - _m.updated_at as _m_updated_at, - _m.deleted_at as _m_deleted_at + _m.id as _m_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, + _m.password as _m_password, + _m.nickname as _m_nickname, + _m.mobile_phone_number as _m_mobile_phone_number, + _m.state as _m_state, + _m.state_changed_at as _m_state_changed_at, + _m.referrer_member_id as _m_referrer_member_id, + _m.referred_count as _m_referred_count, + _m.last_signined_ip as _m_last_signined_ip, + _m.last_signined_at as _m_last_signined_at, + _m.created_at as _m_created_at, + _m.updated_at as _m_updated_at, + _m.deleted_at as _m_deleted_at - FROM members as m - JOIN sites s - ON s.id = m.site_id - JOIN member_classes mc - ON mc.id = m.member_class_id - JOIN member_levels ml - ON ml.id = m.member_level_id - JOIN members _m - ON _m.id = m.referrer_member_id + FROM members as m + INNER JOIN sites s + ON s.id = m.site_id + INNER JOIN member_classes mc + ON mc.id = m.member_class_id + INNER JOIN member_levels ml + ON ml.id = m.member_level_id + LEFT OUTER JOIN members _m + ON _m.id = m.referrer_member_id WHERE m.id = $1 ", @@ -128,76 +128,76 @@ impl Composition { match sql_query( " SELECT - m.id as m_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, - m.password as m_password, - m.nickname as m_nickname, - m.mobile_phone_number as m_mobile_phone_number, - m.state as m_state, - m.state_changed_at as m_state_changed_at, - m.referrer_member_id as m_referrer_member_id, - m.referred_count as m_referred_count, - m.last_signined_ip as m_last_signined_ip, - m.last_signined_at as m_last_signined_at, - m.created_at as m_created_at, - m.updated_at as m_updated_at, - m.deleted_at as m_deleted_at, + m.id as m_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, + m.password as m_password, + m.nickname as m_nickname, + m.mobile_phone_number as m_mobile_phone_number, + m.state as m_state, + m.state_changed_at as m_state_changed_at, + m.referrer_member_id as m_referrer_member_id, + m.referred_count as m_referred_count, + m.last_signined_ip as m_last_signined_ip, + m.last_signined_at as m_last_signined_at, + m.created_at as m_created_at, + m.updated_at as m_updated_at, + m.deleted_at as m_deleted_at, - s.id as s_id, - s.url as s_url, - s.name as s_name, - s.path as s_path, - s.show as s_show, - s.can_use as s_can_use, - s.memo as s_memo, - s.expires_at as s_expires_at, - s.created_at as s_created_at, - s.updated_at as s_updated_at, + s.id as s_id, + s.url as s_url, + s.name as s_name, + s.path as s_path, + s.show as s_show, + s.can_use as s_can_use, + s.memo as s_memo, + s.expires_at as s_expires_at, + s.created_at as s_created_at, + s.updated_at as s_updated_at, - mc.id as mc_id, - mc.parent_id as mc_parent_id, - mc.name as mc_name, - mc.created_at as mc_created_at, - mc.updated_at as mc_updated_at, - mc.deleted_at as mc_deleted_at, + mc.id as mc_id, + mc.parent_id as mc_parent_id, + mc.name as mc_name, + mc.created_at as mc_created_at, + mc.updated_at as mc_updated_at, + mc.deleted_at as mc_deleted_at, - ml.id as ml_id, - ml.name as ml_name, - ml.sort_order as ml_sort_order, - ml.created_at as ml_created_at, - ml.updated_at as ml_updated_at, - ml.deleted_at as ml_deleted_at, + ml.id as ml_id, + ml.name as ml_name, + ml.sort_order as ml_sort_order, + ml.created_at as ml_created_at, + ml.updated_at as ml_updated_at, + ml.deleted_at as ml_deleted_at, - _m.id as _m_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, - _m.password as _m_password, - _m.nickname as _m_nickname, - _m.mobile_phone_number as _m_mobile_phone_number, - _m.state as _m_state, - _m.state_changed_at as _m_state_changed_at, - _m.referrer_member_id as _m_referrer_member_id, - _m.referred_count as _m_referred_count, - _m.last_signined_ip as _m_last_signined_ip, - _m.last_signined_at as _m_last_signined_at, - _m.created_at as _m_created_at, - _m.updated_at as _m_updated_at, - _m.deleted_at as _m_deleted_at + _m.id as _m_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, + _m.password as _m_password, + _m.nickname as _m_nickname, + _m.mobile_phone_number as _m_mobile_phone_number, + _m.state as _m_state, + _m.state_changed_at as _m_state_changed_at, + _m.referrer_member_id as _m_referrer_member_id, + _m.referred_count as _m_referred_count, + _m.last_signined_ip as _m_last_signined_ip, + _m.last_signined_at as _m_last_signined_at, + _m.created_at as _m_created_at, + _m.updated_at as _m_updated_at, + _m.deleted_at as _m_deleted_at - FROM members as m - JOIN sites s - ON s.id = m.site_id - JOIN member_classes mc - ON mc.id = m.member_class_id - JOIN member_levels ml - ON ml.id = m.member_level_id - JOIN members _m - ON _m.id = m.referrer_member_id + FROM members as m + INNER JOIN sites s + ON s.id = m.site_id + INNER JOIN member_classes mc + ON mc.id = m.member_class_id + INNER JOIN member_levels ml + ON ml.id = m.member_level_id + LEFT OUTER JOIN members _m + ON _m.id = m.referrer_member_id WHERE m.username = $1 ",