package com.fs.fastGpt;

import java.util.List;

import com.fs.common.core.domain.R;
import com.fs.fastGpt.vo.FastgptExtUserTagVO;
import com.fs.qw.service.IQwCompanyService;
import com.fs.qw.vo.QwOptionsVO;
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.FastgptExtUserTag;
import com.fs.fastGpt.service.IFastgptExtUserTagService;
import com.fs.common.utils.poi.ExcelUtil;
import com.fs.common.core.page.TableDataInfo;

/**
 * 处理新客标签Controller
 * 
 * @author fs
 * @date 2025-09-10
 */
@RestController
@RequestMapping("/fastGpt/FastGptExtUserTag")
public class FastgptExtUserTagController extends BaseController
{
    @Autowired
    private IFastgptExtUserTagService fastgptExtUserTagService;


    @Autowired
    private IQwCompanyService qwCompanyService;


    /**
     * 查询处理新客标签列表
     */
    @PreAuthorize("@ss.hasPermi('FastGptExtUserTag:FastGptExtUserTag:list')")
    @GetMapping("/list")
    public TableDataInfo list(FastgptExtUserTag fastgptExtUserTag)
    {
        startPage();
        List<FastgptExtUserTag> list = fastgptExtUserTagService.selectFastgptExtUserTagList(fastgptExtUserTag);
        return getDataTable(list);
    }
    @PreAuthorize("@ss.hasPermi('qw:externalContact:addTag')")
    @Log(title = "添加标签", businessType = BusinessType.UPDATE)
    @PostMapping("/addFastGptTagByCorpId")
    public R addFastGptTagByCorpId(@RequestBody FastgptExtUserTagVO fastgptExtUserTag) {
        return fastgptExtUserTagService.addFastGptTagByCorpId(fastgptExtUserTag);
    }
    @GetMapping("/getMyQwUserList")
    public R getMyQwUserList()
    {
        List<QwOptionsVO> list = qwCompanyService.selectQwCompanyListOptionsVO(null, null);
        return  R.ok().put("data",list);
    }

    /**
     * 导出处理新客标签列表
     */
    @PreAuthorize("@ss.hasPermi('FastGptExtUserTag:FastGptExtUserTag:export')")
    @Log(title = "处理新客标签", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(FastgptExtUserTag fastgptExtUserTag)
    {
        List<FastgptExtUserTag> list = fastgptExtUserTagService.selectFastgptExtUserTagList(fastgptExtUserTag);
        ExcelUtil<FastgptExtUserTag> util = new ExcelUtil<FastgptExtUserTag>(FastgptExtUserTag.class);
        return util.exportExcel(list, "处理新客标签数据");
    }

    /**
     * 获取处理新客标签详细信息
     */
    @PreAuthorize("@ss.hasPermi('FastGptExtUserTag:FastGptExtUserTag:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(fastgptExtUserTagService.selectFastgptExtUserTagById(id));
    }

    /**
     * 新增处理新客标签
     */
    @PreAuthorize("@ss.hasPermi('FastGptExtUserTag:FastGptExtUserTag:add')")
    @Log(title = "处理新客标签", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody FastgptExtUserTag fastgptExtUserTag)
    {
        return toAjax(fastgptExtUserTagService.insertFastgptExtUserTag(fastgptExtUserTag));
    }

    /**
     * 修改处理新客标签
     */
    @PreAuthorize("@ss.hasPermi('FastGptExtUserTag:FastGptExtUserTag:edit')")
    @Log(title = "处理新客标签", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody FastgptExtUserTag fastgptExtUserTag)
    {
        return toAjax(fastgptExtUserTagService.updateFastgptExtUserTag(fastgptExtUserTag));
    }

    /**
     * 删除处理新客标签
     */
    @PreAuthorize("@ss.hasPermi('FastGptExtUserTag:FastGptExtUserTag:remove')")
    @Log(title = "处理新客标签", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(fastgptExtUserTagService.deleteFastgptExtUserTagByIds(ids));
    }
}
