package com.ruoyi.system.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
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.system.domain.OrderSoundLog;
import com.ruoyi.system.service.IOrderSoundLogService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 录音临时文件Controller
 * 
 * @author ruoyi
 * @date 2025-05-13
 */
@RestController
@RequestMapping("/system/OrderSoundLog")
public class OrderSoundLogController extends BaseController
{
    @Autowired
    private IOrderSoundLogService orderSoundLogService;

    /**
     * 查询录音临时文件列表
     */
    @PreAuthorize("@ss.hasPermi('system:OrderSoundLog:list')")
    @GetMapping("/list")
    public TableDataInfo list(OrderSoundLog orderSoundLog)
    {
        startPage();
        List<OrderSoundLog> list = orderSoundLogService.selectOrderSoundLogList(orderSoundLog);
        return getDataTable(list);
    }

    /**
     * 导出录音临时文件列表
     */
    @PreAuthorize("@ss.hasPermi('system:OrderSoundLog:export')")
    @Log(title = "录音临时文件", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, OrderSoundLog orderSoundLog)
    {
        List<OrderSoundLog> list = orderSoundLogService.selectOrderSoundLogList(orderSoundLog);
        ExcelUtil<OrderSoundLog> util = new ExcelUtil<OrderSoundLog>(OrderSoundLog.class);
        util.exportExcel(response, list, "录音临时文件数据");
    }

    /**
     * 获取录音临时文件详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:OrderSoundLog:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Integer id)
    {
        return success(orderSoundLogService.selectOrderSoundLogById(id));
    }

    /**
     * 新增录音临时文件
     */
    @PreAuthorize("@ss.hasPermi('system:OrderSoundLog:add')")
    @Log(title = "录音临时文件", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody OrderSoundLog orderSoundLog)
    {
        return toAjax(orderSoundLogService.insertOrderSoundLog(orderSoundLog));
    }

    /**
     * 修改录音临时文件
     */
    @PreAuthorize("@ss.hasPermi('system:OrderSoundLog:edit')")
    @Log(title = "录音临时文件", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody OrderSoundLog orderSoundLog)
    {
        return toAjax(orderSoundLogService.updateOrderSoundLog(orderSoundLog));
    }

    /**
     * 删除录音临时文件
     */
    @PreAuthorize("@ss.hasPermi('system:OrderSoundLog:remove')")
    @Log(title = "录音临时文件", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Integer[] ids)
    {
        return toAjax(orderSoundLogService.deleteOrderSoundLogByIds(ids));
    }
}
