package com.fs.store.controller;

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.PutMapping;
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.FsStoreCanvas;
import com.fs.store.service.IFsStoreCanvasService;

/**
 * 画布信息Controller
 * 
 * @author fs
 * @date 2022-08-29
 */
@RestController
@RequestMapping("/store/storeCanvas")
public class FsStoreCanvasController extends BaseController
{
    @Autowired
    private IFsStoreCanvasService fsStoreCanvasService;



    /**
     * 获取画布信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('store:storeCanvas:query')")
    @GetMapping(value = "/{terminal}")
    public AjaxResult getInfo(@PathVariable("terminal") Integer terminal)
    {

        return AjaxResult.success(fsStoreCanvasService.selectFsStoreCanvasByTerminal(terminal));
    }


    /**
     * 修改画布信息
     */
    @PreAuthorize("@ss.hasPermi('store:storeCanvas:edit')")
    @Log(title = "画布信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody FsStoreCanvas fsStoreCanvas)
    {
        return toAjax(fsStoreCanvasService.updateFsStoreCanvas(fsStoreCanvas));
    }


}
