package com.fs.doc.controller;

import java.util.List;
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.fs.common.annotation.Log;
import com.fs.common.core.controller.BaseController;
import com.fs.common.core.domain.AjaxResult;
import com.fs.common.enums.BusinessType;
import com.fs.doc.domain.DocOrderReply;
import com.fs.doc.service.IDocOrderReplyService;
import com.fs.common.utils.poi.ExcelUtil;
import com.fs.common.core.page.TableDataInfo;

/**
 * 订单回复Controller
 * 
 * @author fs
 * @date 2023-01-09
 */
@RestController
@RequestMapping("/doc/docOrderReply")
public class DocOrderReplyController extends BaseController
{
    @Autowired
    private IDocOrderReplyService docOrderReplyService;

    /**
     * 查询订单回复列表
     */
    @PreAuthorize("@ss.hasPermi('doc:docOrderReply:list')")
    @GetMapping("/list")
    public TableDataInfo list(DocOrderReply docOrderReply)
    {
        startPage();
        List<DocOrderReply> list = docOrderReplyService.selectDocOrderReplyList(docOrderReply);
        return getDataTable(list);
    }

    /**
     * 导出订单回复列表
     */
    @PreAuthorize("@ss.hasPermi('doc:docOrderReply:export')")
    @Log(title = "订单回复", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(DocOrderReply docOrderReply)
    {
        List<DocOrderReply> list = docOrderReplyService.selectDocOrderReplyList(docOrderReply);
        ExcelUtil<DocOrderReply> util = new ExcelUtil<DocOrderReply>(DocOrderReply.class);
        return util.exportExcel(list, "docOrderReply");
    }

    /**
     * 获取订单回复详细信息
     */
    @PreAuthorize("@ss.hasPermi('doc:docOrderReply:query')")
    @GetMapping(value = "/{replyId}")
    public AjaxResult getInfo(@PathVariable("replyId") Long replyId)
    {
        return AjaxResult.success(docOrderReplyService.selectDocOrderReplyById(replyId));
    }

    /**
     * 新增订单回复
     */
    @PreAuthorize("@ss.hasPermi('doc:docOrderReply:add')")
    @Log(title = "订单回复", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DocOrderReply docOrderReply)
    {
        return toAjax(docOrderReplyService.insertDocOrderReply(docOrderReply));
    }

    /**
     * 修改订单回复
     */
    @PreAuthorize("@ss.hasPermi('doc:docOrderReply:edit')")
    @Log(title = "订单回复", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DocOrderReply docOrderReply)
    {
        return toAjax(docOrderReplyService.updateDocOrderReply(docOrderReply));
    }

    /**
     * 删除订单回复
     */
    @PreAuthorize("@ss.hasPermi('doc:docOrderReply:remove')")
    @Log(title = "订单回复", businessType = BusinessType.DELETE)
	@DeleteMapping("/{replyIds}")
    public AjaxResult remove(@PathVariable Long[] replyIds)
    {
        return toAjax(docOrderReplyService.deleteDocOrderReplyByIds(replyIds));
    }
}
