package org.dromara.im.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
import org.dromara.im.domain.ImGroupMember;
import org.dromara.im.domain.vo.ImGroupMemberVo;

/**
 * 群成员Mapper接口
 *
 * @author Blue
 * @date 2024-12-22
 */
@Mapper
public interface ImGroupMemberMapper extends BaseMapperPlus<ImGroupMember, ImGroupMemberVo> {

    /**
     * 检查用户是否在群内
     *
     * @param userId 用户id
     * @param groupId 群聊id
     * @return
     */
    @Select("select count(*) from im_group_member where user_id = #{userId} and group_id = #{groupId}")
    int checkInGroup(Long userId, Long groupId);
}
