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.FastgptTagGroup;
import com.fs.fastGpt.service.IFastgptTagGroupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * ai标签组Controller
 *
 * @author fs
 * @date 2024-12-20
 */
@RestController
@RequestMapping("/fastGpt/fastgptTagGroup")
public class FastgptTagGroupController extends BaseController
{
    @Autowired
    private IFastgptTagGroupService fastgptTagGroupService;

    /**
     * 查询ai标签组列表
     */
    @PreAuthorize("@ss.hasPermi('fastGpt:fastgptTagGroup:list')")
    @GetMapping("/list")
    public TableDataInfo list(FastgptTagGroup fastgptTagGroup)
    {
        startPage();
        List<FastgptTagGroup> list = fastgptTagGroupService.selectFastgptTagGroupList(fastgptTagGroup);
        return getDataTable(list);
    }

    /**
     * 导出ai标签组列表
     */
    @PreAuthorize("@ss.hasPermi('fastGpt:fastgptTagGroup:export')")
    @Log(title = "ai标签组", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(FastgptTagGroup fastgptTagGroup)
    {
        List<FastgptTagGroup> list = fastgptTagGroupService.selectFastgptTagGroupList(fastgptTagGroup);
        ExcelUtil<FastgptTagGroup> util = new ExcelUtil<FastgptTagGroup>(FastgptTagGroup.class);
        return util.exportExcel(list, "ai标签组数据");
    }

    /**
     * 获取ai标签组详细信息
     */
    @PreAuthorize("@ss.hasPermi('fastGpt:fastgptTagGroup:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(fastgptTagGroupService.selectFastgptTagGroupById(id));
    }

    /**
     * 新增ai标签组
     */
    @PreAuthorize("@ss.hasPermi('fastGpt:fastgptTagGroup:add')")
    @Log(title = "ai标签组", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody FastgptTagGroup fastgptTagGroup)
    {
        return toAjax(fastgptTagGroupService.insertFastgptTagGroup(fastgptTagGroup));
    }

    /**
     * 修改ai标签组
     */
    @PreAuthorize("@ss.hasPermi('fastGpt:fastgptTagGroup:edit')")
    @Log(title = "ai标签组", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody FastgptTagGroup fastgptTagGroup)
    {
        return toAjax(fastgptTagGroupService.updateFastgptTagGroup(fastgptTagGroup));
    }

    /**
     * 删除ai标签组
     */
    @PreAuthorize("@ss.hasPermi('fastGpt:fastgptTagGroup:remove')")
    @Log(title = "ai标签组", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(fastgptTagGroupService.deleteFastgptTagGroupByIds(ids));
    }
}
