package com.fs.fastGpt;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.fs.common.annotation.Log;
import com.fs.common.core.controller.BaseController;
import com.fs.common.core.domain.AjaxResult;
import com.fs.common.enums.BusinessType;
import com.fs.fastGpt.domain.FastGptChatReplaceWords;
import com.fs.fastGpt.service.IFastGptChatReplaceWordsService;
import com.fs.common.utils.poi.ExcelUtil;
import com.fs.common.core.page.TableDataInfo;

/**
 * 违规词语Controller
 *
 * @author fs
 * @date 2025-01-18
 */
@RestController
@RequestMapping("/fastGpt/fastGptChatReplaceWords")
public class FastGptChatReplaceWordsController extends BaseController
{
    @Autowired
    private IFastGptChatReplaceWordsService fastGptChatReplaceWordsService;

    /**
     * 查询违规词语列表
     */
    @PreAuthorize("@ss.hasPermi('fastGpt:fastGptChatReplaceWords:list')")
    @GetMapping("/list")
    public TableDataInfo list(FastGptChatReplaceWords fastGptChatReplaceWords)
    {
        startPage();
        List<FastGptChatReplaceWords> list = fastGptChatReplaceWordsService.selectFastGptChatReplaceWordsList(fastGptChatReplaceWords);
        return getDataTable(list);
    }

    /**
     * 导出违规词语列表
     */
    @PreAuthorize("@ss.hasPermi('fastGpt:fastGptChatReplaceWords:export')")
    @Log(title = "违规词语", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(FastGptChatReplaceWords fastGptChatReplaceWords)
    {
        List<FastGptChatReplaceWords> list = fastGptChatReplaceWordsService.selectFastGptChatReplaceWordsList(fastGptChatReplaceWords);
        ExcelUtil<FastGptChatReplaceWords> util = new ExcelUtil<FastGptChatReplaceWords>(FastGptChatReplaceWords.class);
        return util.exportExcel(list, "违规词语数据");
    }

    /**
     * 获取违规词语详细信息
     */
    @PreAuthorize("@ss.hasPermi('fastGpt:fastGptChatReplaceWords:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(fastGptChatReplaceWordsService.selectFastGptChatReplaceWordsById(id));
    }

    /**
     * 新增违规词语
     */
    @PreAuthorize("@ss.hasPermi('fastGpt:fastGptChatReplaceWords:add')")
    @Log(title = "违规词语", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody FastGptChatReplaceWords fastGptChatReplaceWords)
    {
        return toAjax(fastGptChatReplaceWordsService.insertFastGptChatReplaceWords(fastGptChatReplaceWords));
    }

    /**
     * 修改违规词语
     */
    @PreAuthorize("@ss.hasPermi('fastGpt:fastGptChatReplaceWords:edit')")
    @Log(title = "违规词语", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody FastGptChatReplaceWords fastGptChatReplaceWords)
    {
        return toAjax(fastGptChatReplaceWordsService.updateFastGptChatReplaceWords(fastGptChatReplaceWords));
    }

    /**
     * 删除违规词语
     */
    @PreAuthorize("@ss.hasPermi('fastGpt:fastGptChatReplaceWords:remove')")
    @Log(title = "违规词语", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(fastGptChatReplaceWordsService.deleteFastGptChatReplaceWordsByIds(ids));
    }
}
