phpcjl
2024-12-11 289dd88443b08fbdada0724d032f75c7fec0a6cf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package com.ruoyi.other.controller;
 
 
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.other.api.domain.BaseSetting;
import com.ruoyi.other.service.BaseSettingService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
 
/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author luodangjia
 * @since 2024-11-20
 */
@RestController
@RequestMapping("/base-setting")
@Api("基础配置")
public class BaseSettingController {
 
    @Resource
    private BaseSettingService baseSettingService;
    
    
    /**
     * 获取基础配置
     * @param id
     * @return
     */
    @ResponseBody
    @PostMapping("/getBaseSetting")
    public R<BaseSetting> getBaseSetting(@RequestParam("id") Integer id){
        BaseSetting baseSetting = baseSettingService.getById(id);
        return R.ok(baseSetting);
    }
 
    /**
     * 保存设置
     */
    @PostMapping("/save")
    public R saveActivityConfig(@RequestBody String json){
        JSONObject jsonObject = JSONObject.parseObject(json);
        Integer id = jsonObject.getInteger("id");
        BaseSetting baseSetting = baseSettingService.getById(id);
        baseSetting.setContent(jsonObject.getString("content"));
        baseSettingService.saveOrUpdate(baseSetting);
        return R.ok();
    }
    
    
    
    
}