package com.wzj.soopin.content.mapper;

import com.wzj.soopin.content.domain.po.UserMember;
import com.wzj.soopin.content.domain.po.Users;
import com.wzj.soopin.content.domain.vo.UsersVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
import org.dromara.system.domain.SysTenant;

/**
 * 短视频用户与商城会员数据处理层
 */
@Mapper
public interface UserMemberMapper extends BaseMapperPlus<UserMember, UserMember> {

	Users getUserByMemberId(String memberId);

    @Select("SELECT    " +
        "    st.*     " +
        "FROM    " +
        "    ums_member um1    " +
        "    LEFT JOIN ums_member um2 ON um1.spread_uid = um2.id    " +
        "    LEFT JOIN sys_user su ON um2.user_id = su.user_id    " +
        "    LEFT JOIN sys_tenant st ON su.tenant_id = st.tenant_id     " +
        "WHERE    " +
        "    um1.id = #{memberId}")
    SysTenant getReferenceTenantByMemberId(Long memberId);
}
