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 getByType( @ApiParam(name = "type", value = "配置类型:1=用户注册隐私协议,2=大礼包购买协议,3=实物商品购买协议,4=关于我们,5=积分规则,6=金币兑换图文说明,7=普通商品模块展示配置,8=实物商品展示", required = true) @PathVariable @NotNull(message = "配置类型不能为空") Integer type) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(THtmlConfig::getConfigType, type); THtmlConfig htmlConfig = htmlConfigService.getOne(queryWrapper); return R.ok(htmlConfig); } }