package com.ruoyi.demo.controller;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.validate.EditGroup;
import com.ruoyi.demo.entity.SystemSetter;
import com.ruoyi.demo.entity.vo.SystemSetterVo;
import com.ruoyi.demo.service.SystemSetterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/system")
public class SystemSetterController {
    @Autowired
    SystemSetterService systemSetterService;

    @GetMapping("/getSystemSetter")
    public R getSystemSetter(){
        SystemSetter systemSetter = systemSetterService.getSystemSetter();
        System.out.println(systemSetter);
        return R.ok(systemSetter);
    }

    @PutMapping("/updateSystemSetter")
    public R updateSystemSetter(@RequestBody @Validated(value = {EditGroup.class}) SystemSetterVo systemSetterVo){
        systemSetterService.updateSystemSetter(systemSetterVo);
        return R.ok();
    }
}
