From 1690d4d06b0c20b3606e50e0844ef67e07947a0d Mon Sep 17 00:00:00 2001 From: phpcjl <phpcjl@gmail.com> Date: 星期二, 10 十二月 2024 14:05:59 +0800 Subject: [PATCH] 1. --- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/SystemConfigController.java | 42 +++++++++++++++++++++++++++++++++++++++++- 1 files changed, 41 insertions(+), 1 deletions(-) diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/SystemConfigController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/SystemConfigController.java index e9de37f..21a404e 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/SystemConfigController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/SystemConfigController.java @@ -6,6 +6,7 @@ import com.ruoyi.common.core.domain.R; import com.ruoyi.other.api.domain.SystemConfig; import com.ruoyi.other.api.dto.IndexConfigSetDto; +import com.ruoyi.other.api.dto.StartPageSetDto; import com.ruoyi.other.service.SystemConfigService; import org.springframework.web.bind.annotation.*; import io.swagger.annotations.ApiOperation; @@ -38,7 +39,7 @@ systemConfigService.save(systemConfig); return R.ok(); } - @PostMapping("/index/detail") + @GetMapping("/index/detail") @ApiOperation(value = "宣传图片-公司简介", tags = {"后台-广告管理-首页配置","小程序-首页"}) public R<IndexConfigSetDto> detail(){ SystemConfig one = systemConfigService.lambdaQuery().eq(SystemConfig::getType, 2).one(); @@ -49,6 +50,45 @@ return R.ok(indexConfigSetDto); } + + + /** + * 根据类型获取系统配置 + * @param type + * @return + */ + @ResponseBody + @PostMapping("/getSystemConfig") + public R<SystemConfig> getSystemConfig(@RequestParam("type") Integer type){ + SystemConfig one = systemConfigService.lambdaQuery().eq(SystemConfig::getType, type).last("limit 1").one(); + return R.ok(one); + } + + @GetMapping("/index/start") + @ApiOperation(value = "宣传图片-公司简介", tags = {"小程序-启动页"}) + public R<StartPageSetDto> indexstart(){ + SystemConfig one = systemConfigService.lambdaQuery().eq(SystemConfig::getType, 1).one(); + if (one==null){ + return R.ok(); + } + StartPageSetDto indexConfigSetDto = JSONObject.parseObject(one.getContent(), StartPageSetDto.class); + return R.ok(indexConfigSetDto); + + } + + @PostMapping("/startPage/add") + @ApiOperation(value = "添加", tags = {"后台-广告管理-启动页管理"}) + public R startPageadd(@RequestBody StartPageSetDto startPageSetDto){ + //先删除type=1的数据 + List<SystemConfig> list = systemConfigService.lambdaQuery().eq(SystemConfig::getType, 1).list(); + systemConfigService.removeBatchByIds(list); + SystemConfig systemConfig = new SystemConfig(); + systemConfig.setType(1); + systemConfig.setContent(JSON.toJSONString(startPageSetDto)); + systemConfigService.save(systemConfig); + return R.ok(); + } + } -- Gitblit v1.7.1