package com.ruoyi.system.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.ChatHistoryMapper;
import com.ruoyi.system.domain.ChatHistory;
import com.ruoyi.system.service.IChatHistoryService;

/**
 * 聊天记录Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-01-01
 */
@Service
public class ChatHistoryServiceImpl implements IChatHistoryService 
{
    @Autowired
    private ChatHistoryMapper chatHistoryMapper;

    /**
     * 查询聊天记录
     * 
     * @param id 聊天记录主键
     * @return 聊天记录
     */
    @Override
    public ChatHistory selectChatHistoryById(Long id)
    {
        return chatHistoryMapper.selectChatHistoryById(id);
    }

    /**
     * 查询聊天记录列表
     * 
     * @param chatHistory 聊天记录
     * @return 聊天记录
     */
    @Override
    public List<ChatHistory> selectChatHistoryList(ChatHistory chatHistory)
    {
        return chatHistoryMapper.selectChatHistoryList(chatHistory);
    }

    /**
     * 根据会话ID查询聊天记录
     * 
     * @param sessionId 会话ID
     * @return 聊天记录集合
     */
    @Override
    public List<ChatHistory> selectChatHistoryBySessionId(String sessionId)
    {
        return chatHistoryMapper.selectChatHistoryBySessionId(sessionId);
    }

    /**
     * 根据用户ID查询聊天记录
     * 
     * @param userId 用户ID
     * @return 聊天记录集合
     */
    @Override
    public List<ChatHistory> selectChatHistoryByUserId(String userId)
    {
        return chatHistoryMapper.selectChatHistoryByUserId(userId);
    }

    /**
     * 新增聊天记录
     * 
     * @param chatHistory 聊天记录
     * @return 结果
     */
    @Override
    public int insertChatHistory(ChatHistory chatHistory)
    {
        return chatHistoryMapper.insertChatHistory(chatHistory);
    }

    /**
     * 批量新增聊天记录
     * 
     * @param chatHistoryList 聊天记录列表
     * @return 结果
     */
    @Override
    public int batchInsertChatHistory(List<ChatHistory> chatHistoryList)
    {
        return chatHistoryMapper.batchInsertChatHistory(chatHistoryList);
    }

    /**
     * 修改聊天记录
     * 
     * @param chatHistory 聊天记录
     * @return 结果
     */
    @Override
    public int updateChatHistory(ChatHistory chatHistory)
    {
        return chatHistoryMapper.updateChatHistory(chatHistory);
    }

    /**
     * 批量删除聊天记录
     * 
     * @param ids 需要删除的聊天记录主键
     * @return 结果
     */
    @Override
    public int deleteChatHistoryByIds(Long[] ids)
    {
        return chatHistoryMapper.deleteChatHistoryByIds(ids);
    }

    /**
     * 删除聊天记录信息
     * 
     * @param id 聊天记录主键
     * @return 结果
     */
    @Override
    public int deleteChatHistoryById(Long id)
    {
        return chatHistoryMapper.deleteChatHistoryById(id);
    }

    /**
     * 删除指定会话的聊天记录
     * 
     * @param sessionId 会话ID
     * @return 结果
     */
    @Override
    public int deleteChatHistoryBySessionId(String sessionId)
    {
        return chatHistoryMapper.deleteChatHistoryBySessionId(sessionId);
    }

    /**
     * 删除指定用户的聊天记录
     * 
     * @param userId 用户ID
     * @return 结果
     */
    @Override
    public int deleteChatHistoryByUserId(String userId)
    {
        return chatHistoryMapper.deleteChatHistoryByUserId(userId);
    }
} 