package com.ruoyi.system.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.system.domain.CommunityChatMsg;
import com.ruoyi.system.domain.vo.SysUserVo;
import com.ruoyi.system.mapper.CommunityChatMsgMapper;
import com.ruoyi.system.service.ICommunityChatMsgService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class CommunityChatMsgServiceImpl extends ServiceImpl<CommunityChatMsgMapper, CommunityChatMsg> implements ICommunityChatMsgService {

    @Resource
    private CommunityChatMsgMapper communityChatMsgMapper;

    /**
     * 获取登录用户的聊天列表
     *
     * @param userId 用户id
     * @return 用户聊天列表
     */
    @Override
    public List<SysUserVo> getChatListWithLatestMessage(Long userId, String type) {
        return communityChatMsgMapper.getChatListWithLatestMessage(userId, type);
    }
}
