package com.fs.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.QwFriendCircleTask;
import com.fs.qw.service.IQwFriendCircleTaskService;
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/friendCircleTask")
public class QwFriendCircleTaskController extends BaseController
{
    @Autowired
    private IQwFriendCircleTaskService qwFriendCircleTaskService;

    /**
     * 查询客户朋友圈执行情况列表
     */
    @PreAuthorize("@ss.hasPermi('qw:friendCircleTask:list')")
    @GetMapping("/list")
    public TableDataInfo list(QwFriendCircleTask qwFriendCircleTask)
    {
        startPage();
        List<QwFriendCircleTask> list = qwFriendCircleTaskService.selectQwFriendCircleTaskList(qwFriendCircleTask);
        return getDataTable(list);
    }

    /**
     * 导出客户朋友圈执行情况列表
     */
    @PreAuthorize("@ss.hasPermi('qw:friendCircleTask:export')")
    @Log(title = "客户朋友圈执行情况", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(QwFriendCircleTask qwFriendCircleTask)
    {
        List<QwFriendCircleTask> list = qwFriendCircleTaskService.selectQwFriendCircleTaskList(qwFriendCircleTask);
        ExcelUtil<QwFriendCircleTask> util = new ExcelUtil<QwFriendCircleTask>(QwFriendCircleTask.class);
        return util.exportExcel(list, "客户朋友圈执行情况数据");
    }

    /**
     * 获取客户朋友圈执行情况详细信息
     */
    @PreAuthorize("@ss.hasPermi('qw:friendCircleTask:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(qwFriendCircleTaskService.selectQwFriendCircleTaskById(id));
    }

    /**
     * 新增客户朋友圈执行情况
     */
    @PreAuthorize("@ss.hasPermi('qw:friendCircleTask:add')")
    @Log(title = "客户朋友圈执行情况", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody QwFriendCircleTask qwFriendCircleTask)
    {
        return toAjax(qwFriendCircleTaskService.insertQwFriendCircleTask(qwFriendCircleTask));
    }

    /**
     * 修改客户朋友圈执行情况
     */
    @PreAuthorize("@ss.hasPermi('qw:friendCircleTask:edit')")
    @Log(title = "客户朋友圈执行情况", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody QwFriendCircleTask qwFriendCircleTask)
    {
        return toAjax(qwFriendCircleTaskService.updateQwFriendCircleTask(qwFriendCircleTask));
    }

    /**
     * 删除客户朋友圈执行情况
     */
    @PreAuthorize("@ss.hasPermi('qw:friendCircleTask:remove')")
    @Log(title = "客户朋友圈执行情况", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(qwFriendCircleTaskService.deleteQwFriendCircleTaskByIds(ids));
    }
}
