package com.fs.hisStore.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.hisStore.domain.FsStoreOrderNoticeScrm;
import com.fs.hisStore.service.IFsStoreOrderNoticeScrmService;
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 2022-03-15
 */
@RestController
@RequestMapping("/store/store/storeOrderNotice")
public class FsStoreOrderNoticeScrmController extends BaseController
{
    @Autowired
    private IFsStoreOrderNoticeScrmService fsStoreOrderNoticeService;

    /**
     * 查询订单通知用户 接收订单通知的用户列表
     */
    @PreAuthorize("@ss.hasPermi('store:storeOrderNotice:list')")
    @GetMapping("/list")
    public TableDataInfo list(FsStoreOrderNoticeScrm fsStoreOrderNotice)
    {
        startPage();
        List<FsStoreOrderNoticeScrm> list = fsStoreOrderNoticeService.selectFsStoreOrderNoticeList(fsStoreOrderNotice);
        return getDataTable(list);
    }

    /**
     * 导出订单通知用户 接收订单通知的用户列表
     */
    @PreAuthorize("@ss.hasPermi('store:storeOrderNotice:export')")
    @Log(title = "订单通知用户 接收订单通知的用户", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(FsStoreOrderNoticeScrm fsStoreOrderNotice)
    {
        List<FsStoreOrderNoticeScrm> list = fsStoreOrderNoticeService.selectFsStoreOrderNoticeList(fsStoreOrderNotice);
        ExcelUtil<FsStoreOrderNoticeScrm> util = new ExcelUtil<FsStoreOrderNoticeScrm>(FsStoreOrderNoticeScrm.class);
        return util.exportExcel(list, "storeOrderNotice");
    }

    /**
     * 获取订单通知用户 接收订单通知的用户详细信息
     */
    @PreAuthorize("@ss.hasPermi('store:storeOrderNotice:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(fsStoreOrderNoticeService.selectFsStoreOrderNoticeById(id));
    }

    /**
     * 新增订单通知用户 接收订单通知的用户
     */
    @PreAuthorize("@ss.hasPermi('store:storeOrderNotice:add')")
    @Log(title = "订单通知用户 接收订单通知的用户", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody FsStoreOrderNoticeScrm fsStoreOrderNotice)
    {
        return toAjax(fsStoreOrderNoticeService.insertFsStoreOrderNotice(fsStoreOrderNotice));
    }

    /**
     * 修改订单通知用户 接收订单通知的用户
     */
    @PreAuthorize("@ss.hasPermi('store:storeOrderNotice:edit')")
    @Log(title = "订单通知用户 接收订单通知的用户", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody FsStoreOrderNoticeScrm fsStoreOrderNotice)
    {
        return toAjax(fsStoreOrderNoticeService.updateFsStoreOrderNotice(fsStoreOrderNotice));
    }

    /**
     * 删除订单通知用户 接收订单通知的用户
     */
    @PreAuthorize("@ss.hasPermi('store:storeOrderNotice:remove')")
    @Log(title = "订单通知用户 接收订单通知的用户", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(fsStoreOrderNoticeService.deleteFsStoreOrderNoticeByIds(ids));
    }
}
