package com.fs.company.controller.live;

import com.fs.common.annotation.Log;
import com.fs.common.core.controller.BaseController;
import com.fs.common.core.domain.AjaxResult;
import com.fs.common.core.page.TableDataInfo;
import com.fs.common.enums.BusinessType;
import com.fs.common.utils.poi.ExcelUtil;
import com.fs.live.domain.LiveOrderLogs;
import com.fs.live.service.ILiveOrderLogsService;
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 fs
 * @date 2025-07-08
 */
@RestController
@RequestMapping("/live/liveOrderLogs")
public class LiveOrderLogsController extends BaseController
{
    @Autowired
    private ILiveOrderLogsService liveOrderLogsService;

    /**
     * 查询订单操作记录列表
     */
    @PreAuthorize("@ss.hasPermi('live:liveOrderLogs:list')")
    @GetMapping("/list")
    public TableDataInfo list(LiveOrderLogs liveOrderLogs)
    {
        startPage();
        List<LiveOrderLogs> list = liveOrderLogsService.selectLiveOrderLogsList(liveOrderLogs);
        return getDataTable(list);
    }

    /**
     * 导出订单操作记录列表
     */
    @PreAuthorize("@ss.hasPermi('live:liveOrderLogs:export')")
    @Log(title = "订单操作记录", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(LiveOrderLogs liveOrderLogs)
    {
        List<LiveOrderLogs> list = liveOrderLogsService.selectLiveOrderLogsList(liveOrderLogs);
        ExcelUtil<LiveOrderLogs> util = new ExcelUtil<LiveOrderLogs>(LiveOrderLogs.class);
        return util.exportExcel(list, "订单操作记录数据");
    }

    /**
     * 获取订单操作记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('live:liveOrderLogs:query')")
    @GetMapping(value = "/{logsId}")
    public AjaxResult getInfo(@PathVariable("logsId") String logsId)
    {
        return AjaxResult.success(liveOrderLogsService.selectLiveOrderLogsByLogsId(logsId));
    }

    /**
     * 新增订单操作记录
     */
    @PreAuthorize("@ss.hasPermi('live:liveOrderLogs:add')")
    @Log(title = "订单操作记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody LiveOrderLogs liveOrderLogs)
    {
        return toAjax(liveOrderLogsService.insertLiveOrderLogs(liveOrderLogs));
    }

    /**
     * 修改订单操作记录
     */
    @PreAuthorize("@ss.hasPermi('live:liveOrderLogs:edit')")
    @Log(title = "订单操作记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody LiveOrderLogs liveOrderLogs)
    {
        return toAjax(liveOrderLogsService.updateLiveOrderLogs(liveOrderLogs));
    }

    /**
     * 删除订单操作记录
     */
    @PreAuthorize("@ss.hasPermi('live:liveOrderLogs:remove')")
    @Log(title = "订单操作记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{logsIds}")
    public AjaxResult remove(@PathVariable String[] logsIds)
    {
        return toAjax(liveOrderLogsService.deleteLiveOrderLogsByLogsIds(logsIds));
    }
}
