package com.ruoyi.web.controller.aboutSts;

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.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.SysAboutSts;
import com.ruoyi.system.service.ISysAboutStsService;

@RestController
@RequestMapping("/aboutSts")
public class SysAboutStsController extends BaseController
{
    @Autowired
    private ISysAboutStsService sysAboutStsService;

    @PreAuthorize("@ss.hasPermi('aboutSts:edit')")
    @GetMapping("/list")
    public AjaxResult list()
    {
        List<SysAboutSts> list = sysAboutStsService.selectSysAboutStsList();
        return success(list);
    }

    @PreAuthorize("@ss.hasPermi('aboutSts:edit')")
    @GetMapping("/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(sysAboutStsService.selectSysAboutStsById(id));
    }

    @PreAuthorize("@ss.hasPermi('aboutSts:edit')")
    @Log(title = "关于STS", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysAboutSts sysAboutSts)
    {
        return toAjax(sysAboutStsService.insertSysAboutSts(sysAboutSts));
    }

    @PreAuthorize("@ss.hasPermi('aboutSts:edit')")
    @Log(title = "关于STS", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysAboutSts sysAboutSts)
    {
        return toAjax(sysAboutStsService.updateSysAboutSts(sysAboutSts));
    }

    @PreAuthorize("@ss.hasPermi('aboutSts:edit')")
    @Log(title = "关于STS", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(sysAboutStsService.deleteSysAboutStsByIds(ids));
    }
}
