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.QwFriendComments;
import com.fs.qw.service.IQwFriendCommentsService;
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/friendComments")
public class QwFriendCommentsController extends BaseController
{
    @Autowired
    private IQwFriendCommentsService qwFriendCommentsService;

    /**
     * 查询客户朋友圈互动数据列表
     */
    @PreAuthorize("@ss.hasPermi('qw:friendComments:list')")
    @GetMapping("/list")
    public TableDataInfo list(QwFriendComments qwFriendComments)
    {
        startPage();
        List<QwFriendComments> list = qwFriendCommentsService.selectQwFriendCommentsList(qwFriendComments);
        return getDataTable(list);
    }

    /**
     * 导出客户朋友圈互动数据列表
     */
    @PreAuthorize("@ss.hasPermi('qw:friendComments:export')")
    @Log(title = "客户朋友圈互动数据", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(QwFriendComments qwFriendComments)
    {
        List<QwFriendComments> list = qwFriendCommentsService.selectQwFriendCommentsList(qwFriendComments);
        ExcelUtil<QwFriendComments> util = new ExcelUtil<QwFriendComments>(QwFriendComments.class);
        return util.exportExcel(list, "客户朋友圈互动数据数据");
    }

    /**
     * 获取客户朋友圈互动数据详细信息
     */
    @PreAuthorize("@ss.hasPermi('qw:friendComments:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(qwFriendCommentsService.selectQwFriendCommentsById(id));
    }

    /**
     * 新增客户朋友圈互动数据
     */
    @PreAuthorize("@ss.hasPermi('qw:friendComments:add')")
    @Log(title = "客户朋友圈互动数据", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody QwFriendComments qwFriendComments)
    {
        return toAjax(qwFriendCommentsService.insertQwFriendComments(qwFriendComments));
    }

    /**
     * 修改客户朋友圈互动数据
     */
    @PreAuthorize("@ss.hasPermi('qw:friendComments:edit')")
    @Log(title = "客户朋友圈互动数据", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody QwFriendComments qwFriendComments)
    {
        return toAjax(qwFriendCommentsService.updateQwFriendComments(qwFriendComments));
    }

    /**
     * 删除客户朋友圈互动数据
     */
    @PreAuthorize("@ss.hasPermi('qw:friendComments:remove')")
    @Log(title = "客户朋友圈互动数据", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(qwFriendCommentsService.deleteQwFriendCommentsByIds(ids));
    }
}
