package com.ruoyi.frequency.appealdetail.controller;

import java.util.List;
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.frequency.appealdetail.entity.AppealDetail;
import com.ruoyi.frequency.appealdetail.service.AppealDetailService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 申诉详情Controller
 * 
 * @author zj
 * @date 2023-10-13
 */
@RestController
@RequestMapping("/frequency/appealdetail")
public class AppealDetailController extends BaseController
{
    @Autowired
    private AppealDetailService appealDetailService;

    /**
     * 查询申诉详情列表
     */
    @PreAuthorize("@ss.hasPermi('frequency:appealdetail:list')")
    @PostMapping("/list")
    public TableDataInfo<AppealDetail> list(@RequestBody AppealDetail appealDetail)
    {
        startPage();
        List<AppealDetail> list = appealDetailService.selectAppealDetailList(appealDetail);
        return getDataTable(list);
    }

    /**
     * 导出申诉详情列表
     */
    @PreAuthorize("@ss.hasPermi('frequency:appealdetail:export')")
    @Log(title = "申诉详情", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(AppealDetail appealDetail)
    {
        List<AppealDetail> list = appealDetailService.selectAppealDetailList(appealDetail);
        ExcelUtil<AppealDetail> util = new ExcelUtil<AppealDetail>(AppealDetail.class);
        return util.exportExcel(list, "申诉详情数据");
    }

    /**
     * 获取申诉详情详细信息
     */
    @PreAuthorize("@ss.hasPermi('frequency:appealdetail:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult<AppealDetail> getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(appealDetailService.selectAppealDetailById(id));
    }

    /**
     * 新增申诉详情
     */
    @PreAuthorize("@ss.hasPermi('frequency:appealdetail:add')")
    @Log(title = "申诉详情", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody AppealDetail appealDetail)
    {
        return toAjax(appealDetailService.insertAppealDetail(appealDetail));
    }

    /**
     * 修改申诉详情
     */
    @PreAuthorize("@ss.hasPermi('frequency:appealdetail:edit')")
    @Log(title = "申诉详情", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody AppealDetail appealDetail)
    {
        return toAjax(appealDetailService.updateAppealDetail(appealDetail));
    }

    /**
     * 删除申诉详情
     */
    @PreAuthorize("@ss.hasPermi('frequency:appealdetail:remove')")
    @Log(title = "申诉详情", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(appealDetailService.deleteAppealDetailByIds(ids));
    }
}
