liujie
2025-12-17 865c5d54ca63ed7a5bda4a92d27ea0b7c6e61b04
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
package com.ruoyi.web.controller.api;
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.model.THtmlConfig;
import com.ruoyi.system.service.THtmlConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Lazy;
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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import javax.validation.constraints.NotNull;
 
/**
 * 协议、富文本配置相关接口
 *
 * @author mitao
 * @since 2025-12-16
 */
@Slf4j
@RestController
@RequestMapping("/html-config")
@Api(tags = "协议、富文本配置相关接口")
@Validated
@RequiredArgsConstructor(onConstructor_ = {@Lazy})
public class HtmlConfigController {
 
    private final THtmlConfigService htmlConfigService;
 
    /**
     * 根据类型获取富文本配置
     *
     * @param type 配置类型
     *             1=用户注册隐私协议
     *             2=大礼包购买协议
     *             3=实物商品购买协议
     *             4=关于我们
     *             5=积分规则
     *             6=金币兑换图文说明
     *             7=普通商品模块展示配置
     *             8=实物商品展示
     * @return 富文本配置信息
     */
    @ApiOperation(value = "根据类型获取富文本配置", response = THtmlConfig.class)
    @GetMapping("/{type}")
    public R<THtmlConfig> getByType(
            @ApiParam(name = "type", value = "配置类型:1=用户注册隐私协议,2=大礼包购买协议,3=实物商品购买协议,4=关于我们,5=积分规则,6=金币兑换图文说明,7=普通商品模块展示配置,8=实物商品展示", required = true)
            @PathVariable @NotNull(message = "配置类型不能为空") Integer type) {
        LambdaQueryWrapper<THtmlConfig> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(THtmlConfig::getConfigType, type);
        THtmlConfig htmlConfig = htmlConfigService.getOne(queryWrapper);
        return R.ok(htmlConfig);
    }
}