package com.fs.chat.service.impl;

import com.fs.chat.domain.ChatKeyword;
import com.fs.chat.mapper.ChatKeywordMapper;
import com.fs.chat.service.IChatKeywordService;
import com.fs.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 关键字Service业务层处理
 *
 * @author fs
 * @date 2024-04-19
 */
@Service
public class ChatKeywordServiceImpl implements IChatKeywordService
{
    @Autowired
    private ChatKeywordMapper chatKeywordMapper;

    /**
     * 查询关键字
     *
     * @param keywordId 关键字主键
     * @return 关键字
     */
    @Override
    public ChatKeyword selectChatKeywordByKeywordId(Long keywordId)
    {
        return chatKeywordMapper.selectChatKeywordByKeywordId(keywordId);
    }

    /**
     * 查询关键字列表
     *
     * @param chatKeyword 关键字
     * @return 关键字
     */
    @Override
    public List<ChatKeyword> selectChatKeywordList(ChatKeyword chatKeyword)
    {
        return chatKeywordMapper.selectChatKeywordList(chatKeyword);
    }

    /**
     * 新增关键字
     *
     * @param chatKeyword 关键字
     * @return 结果
     */
    @Override
    public int insertChatKeyword(ChatKeyword chatKeyword)
    {
        chatKeyword.setCreateTime(DateUtils.getNowDate());
        return chatKeywordMapper.insertChatKeyword(chatKeyword);
    }

    /**
     * 修改关键字
     *
     * @param chatKeyword 关键字
     * @return 结果
     */
    @Override
    public int updateChatKeyword(ChatKeyword chatKeyword)
    {
        chatKeyword.setUpdateTime(DateUtils.getNowDate());
        return chatKeywordMapper.updateChatKeyword(chatKeyword);
    }

    /**
     * 批量删除关键字
     *
     * @param keywordIds 需要删除的关键字主键
     * @return 结果
     */
    @Override
    public int deleteChatKeywordByKeywordIds(Long[] keywordIds)
    {
        return chatKeywordMapper.deleteChatKeywordByKeywordIds(keywordIds);
    }

    /**
     * 删除关键字信息
     *
     * @param keywordId 关键字主键
     * @return 结果
     */
    @Override
    public int deleteChatKeywordByKeywordId(Long keywordId)
    {
        return chatKeywordMapper.deleteChatKeywordByKeywordId(keywordId);
    }

    @Override
    public ChatKeyword selectChatKeywordByKeyword(Long companyId, String content) {
        return chatKeywordMapper.selectChatKeywordByKeyword(companyId,content);
    }
}
