package com.ruoyi.web.controller.system;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.ss.orderOper.domain.OrderOper;
import com.ruoyi.ss.orderOper.service.IOrderOperService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 操作操作履历Controller
 *
 * @author qzz
 * @date 2024-10-10
 */
@RestController
@RequestMapping("/system/orderOper")
public class OrderOperController extends BaseController
{
    @Autowired
    private IOrderOperService rlOrderOperService;

    /**
     * 查询操作操作履历列表
     */
    @PreAuthorize("@ss.hasPermi('system:orderOper:list')")
    @GetMapping("/list")
    public TableDataInfo list(OrderOper rlOrderOper)
    {
        startPage();
        List<OrderOper> list = rlOrderOperService.selectRlOrderOperList(rlOrderOper);
        return getDataTable(list);
    }

    /**
     * 导出操作操作履历列表
     */
    @PreAuthorize("@ss.hasPermi('system:orderOper:export')")
    @Log(title = "操作操作履历", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, OrderOper rlOrderOper)
    {
        List<OrderOper> list = rlOrderOperService.selectRlOrderOperList(rlOrderOper);
        ExcelUtil<OrderOper> util = new ExcelUtil<OrderOper>(OrderOper.class);
        util.exportExcel(response, list, "操作操作履历数据");
    }

    /**
     * 获取操作操作履历详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:orderOper:query')")
    @GetMapping(value = "/{operId}")
    public AjaxResult getInfo(@PathVariable("operId") Long operId)
    {
        return success(rlOrderOperService.selectRlOrderOperByOperId(operId));
    }

    /**
     * 新增操作操作履历
     */
    @PreAuthorize("@ss.hasPermi('system:orderOper:add')")
    @Log(title = "操作操作履历", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody OrderOper rlOrderOper)
    {
        return toAjax(rlOrderOperService.insertRlOrderOper(rlOrderOper));
    }

    /**
     * 修改操作操作履历
     */
    @PreAuthorize("@ss.hasPermi('system:orderOper:edit')")
    @Log(title = "操作操作履历", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody OrderOper rlOrderOper)
    {
        return toAjax(rlOrderOperService.updateRlOrderOper(rlOrderOper));
    }

    /**
     * 删除操作操作履历
     */
    @PreAuthorize("@ss.hasPermi('system:orderOper:remove')")
    @Log(title = "操作操作履历", businessType = BusinessType.DELETE)
	@DeleteMapping("/{operIds}")
    public AjaxResult remove(@PathVariable Long[] operIds)
    {
        return toAjax(rlOrderOperService.deleteRlOrderOperByOperIds(operIds));
    }
}
