package com.fs.fastGpt.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fs.common.exception.CustomException;
import com.fs.common.utils.DateUtils;
import com.fs.fastGpt.domain.FastgptChatArtificialWords;
import com.fs.fastGpt.mapper.FastgptChatArtificialWordsMapper;
import com.fs.fastGpt.service.IFastgptChatArtificialWordsService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 转人工提示词Service业务层处理
 * 
 * @author fs
 * @date 2025-05-07
 */
@Service
public class FastgptChatArtificialWordsServiceImpl extends ServiceImpl<FastgptChatArtificialWordsMapper, FastgptChatArtificialWords> implements IFastgptChatArtificialWordsService {

    /**
     * 查询转人工提示词
     * 
     * @param id 转人工提示词主键
     * @return 转人工提示词
     */
    @Override
    public FastgptChatArtificialWords selectFastgptChatArtificialWordsById(Long id)
    {
        return baseMapper.selectFastgptChatArtificialWordsById(id);
    }

    /**
     * 查询转人工提示词列表
     * 
     * @param fastgptChatArtificialWords 转人工提示词
     * @return 转人工提示词
     */
    @Override
    public List<FastgptChatArtificialWords> selectFastgptChatArtificialWordsList(FastgptChatArtificialWords fastgptChatArtificialWords)
    {
        return baseMapper.selectFastgptChatArtificialWordsList(fastgptChatArtificialWords);
    }

    /**
     * 新增转人工提示词
     * 
     * @param fastgptChatArtificialWords 转人工提示词
     * @return 结果
     */
    @Override
    public int insertFastgptChatArtificialWords(FastgptChatArtificialWords fastgptChatArtificialWords)
    {
        String content = fastgptChatArtificialWords.getContent();
        if(content == null || "".equals(content)){
            throw new CustomException("文本不能为空!");
        }
        Long type = fastgptChatArtificialWords.getType();
        if(type == null){
            throw new CustomException("类型不能为空!");
        }
        Long sort = fastgptChatArtificialWords.getSort();
        if(sort == null){
            throw new CustomException("排序不能为空!");
        }
        fastgptChatArtificialWords.setCreateTime(DateUtils.getNowDate());
        return baseMapper.insertFastgptChatArtificialWords(fastgptChatArtificialWords);
    }

    /**
     * 修改转人工提示词
     * 
     * @param fastgptChatArtificialWords 转人工提示词
     * @return 结果
     */
    @Override
    public int updateFastgptChatArtificialWords(FastgptChatArtificialWords fastgptChatArtificialWords)
    {
        return baseMapper.updateFastgptChatArtificialWords(fastgptChatArtificialWords);
    }

    /**
     * 批量删除转人工提示词
     * 
     * @param ids 需要删除的转人工提示词主键
     * @return 结果
     */
    @Override
    public int deleteFastgptChatArtificialWordsByIds(Long[] ids)
    {
        return baseMapper.deleteFastgptChatArtificialWordsByIds(ids);
    }

    /**
     * 删除转人工提示词信息
     * 
     * @param id 转人工提示词主键
     * @return 结果
     */
    @Override
    public int deleteFastgptChatArtificialWordsById(Long id)
    {
        return baseMapper.deleteFastgptChatArtificialWordsById(id);
    }
}
