package com.ruoyi.frequency.pfwithdrawalway.controller;

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.frequency.pfwithdrawalway.entity.PfWithdrawalWay;
import com.ruoyi.frequency.pfwithdrawalway.service.PfWithdrawalWayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 后台提现方式Controller
 * 
 * @author liwenlong
 * @date 2023-07-20
 */
@RestController
@RequestMapping("/frequency/pfwithdrawalway")
public class PfWithdrawalWayController extends BaseController
{
    @Autowired
    private PfWithdrawalWayService pfWithdrawalWayService;

    /**
     * 查询后台提现方式列表
     */
    @PreAuthorize("@ss.hasPermi('frequency:pfwithdrawalway:list')")
    @GetMapping("/list")
    public TableDataInfo list(PfWithdrawalWay pfWithdrawalWay)
    {
        startPage();
        List<PfWithdrawalWay> list = pfWithdrawalWayService.selectPfWithdrawalWayList(pfWithdrawalWay);
        return getDataTable(list);
    }

    /**
     * 导出后台提现方式列表
     */
    @PreAuthorize("@ss.hasPermi('frequency:pfwithdrawalway:export')")
    @Log(title = "后台提现方式", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(PfWithdrawalWay pfWithdrawalWay)
    {
        List<PfWithdrawalWay> list = pfWithdrawalWayService.selectPfWithdrawalWayList(pfWithdrawalWay);
        ExcelUtil<PfWithdrawalWay> util = new ExcelUtil<PfWithdrawalWay>(PfWithdrawalWay.class);
        return util.exportExcel(list, "后台提现方式数据");
    }

    /**
     * 获取后台提现方式详细信息
     */
    @PreAuthorize("@ss.hasPermi('frequency:pfwithdrawalway:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(pfWithdrawalWayService.selectPfWithdrawalWayById(id));
    }

    /**
     * 新增后台提现方式
     */
    @PreAuthorize("@ss.hasPermi('frequency:pfwithdrawalway:add')")
    @Log(title = "后台提现方式", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody PfWithdrawalWay pfWithdrawalWay)
    {
        return toAjax(pfWithdrawalWayService.insertPfWithdrawalWay(pfWithdrawalWay));
    }

    /**
     * 修改后台提现方式
     */
    @PreAuthorize("@ss.hasPermi('frequency:pfwithdrawalway:edit')")
    @Log(title = "后台提现方式", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody PfWithdrawalWay pfWithdrawalWay)
    {
        return toAjax(pfWithdrawalWayService.updatePfWithdrawalWay(pfWithdrawalWay));
    }

    /**
     * 删除后台提现方式
     */
    @PreAuthorize("@ss.hasPermi('frequency:pfwithdrawalway:remove')")
    @Log(title = "后台提现方式", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(pfWithdrawalWayService.deletePfWithdrawalWayByIds(ids));
    }
}
