package com.ruoyi.system.controller;

import java.util.List;
import jakarta.servlet.http.HttpServletResponse;

import com.ruoyi.common.annotation.Anonymous;
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.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.PosFeedback;
import com.ruoyi.system.service.IPosFeedbackService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * PosFeedbackController
 * 
 * @author ruoyi
 * @date 2024-07-24
 */
@RestController
@RequestMapping("/system/posfeedback")
public class PosFeedbackController extends BaseController
{
    @Autowired
    private IPosFeedbackService posFeedbackService;

    /**
     * 查询快捷回复列表
     */
    @Anonymous
    @GetMapping("/getfeedlist")
    public AjaxResult getfeedlist()
    {
        List<PosFeedback> list = posFeedbackService.list();
        return success("查询成功",list);
    }
    /**
     * 查询PosFeedback列表
     */
    @PreAuthorize("@ss.hasPermi('system:posfeedback:list')")
    @GetMapping("/list")
    public TableDataInfo list(PosFeedback posFeedback)
    {
        startPage();
        List<PosFeedback> list = posFeedbackService.selectPosFeedbackList(posFeedback);
        return getDataTable(list);
    }

    /**
     * 导出PosFeedback列表
     */
    @PreAuthorize("@ss.hasPermi('system:posfeedback:export')")
    @Log(title = "PosFeedback", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, PosFeedback posFeedback)
    {
        List<PosFeedback> list = posFeedbackService.selectPosFeedbackList(posFeedback);
        ExcelUtil<PosFeedback> util = new ExcelUtil<PosFeedback>(PosFeedback.class);
        util.exportExcel(response, list, "PosFeedback数据");
    }

    /**
     * 获取PosFeedback详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:posfeedback:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(posFeedbackService.selectPosFeedbackById(id));
    }

    /**
     * 新增PosFeedback
     */
    @PreAuthorize("@ss.hasPermi('system:posfeedback:add')")
    @Log(title = "PosFeedback", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody PosFeedback posFeedback)
    {
        return toAjax(posFeedbackService.insertPosFeedback(posFeedback));
    }

    /**
     * 修改PosFeedback
     */
    @PreAuthorize("@ss.hasPermi('system:posfeedback:edit')")
    @Log(title = "PosFeedback", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody PosFeedback posFeedback)
    {
        return toAjax(posFeedbackService.updatePosFeedback(posFeedback));
    }

    /**
     * 删除PosFeedback
     */
    @PreAuthorize("@ss.hasPermi('system:posfeedback:remove')")
    @Log(title = "PosFeedback", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(posFeedbackService.deletePosFeedbackByIds(ids));
    }
}
