package com.fs.fastGpt;

import com.fs.common.annotation.Log;
import com.fs.common.core.controller.BaseController;
import com.fs.common.core.domain.AjaxResult;
import com.fs.common.core.page.TableDataInfo;
import com.fs.common.enums.BusinessType;
import com.fs.common.utils.poi.ExcelUtil;
import com.fs.fastGpt.domain.FastgptChatArtificialWords;
import com.fs.fastGpt.service.IFastgptChatArtificialWordsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 转人工提示词Controller
 * 
 * @author fs
 * @date 2025-05-07
 */
@RestController
@RequestMapping("/fastGpt/fastgptChatArtificialWords")
public class FastgptChatArtificialWordsController extends BaseController
{
    @Autowired
    private IFastgptChatArtificialWordsService fastgptChatArtificialWordsService;

    /**
     * 查询转人工提示词列表
     */
    @PreAuthorize("@ss.hasPermi('fastGpt:fastgptChatArtificialWords:list')")
    @GetMapping("/list")
    public TableDataInfo list(FastgptChatArtificialWords fastgptChatArtificialWords)
    {
        startPage();
        List<FastgptChatArtificialWords> list = fastgptChatArtificialWordsService.selectFastgptChatArtificialWordsList(fastgptChatArtificialWords);
        return getDataTable(list);
    }

    /**
     * 导出转人工提示词列表
     */
    @PreAuthorize("@ss.hasPermi('fastGpt:fastgptChatArtificialWords:export')")
    @Log(title = "转人工提示词", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(FastgptChatArtificialWords fastgptChatArtificialWords)
    {
        List<FastgptChatArtificialWords> list = fastgptChatArtificialWordsService.selectFastgptChatArtificialWordsList(fastgptChatArtificialWords);
        ExcelUtil<FastgptChatArtificialWords> util = new ExcelUtil<FastgptChatArtificialWords>(FastgptChatArtificialWords.class);
        return util.exportExcel(list, "转人工提示词数据");
    }

    /**
     * 获取转人工提示词详细信息
     */
    @PreAuthorize("@ss.hasPermi('fastGpt:fastgptChatArtificialWords:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(fastgptChatArtificialWordsService.selectFastgptChatArtificialWordsById(id));
    }

    /**
     * 新增转人工提示词
     */
    @PreAuthorize("@ss.hasPermi('fastGpt:fastgptChatArtificialWords:add')")
    @Log(title = "转人工提示词", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody FastgptChatArtificialWords fastgptChatArtificialWords)
    {
        return toAjax(fastgptChatArtificialWordsService.insertFastgptChatArtificialWords(fastgptChatArtificialWords));
    }

    /**
     * 修改转人工提示词
     */
    @PreAuthorize("@ss.hasPermi('fastGpt:fastgptChatArtificialWords:edit')")
    @Log(title = "转人工提示词", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody FastgptChatArtificialWords fastgptChatArtificialWords)
    {
        return toAjax(fastgptChatArtificialWordsService.updateFastgptChatArtificialWords(fastgptChatArtificialWords));
    }

    /**
     * 删除转人工提示词
     */
    @PreAuthorize("@ss.hasPermi('fastGpt:fastgptChatArtificialWords:remove')")
    @Log(title = "转人工提示词", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(fastgptChatArtificialWordsService.deleteFastgptChatArtificialWordsByIds(ids));
    }
}
