package com.ruoyi.web.controller.achievement;

import com.ruoyi.common.annotation.Anonymous;
import javax.servlet.http.HttpServletResponse;
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.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.SysAchievementOverview;
import com.ruoyi.system.service.ISysAchievementOverviewService;

@RestController
@RequestMapping("/achievement/overview")
public class SysAchievementOverviewController extends BaseController
{
    @Autowired
    private ISysAchievementOverviewService sysAchievementOverviewService;

    @Anonymous
    @GetMapping("/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(sysAchievementOverviewService.selectSysAchievementOverviewById(id));
    }

    @PreAuthorize("@ss.hasPermi('achievement:overview:edit')")
    @Log(title = "成果总体描述", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysAchievementOverview sysAchievementOverview)
    {
        return toAjax(sysAchievementOverviewService.updateSysAchievementOverview(sysAchievementOverview));
    }
}