package com.fs.live.controller;

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.LiveAfterSalesLogs;
import com.fs.live.service.ILiveAfterSalesLogsService;
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/liveAfterSalesLogs")
public class LiveAfterSalesLogsController extends BaseController
{
    @Autowired
    private ILiveAfterSalesLogsService liveAfterSalesLogsService;

    /**
     * 查询售后订单操作列表
     */
    @PreAuthorize("@ss.hasPermi('live:liveAfterSalesLogs:list')")
    @GetMapping("/list")
    public TableDataInfo list(LiveAfterSalesLogs liveAfterSalesLogs)
    {
        startPage();
        List<LiveAfterSalesLogs> list = liveAfterSalesLogsService.selectLiveAfterSalesLogsList(liveAfterSalesLogs);
        return getDataTable(list);
    }

    /**
     * 导出售后订单操作列表
     */
    @PreAuthorize("@ss.hasPermi('live:liveAfterSalesLogs:export')")
    @Log(title = "售后订单操作", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(LiveAfterSalesLogs liveAfterSalesLogs)
    {
        List<LiveAfterSalesLogs> list = liveAfterSalesLogsService.selectLiveAfterSalesLogsList(liveAfterSalesLogs);
        ExcelUtil<LiveAfterSalesLogs> util = new ExcelUtil<LiveAfterSalesLogs>(LiveAfterSalesLogs.class);
        return util.exportExcel(list, "售后订单操作数据");
    }

    /**
     * 获取售后订单操作详细信息
     */
    @PreAuthorize("@ss.hasPermi('live:liveAfterSalesLogs:query')")
    @GetMapping(value = "/{logsId}")
    public AjaxResult getInfo(@PathVariable("logsId") Long logsId)
    {
        return AjaxResult.success(liveAfterSalesLogsService.selectLiveAfterSalesLogsByLogsId(logsId));
    }

    /**
     * 新增售后订单操作
     */
    @PreAuthorize("@ss.hasPermi('live:liveAfterSalesLogs:add')")
    @Log(title = "售后订单操作", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody LiveAfterSalesLogs liveAfterSalesLogs)
    {
        return toAjax(liveAfterSalesLogsService.insertLiveAfterSalesLogs(liveAfterSalesLogs));
    }

    /**
     * 修改售后订单操作
     */
    @PreAuthorize("@ss.hasPermi('live:liveAfterSalesLogs:edit')")
    @Log(title = "售后订单操作", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody LiveAfterSalesLogs liveAfterSalesLogs)
    {
        return toAjax(liveAfterSalesLogsService.updateLiveAfterSalesLogs(liveAfterSalesLogs));
    }

    /**
     * 删除售后订单操作
     */
    @PreAuthorize("@ss.hasPermi('live:liveAfterSalesLogs:remove')")
    @Log(title = "售后订单操作", businessType = BusinessType.DELETE)
	@DeleteMapping("/{logsIds}")
    public AjaxResult remove(@PathVariable Long[] logsIds)
    {
        return toAjax(liveAfterSalesLogsService.deleteLiveAfterSalesLogsByLogsIds(logsIds));
    }
}
