package com.mcwl.communityCenter.mapper;

import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mcwl.communityCenter.domain.Community;
import com.mcwl.communityCenter.domain.CommunityUser;
import com.mcwl.communityCenter.domain.dto.CommunityUserListPageRes;
import com.mcwl.communityCenter.domain.dto.UnBlackListRes;
import com.mcwl.communityCenter.domain.vo.CommunityUserVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;
import java.util.Map;

@Mapper
public interface CommunityUserMapper extends BaseMapper<CommunityUser> {

    @InterceptorIgnore(tenantLine = "true")
    CommunityUser selectByTenantIdAndCommunityIdAndUserId(@Param("tenantId") Long tenantId,
                                                          @Param("communityId") Long communityId,
                                                          @Param("userId") Long userId);

    @InterceptorIgnore(tenantLine = "true")
    Integer getJoinNum(@Param("tenantId") Long tenantId, @Param("communityId") Long communityId);

    @InterceptorIgnore(tenantLine = "true")
    int isJoinCommunity(@Param("tenantId")
                        Long tenantId,
                        @Param("communityId")
                        Long communityId,
                        @Param("userId")
                        Long userId);

    @InterceptorIgnore(tenantLine = "true")
    List<CommunityUserVo> getCommunityUserList(Page<CommunityUser> page,
                                               @Param("communityUserListPageRes")
                                               CommunityUserListPageRes communityUserListPageRes);

    @InterceptorIgnore(tenantLine = "true")
    CommunityUser selectCommunityUser(@Param("tenantId") Long tenantId,
                                      @Param("communityId") Long communityId,
                                      @Param("userId") Long userId);

    @InterceptorIgnore(tenantLine = "true")
    void updateBlackCommunityUser(@Param("blackCommunityUser") CommunityUser blackCommunityUser);

    @InterceptorIgnore(tenantLine = "true")
    List<CommunityUser> getAllCommunityUser();

    void updateManageCommunityUser(@Param("manageCommunityUser") CommunityUser manageCommunityUser);

    @InterceptorIgnore(tenantLine = "true")
    Date getExpireTime(@Param("tenantId") Long tenantId,
                       @Param("communityId") Long communityId,
                       @Param("userId") Long userId);

    @InterceptorIgnore(tenantLine = "true")
    List<String> getCommunityUserAvatar(@Param("tenantId") Long tenantId, @Param("communityId") Long communityId);
}
