package com.gic.haoban.manage.service.dao.mapper.chat;

import java.util.Date;
import java.util.List;

import com.gic.haoban.manage.service.pojo.bo.chat.GroupChatHmMemberRelationBO;
import com.gic.haoban.manage.service.pojo.bo.chat.UserQuitBO;
import com.gic.haoban.manage.service.pojo.qo.chat.GroupChatUserQO;
import org.apache.ibatis.annotations.Param;

import com.gic.haoban.manage.api.dto.chat.GroupChatUserDTO;
import com.gic.haoban.manage.api.dto.qdto.chat.GroupChatUserSearchQDTO;
import com.gic.haoban.manage.service.entity.chat.TabGroupChatUser;

/**
 * 
 * @ClassName: TabHaobanGroupChatUserMapper
 * @Description: TODO
 * @Author 徐高华
 * @Date 2022年11月25日 15:42:52
 * @Modify
 * @CopyRight 
 */
public interface GroupChatUserMapper {

    public int insert(TabGroupChatUser tabHaobanGroupChatUser);

    public int batchInsert(@Param("list")List<TabGroupChatUser> userList);

    public int dismiss(@Param("idList") List<Long> chatUserIdList, @Param("ownerId") String ownerId , @Param("quitStaffStore")String quitStaffStore);

    public int update(TabGroupChatUser tabHaobanGroupChatUser);

    public TabGroupChatUser selectById(Long chatUserId);

    public TabGroupChatUser getGroupUserInfo(@Param("groupChatId") Long groupChatId , @Param("userId") String externalUserId) ;

    public TabGroupChatUser selectByUserIdAndChatId(@Param("groupChatId") Long groupChatId,
            @Param("userId") String userId);

    public List<TabGroupChatUser> listAllChatUser(@Param("wxEnterpriseId") String wxEnterpriseId,
            @Param("groupChatId") Long groupChatId);

    public List<GroupChatUserDTO> listPage(GroupChatUserSearchQDTO qdto);

    /**
     * 
    * @Title: listByExternalUseridForMatch
    * @Description: 通过外部联系人查询需要匹配gic会员的列表
    * @author xugh
    * @param wxEnterpriseId
    * @param enterpriseId
    * @param externalUserid
    * @return
    * @throws
     */
    public List<TabGroupChatUser> listByExternalUseridForMatch(@Param("wxEnterpriseId") String wxEnterpriseId,
            @Param("enterpriseId") String enterpriseId, @Param("externalUserid") String externalUserid);

    public void updateToGicMember(@Param("wxEnterpriseId") String wxEnterpriseId,
            @Param("enterpriseId") String enterpriseId, @Param("externalUserid") String externalUserid,
            @Param("memberId") String memberId);

    /**
     * 查询群组成员列表
     * @param groupChatUserQO
     * @return
     */
    List<TabGroupChatUser> queryGroupChatUserList(GroupChatUserQO groupChatUserQO);

    /**
     * 退群统计
     * @param wxEnterpriseId
     * @param start
     * @param end
     * @return
     */
    List<UserQuitBO> listQuitNum(@Param("wxEnterpriseId") String wxEnterpriseId ,@Param("start") Date start ,@Param("end") Date end) ;

    List<TabGroupChatUser> getByMember(@Param("enterpriseId")String enterpriseId, @Param("memberId")String memberId);

    /**
     * 会员加入的社群对应的群活码id
     * @param chatHmIds
     * @param enterpriseId
     * @param memberId
     * @return
     */
    List<GroupChatHmMemberRelationBO> listMemberChatHmIdByChatHmIdsAndMemberId(@Param("chatHmIds")List<Long> chatHmIds, @Param("enterpriseId")String enterpriseId, @Param("memberId")String memberId);
}