package com.fs.company.controller.qw;

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.qw.domain.QwFriendCustomerList;
import com.fs.qw.service.IQwFriendCustomerListService;
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-18
 */
@RestController
@RequestMapping("/qw/friendCustomerList")
public class QwFriendCustomerListController extends BaseController
{
    @Autowired
    private IQwFriendCustomerListService qwFriendCustomerListService;

    /**
     * 查询企业朋友圈 发送到客户朋友里 成功的客户数据列表
     */
    @PreAuthorize("@ss.hasPermi('qw:friendCustomerList:list')")
    @GetMapping("/list")
    public TableDataInfo list(QwFriendCustomerList qwFriendCustomerList)
    {
        startPage();
        List<QwFriendCustomerList> list = qwFriendCustomerListService.selectQwFriendCustomerListList(qwFriendCustomerList);
        return getDataTable(list);
    }

    /**
     * 导出企业朋友圈 发送到客户朋友里 成功的客户数据列表
     */
    @PreAuthorize("@ss.hasPermi('qw:friendCustomerList:export')")
    @Log(title = "企业朋友圈 发送到客户朋友里 成功的客户数据", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(QwFriendCustomerList qwFriendCustomerList)
    {
        List<QwFriendCustomerList> list = qwFriendCustomerListService.selectQwFriendCustomerListList(qwFriendCustomerList);
        ExcelUtil<QwFriendCustomerList> util = new ExcelUtil<QwFriendCustomerList>(QwFriendCustomerList.class);
        return util.exportExcel(list, "企业朋友圈 发送到客户朋友里 成功的客户数据数据");
    }

    /**
     * 获取企业朋友圈 发送到客户朋友里 成功的客户数据详细信息
     */
    @PreAuthorize("@ss.hasPermi('qw:friendCustomerList:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(qwFriendCustomerListService.selectQwFriendCustomerListById(id));
    }

    /**
     * 新增企业朋友圈 发送到客户朋友里 成功的客户数据
     */
    @PreAuthorize("@ss.hasPermi('qw:friendCustomerList:add')")
    @Log(title = "企业朋友圈 发送到客户朋友里 成功的客户数据", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody QwFriendCustomerList qwFriendCustomerList)
    {
        return toAjax(qwFriendCustomerListService.insertQwFriendCustomerList(qwFriendCustomerList));
    }

    /**
     * 修改企业朋友圈 发送到客户朋友里 成功的客户数据
     */
    @PreAuthorize("@ss.hasPermi('qw:friendCustomerList:edit')")
    @Log(title = "企业朋友圈 发送到客户朋友里 成功的客户数据", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody QwFriendCustomerList qwFriendCustomerList)
    {
        return toAjax(qwFriendCustomerListService.updateQwFriendCustomerList(qwFriendCustomerList));
    }

    /**
     * 删除企业朋友圈 发送到客户朋友里 成功的客户数据
     */
    @PreAuthorize("@ss.hasPermi('qw:friendCustomerList:remove')")
    @Log(title = "企业朋友圈 发送到客户朋友里 成功的客户数据", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(qwFriendCustomerListService.deleteQwFriendCustomerListByIds(ids));
    }
}
