From 5d7b65670282a4fad015e37d567cfa171b162052 Mon Sep 17 00:00:00 2001 From: huliguo <2023611923@qq.com> Date: 星期二, 20 五月 2025 12:25:19 +0800 Subject: [PATCH] 基础代码 --- pt-admin/src/main/java/com/ruoyi/web/controller/errand/SystemConfigController.java | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 57 insertions(+), 0 deletions(-) diff --git a/pt-admin/src/main/java/com/ruoyi/web/controller/errand/SystemConfigController.java b/pt-admin/src/main/java/com/ruoyi/web/controller/errand/SystemConfigController.java new file mode 100644 index 0000000..0f723e3 --- /dev/null +++ b/pt-admin/src/main/java/com/ruoyi/web/controller/errand/SystemConfigController.java @@ -0,0 +1,57 @@ +package com.ruoyi.web.controller.errand; + +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONObject; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.errand.constant.SystemConfigTypeConstant; +import com.ruoyi.errand.domain.SystemConfig; +import com.ruoyi.errand.object.dto.app.StartPageSetDto; +import com.ruoyi.errand.service.SystemConfigService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@Validated +@RestController +@RequestMapping(value = "/app/systemConfig") +@Api(value = "系统配置", tags = "系统配置操作控制器") +@Slf4j +public class SystemConfigController { + + @Autowired + private SystemConfigService systemConfigService; + + + @PostMapping("/startPage/add") + @PreAuthorize("@ss.hasPermi('system:agreement:list')") + @ApiOperation(value = "协议管理-启动页配置", tags = {"管理后台-系统管理"}) + public R<Void> startPageAdd(@RequestBody StartPageSetDto startPageSetDto){ + //先删除启动页的数据 + List<SystemConfig> list = systemConfigService.lambdaQuery().eq(SystemConfig::getType, SystemConfigTypeConstant.START_PAGE).list(); + systemConfigService.removeBatchByIds(list); + SystemConfig systemConfig = new SystemConfig(); + systemConfig.setType(SystemConfigTypeConstant.START_PAGE); + systemConfig.setContent(JSON.toJSONString(startPageSetDto)); + systemConfigService.save(systemConfig); + return R.ok(); + } + + + @GetMapping("/index/start") + @ApiOperation(value = "启动页-详情", tags = {"app用户端-启动页","管理后台-启动页配置"}) + public R<StartPageSetDto> indexStart(){ + SystemConfig one = systemConfigService.lambdaQuery().eq(SystemConfig::getType, SystemConfigTypeConstant.START_PAGE).one(); + if (one==null){ + return R.ok(); + } + StartPageSetDto indexConfigSetDto = JSONObject.parseObject(one.getContent(), StartPageSetDto.class); + return R.ok(indexConfigSetDto); + } + +} \ No newline at end of file -- Gitblit v1.7.1