package com.ruoyi.web.controller.back;

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.voluntary.domain.BBusiEcardPrice;
import com.ruoyi.voluntary.service.IBBusiEcardPriceService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 在线电子卡价格Controller
 * 
 * @author mingxue
 * @date 2022-08-06
 */
@RestController
@RequestMapping("/back/bBusiEcardPrice")
public class BackBusiEcardPriceController extends BaseController
{
    @Autowired
    private IBBusiEcardPriceService bBusiEcardPriceService;

    /**
     * 查询在线电子卡价格列表
     */
    @PreAuthorize("@ss.hasPermi('back:bBusiEcardPrice:list')")
    @GetMapping("/list")
    public TableDataInfo list(BBusiEcardPrice bBusiEcardPrice)
    {
        startPage();
        List<BBusiEcardPrice> list = bBusiEcardPriceService.selectBBusiEcardPriceList(bBusiEcardPrice);
        return getDataTable(list);
    }

    /**
     * 导出在线电子卡价格列表
     */
    @PreAuthorize("@ss.hasPermi('back:bBusiEcardPrice:export')")
    @Log(title = "在线电子卡价格", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(BBusiEcardPrice bBusiEcardPrice)
    {
        List<BBusiEcardPrice> list = bBusiEcardPriceService.selectBBusiEcardPriceList(bBusiEcardPrice);
        ExcelUtil<BBusiEcardPrice> util = new ExcelUtil<BBusiEcardPrice>(BBusiEcardPrice.class);
        return util.exportExcel(list, "在线电子卡价格数据");
    }

    /**
     * 获取在线电子卡价格详细信息
     */
    @PreAuthorize("@ss.hasPermi('back:bBusiEcardPrice:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(bBusiEcardPriceService.selectBBusiEcardPriceById(id));
    }

    /**
     * 新增在线电子卡价格
     */
    @PreAuthorize("@ss.hasPermi('back:bBusiEcardPrice:add')")
    @Log(title = "在线电子卡价格", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BBusiEcardPrice bBusiEcardPrice)
    {
        return toAjax(bBusiEcardPriceService.insertBBusiEcardPrice(bBusiEcardPrice));
    }

    /**
     * 修改在线电子卡价格
     */
    @PreAuthorize("@ss.hasPermi('back:bBusiEcardPrice:edit')")
    @Log(title = "在线电子卡价格", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BBusiEcardPrice bBusiEcardPrice)
    {
        return toAjax(bBusiEcardPriceService.updateBBusiEcardPrice(bBusiEcardPrice));
    }

    /**
     * 删除在线电子卡价格
     */
    @PreAuthorize("@ss.hasPermi('back:bBusiEcardPrice:remove')")
    @Log(title = "在线电子卡价格", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(bBusiEcardPriceService.deleteBBusiEcardPriceByIds(ids));
    }
}
