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
package com.ruoyi.system.controller;
 
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.domain.CustomConfig;
import com.ruoyi.system.domain.dto.PointsConfigDTO;
import com.ruoyi.system.service.ICustomConfigService;
import io.swagger.annotations.ApiOperation;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
/**
 * <p>
 * 系统配置 前端控制器
 * </p>
 *
 * @author mitao
 * @since 2024-05-21
 */
@RestController
@RequestMapping("/custom-config")
public class CustomConfigController {
    @Resource
    private ICustomConfigService iCustomConfigService;
    @GetMapping(value = "/{configId}")
    public R<CustomConfig> getconfig(@PathVariable String configId)
    {
        LambdaQueryWrapper<CustomConfig> wrapper = Wrappers.lambdaQuery();
        wrapper.eq(CustomConfig::getConfigKey, configId);
        CustomConfig one = iCustomConfigService.getOne(wrapper);
        return R.ok(one);
    }
 
    /**
     * 保存积分设置
     *
     * @param dto 积分配置数据传输对象
     */
    @ApiOperation(value = "保存积分设置")
    @PostMapping("/save-points")
    public R<?> savePointsSettings(@Validated @RequestBody PointsConfigDTO dto) {
        iCustomConfigService.savePointsSettings(dto);
        return R.ok();
    }
}