package com.ruoyi.web.controller.suggestionFj;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.suggestionFj.SuggestionFj;
import com.ruoyi.system.service.ISuggestionFjService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 投诉建议_附件Controller
 *
 * @author boman
 * @date 2025-02-24
 */
@RestController
@RequestMapping("/wuYe/suggestionFj")
public class SuggestionFjController extends BaseController
{
    @Autowired
    private ISuggestionFjService suggestionFjService;

/**
 * 查询投诉建议_附件列表
 */
@PreAuthorize("@ss.hasPermi('wuYe:suggestionFj:list')")
@GetMapping("/list")
    public TableDataInfo list(SuggestionFj suggestionFj)
    {
        startPage();
        List<SuggestionFj> list = suggestionFjService.selectSuggestionFjList(suggestionFj);
        return getDataTable(list);
    }

    /**
     * 导出投诉建议_附件列表
     */
    @PreAuthorize("@ss.hasPermi('wuYe:suggestionFj:export')")
    @Log(title = "投诉建议_附件", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SuggestionFj suggestionFj)
    {
        List<SuggestionFj> list = suggestionFjService.selectSuggestionFjList(suggestionFj);
        ExcelUtil<SuggestionFj> util = new ExcelUtil<SuggestionFj>(SuggestionFj.class);
        util.exportExcel(response, list, "投诉建议_附件数据");
    }

    /**
     * 获取投诉建议_附件详细信息
     */
    @PreAuthorize("@ss.hasPermi('wuYe:suggestionFj:query')")
    @GetMapping(value = "/{suggestionFjId}")
    public AjaxResult getInfo(@PathVariable("suggestionFjId") Long suggestionFjId)
    {
        return success(suggestionFjService.selectSuggestionFjBySuggestionFjId(suggestionFjId));
    }

    /**
     * 新增投诉建议_附件
     */
    @PreAuthorize("@ss.hasPermi('wuYe:suggestionFj:add')")
    @Log(title = "投诉建议_附件", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SuggestionFj suggestionFj)
    {
        return toAjax(suggestionFjService.insertSuggestionFj(suggestionFj));
    }

    /**
     * 修改投诉建议_附件
     */
    @PreAuthorize("@ss.hasPermi('wuYe:suggestionFj:edit')")
    @Log(title = "投诉建议_附件", businessType = BusinessType.UPDATE)
    @PostMapping("/put")
    public AjaxResult edit(@RequestBody SuggestionFj suggestionFj)
    {
        return toAjax(suggestionFjService.updateSuggestionFj(suggestionFj));
    }

    /**
     * 删除投诉建议_附件
     */
    @PreAuthorize("@ss.hasPermi('wuYe:suggestionFj:remove')")
    @Log(title = "投诉建议_附件", businessType = BusinessType.DELETE)
    @GetMapping("/delete/{suggestionFjIds}")
    public AjaxResult remove(@PathVariable Long[] suggestionFjIds)
    {
        return toAjax(suggestionFjService.deleteSuggestionFjBySuggestionFjIds(suggestionFjIds));
    }
}
