package com.easyproject.web.controller.operate;

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

import com.easyproject.service.domain.operate.OperateFeedback;
import com.easyproject.system.service.operate.IOperateFeedbackService;
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.easyproject.common.annotation.Log;
import com.easyproject.common.core.controller.BaseController;
import com.easyproject.common.core.domain.AjaxResult;
import com.easyproject.common.enums.BusinessType;
import com.easyproject.common.core.page.TableDataInfo;

/**
 * 意见反馈Controller
 *
 * @author easyproject
 * @date 2025-03-21
 */
@RestController
@RequestMapping("/system/feedback")
public class OperateFeedbackController extends BaseController {
    @Autowired
    private IOperateFeedbackService operateFeedbackService;

    /**
     * 查询意见反馈列表
     */
    @PreAuthorize("@ss.hasPermi('system:feedback:list')")
    @GetMapping("/list")
    public TableDataInfo list(OperateFeedback operateFeedback) {
        startPage();
        List<OperateFeedback> list = operateFeedbackService.selectOperateFeedbackList(operateFeedback);
        return getDataTable(list);
    }

    /**
     * 获取意见反馈详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:feedback:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return success(operateFeedbackService.selectOperateFeedbackById(id));
    }

    /**
     * 标记意见反馈
     */
    @PreAuthorize("@ss.hasPermi('system:feedback:edit')")
    @Log(title = "标记意见反馈", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody OperateFeedback operateFeedback) {
        return toAjax(operateFeedbackService.markOperateFeedback(operateFeedback));
    }

    /**
     * 删除意见反馈
     */
    @PreAuthorize("@ss.hasPermi('system:feedback:remove')")
    @Log(title = "意见反馈", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(operateFeedbackService.deleteOperateFeedbackByIds(ids));
    }
}
