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();
|
}
|
|
|
|
}
|