package com.fs.qw.controller;

import java.util.List;

import com.fs.qw.param.QwAppContactWayLogsParam;
import com.fs.qw.vo.QwAppContactWayLogsListVO;
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.qw.domain.QwAppContactWayLogs;
import com.fs.qw.service.IQwAppContactWayLogsService;
import com.fs.common.utils.poi.ExcelUtil;
import com.fs.common.core.page.TableDataInfo;

/**
 * 联系我日志Controller
 *
 * @author fs
 * @date 2024-12-19
 */
@RestController
@RequestMapping("/qw/qwAppContactWayLogs")
public class QwAppContactWayLogsController extends BaseController
{
    @Autowired
    private IQwAppContactWayLogsService qwAppContactWayLogsService;

    /**
     * 查询联系我日志列表
     */
    @PreAuthorize("@ss.hasPermi('qw:qwAppContactWayLogs:list')")
    @GetMapping("/list")
    public TableDataInfo list(QwAppContactWayLogsParam qwAppContactWayLogs)
    {
        startPage();
        List<QwAppContactWayLogsListVO> list = qwAppContactWayLogsService.selectQwAppContactWayLogsListVO(qwAppContactWayLogs);
        return getDataTable(list);
    }

    /**
     * 导出联系我日志列表
     */
    @PreAuthorize("@ss.hasPermi('qw:qwAppContactWayLogs:export')")
    @Log(title = "联系我日志", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(QwAppContactWayLogsParam qwAppContactWayLogs)
    {
        List<QwAppContactWayLogsListVO> list = qwAppContactWayLogsService.selectQwAppContactWayLogsListVO(qwAppContactWayLogs);
        ExcelUtil<QwAppContactWayLogsListVO> util = new ExcelUtil<QwAppContactWayLogsListVO>(QwAppContactWayLogsListVO.class);
        return util.exportExcel(list, "联系我日志数据");
    }

    /**
     * 获取联系我日志详细信息
     */
    @PreAuthorize("@ss.hasPermi('qw:qwAppContactWayLogs:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(qwAppContactWayLogsService.selectQwAppContactWayLogsById(id));
    }

    /**
     * 新增联系我日志
     */
    @PreAuthorize("@ss.hasPermi('qw:qwAppContactWayLogs:add')")
    @Log(title = "联系我日志", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody QwAppContactWayLogs qwAppContactWayLogs)
    {
        return toAjax(qwAppContactWayLogsService.insertQwAppContactWayLogs(qwAppContactWayLogs));
    }

    /**
     * 修改联系我日志
     */
    @PreAuthorize("@ss.hasPermi('qw:qwAppContactWayLogs:edit')")
    @Log(title = "联系我日志", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody QwAppContactWayLogs qwAppContactWayLogs)
    {
        return toAjax(qwAppContactWayLogsService.updateQwAppContactWayLogs(qwAppContactWayLogs));
    }

    /**
     * 删除联系我日志
     */
    @PreAuthorize("@ss.hasPermi('qw:qwAppContactWayLogs:remove')")
    @Log(title = "联系我日志", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(qwAppContactWayLogsService.deleteQwAppContactWayLogsByIds(ids));
    }
}
