huliguo
2025-05-27 6fdcd27ed40ff4c317f0d73c6c8ca8123914f8fe
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package com.ruoyi.web.controller.system;
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.domain.Agreement;
import com.ruoyi.system.pojo.dto.AddSystemConfigDTO;
import com.ruoyi.system.pojo.vo.AddAgreementDTO;
import com.ruoyi.system.pojo.vo.SystemConfigVO;
import com.ruoyi.system.service.AgreementService;
import com.ruoyi.system.service.SystemConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
import javax.validation.Valid;
 
 
@Slf4j
@RestController
@RequestMapping("/system/systemConfig")
@Api( tags = "后台-系统设置")
public class SystemConfigController {
 
    @Resource
    private SystemConfigService systemConfigService;
 
    @Resource
    private AgreementService agreementService;
 
 
    /**
     * 系统配置-查看
     */
    @GetMapping("/getSystemConfigByType")
    @ApiOperation(value = "根据类型获取配置内容")
    public R<SystemConfigVO> getSystemConfigByType(@RequestParam(value = "type") Integer type) {
        return R.ok(systemConfigService.getSystemConfigByType(type));
    }
 
    /**
     * 系统配置-修改
     */
    @PostMapping("/setSystemConfig")
    @ApiOperation(value = "根据类型配置内容")
    public R<Void> setSystemConfig(@RequestBody @Valid AddSystemConfigDTO addSystemConfigDTO) {
        systemConfigService.setSystemConfig(addSystemConfigDTO);
        return R.ok();
    }
 
    /**
     * 协议管理-查看 协议类型(1=用户协议,2=隐私协议,,3=下单须知,4=关于我们,5=注销协议)
     */
    @GetMapping("/getAgreementByType")
    @ApiOperation(value = "根据类型获取协议内容")
    public R<Agreement> getAgreementByType(@RequestParam(value = "type") Integer type) {
        Agreement agreement = agreementService.getOne(new LambdaQueryWrapper<Agreement>().eq(Agreement::getType, type));
        return R.ok(agreement);
    }
 
    /**
     * 协议管理-修改  协议类型(1=用户协议,2=隐私协议,,3=下单须知,4=关于我们,5=注销协议)
     */
    @PostMapping("/setAgreement")
    @ApiOperation(value = "根据类型设置协议")
    public R<Void> setAgreement(@RequestBody @Valid AddAgreementDTO addAgreementDTO) {
        agreementService.setAgreement(addAgreementDTO);
        return R.ok();
    }
 
 
 
}