package com.fs.store.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.store.domain.FsStoreAfterSalesStatus;
import com.fs.store.service.IFsStoreAfterSalesStatusService;
import com.fs.common.utils.poi.ExcelUtil;
import com.fs.common.core.page.TableDataInfo;

/**
 * 售后订单操作Controller
 * 
 * @author fs
 * @date 2022-03-15
 */
@RestController
@RequestMapping("/store/storeAfterSalesStatus")
public class FsStoreAfterSalesStatusController extends BaseController
{
    @Autowired
    private IFsStoreAfterSalesStatusService fsStoreAfterSalesStatusService;

    /**
     * 查询售后订单操作列表
     */
    @PreAuthorize("@ss.hasPermi('store:storeAfterSalesStatus:list')")
    @GetMapping("/list")
    public TableDataInfo list(FsStoreAfterSalesStatus fsStoreAfterSalesStatus)
    {
        startPage();
        List<FsStoreAfterSalesStatus> list = fsStoreAfterSalesStatusService.selectFsStoreAfterSalesStatusList(fsStoreAfterSalesStatus);
        return getDataTable(list);
    }

    /**
     * 导出售后订单操作列表
     */
    @PreAuthorize("@ss.hasPermi('store:storeAfterSalesStatus:export')")
    @Log(title = "售后订单操作", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(FsStoreAfterSalesStatus fsStoreAfterSalesStatus)
    {
        List<FsStoreAfterSalesStatus> list = fsStoreAfterSalesStatusService.selectFsStoreAfterSalesStatusList(fsStoreAfterSalesStatus);
        ExcelUtil<FsStoreAfterSalesStatus> util = new ExcelUtil<FsStoreAfterSalesStatus>(FsStoreAfterSalesStatus.class);
        return util.exportExcel(list, "storeAfterSalesStatus");
    }

    /**
     * 获取售后订单操作详细信息
     */
    @PreAuthorize("@ss.hasPermi('store:storeAfterSalesStatus:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(fsStoreAfterSalesStatusService.selectFsStoreAfterSalesStatusById(id));
    }

    /**
     * 新增售后订单操作
     */
    @PreAuthorize("@ss.hasPermi('store:storeAfterSalesStatus:add')")
    @Log(title = "售后订单操作", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody FsStoreAfterSalesStatus fsStoreAfterSalesStatus)
    {
        return toAjax(fsStoreAfterSalesStatusService.insertFsStoreAfterSalesStatus(fsStoreAfterSalesStatus));
    }

    /**
     * 修改售后订单操作
     */
    @PreAuthorize("@ss.hasPermi('store:storeAfterSalesStatus:edit')")
    @Log(title = "售后订单操作", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody FsStoreAfterSalesStatus fsStoreAfterSalesStatus)
    {
        return toAjax(fsStoreAfterSalesStatusService.updateFsStoreAfterSalesStatus(fsStoreAfterSalesStatus));
    }

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