package com.ruoyi.web.controller.back;

import java.util.List;

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

/**
 * 在线电子卡订单Controller
 * 
 * @author mingxue
 * @date 2022-08-06
 */
@RestController
@RequestMapping("/back/bBusiPaymentOrders")
public class BackBusiPaymentOrdersController extends BaseController
{
    @Autowired
    private IBBusiPaymentOrdersService bBusiPaymentOrdersService;

    /**
     * 查询在线电子卡订单列表
     */
    @PreAuthorize("@ss.hasPermi('back:bBusiPaymentOrders:list')")
    @GetMapping("/list")
    public TableDataInfo list(BBusiPaymentOrders bBusiPaymentOrders)
    {
        startPage();
        List<BBusiPaymentOrders> list = bBusiPaymentOrdersService.selectBBusiPaymentOrdersList(bBusiPaymentOrders);
        return getDataTable(list);
    }

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

    /**
     * 获取在线电子卡订单详细信息
     */
    @PreAuthorize("@ss.hasPermi('back:bBusiPaymentOrders:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(bBusiPaymentOrdersService.selectBBusiPaymentOrdersById(id));
    }

    /**
     * 新增在线电子卡订单
     */
    @PreAuthorize("@ss.hasPermi('back:bBusiPaymentOrders:add')")
    @Log(title = "在线电子卡订单", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BBusiPaymentOrders bBusiPaymentOrders)
    {
        return toAjax(bBusiPaymentOrdersService.insertBBusiPaymentOrders(bBusiPaymentOrders));
    }

    /**
     * 修改在线电子卡订单
     */
    @PreAuthorize("@ss.hasPermi('back:bBusiPaymentOrders:edit')")
    @Log(title = "在线电子卡订单", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BBusiPaymentOrders bBusiPaymentOrders)
    {
        return toAjax(bBusiPaymentOrdersService.updateBBusiPaymentOrders(bBusiPaymentOrders));
    }

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