package com.fs.company.controller.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.FastGptUser;
import com.fs.fastGpt.service.IFastGptUserService;
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 2024-09-30
 */
@RestController
@RequestMapping("/fastGpt/fastGptUser")
public class FastGptUserController extends BaseController
{
    @Autowired
    private IFastGptUserService fastGptUserService;

    /**
     * 查询客户信息列表
     */
    @PreAuthorize("@ss.hasPermi('fastGpt:fastGptUser:list')")
    @GetMapping("/list")
    public TableDataInfo list(FastGptUser fastGptUser)
    {
        startPage();
        List<FastGptUser> list = fastGptUserService.selectFastGptUserList(fastGptUser);
        return getDataTable(list);
    }

    /**
     * 导出客户信息列表
     */
    @PreAuthorize("@ss.hasPermi('fastGpt:fastGptUser:export')")
    @Log(title = "客户信息", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(FastGptUser fastGptUser)
    {
        List<FastGptUser> list = fastGptUserService.selectFastGptUserList(fastGptUser);
        ExcelUtil<FastGptUser> util = new ExcelUtil<FastGptUser>(FastGptUser.class);
        return util.exportExcel(list, "客户信息数据");
    }

    /**
     * 获取客户信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('fastGpt:fastGptUser:query')")
    @GetMapping(value = "/{uid}")
    public AjaxResult getInfo(@PathVariable("uid") Long uid)
    {
        return AjaxResult.success(fastGptUserService.selectFastGptUserByUid(uid));
    }

    /**
     * 新增客户信息
     */
    @PreAuthorize("@ss.hasPermi('fastGpt:fastGptUser:add')")
    @Log(title = "客户信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody FastGptUser fastGptUser)
    {
        return toAjax(fastGptUserService.insertFastGptUser(fastGptUser));
    }

    /**
     * 修改客户信息
     */
    @PreAuthorize("@ss.hasPermi('fastGpt:fastGptUser:edit')")
    @Log(title = "客户信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody FastGptUser fastGptUser)
    {
        return toAjax(fastGptUserService.updateFastGptUser(fastGptUser));
    }

    /**
     * 删除客户信息
     */
    @PreAuthorize("@ss.hasPermi('fastGpt:fastGptUser:remove')")
    @Log(title = "客户信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{uids}")
    public AjaxResult remove(@PathVariable Long[] uids)
    {
        return toAjax(fastGptUserService.deleteFastGptUserByUids(uids));
    }
}
