From d2542a6123fa6834e01ed3af23c7ba0a02696bc6 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期五, 29 十一月 2024 16:37:02 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/SystemConfigController.java | 33 ++++++++++++++++++++++++++++----- 1 files changed, 28 insertions(+), 5 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 5ae1bc6..53ff538 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 @@ -1,14 +1,19 @@ package com.ruoyi.other.controller; +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONObject; 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.service.SystemConfigService; import org.springframework.web.bind.annotation.*; import io.swagger.annotations.Api; +import org.springframework.web.bind.annotation.*; import io.swagger.annotations.ApiOperation; import javax.annotation.Resource; +import java.util.List; /** * <p> @@ -23,11 +28,28 @@ public class SystemConfigController { @Resource private SystemConfigService systemConfigService; - @GetMapping("/byType") - @ApiOperation(value = "1=启动页管理,2=首页配置,3=订单包邮设置", tags = {"小程序-启动页面","小程序-首页","订单包邮配置"}) - public R<SystemConfig> byType(Integer type){ - SystemConfig one = systemConfigService.lambdaQuery().eq(SystemConfig::getType, type).last("limit 1").one(); - return R.ok(one); + @PostMapping("/index/add") + @ApiOperation(value = "添加", tags = {"后台-广告管理-首页配置"}) + public R add(@RequestBody IndexConfigSetDto indexConfigSetDto){ + //先删除type=2的数据 + List<SystemConfig> list = systemConfigService.lambdaQuery().eq(SystemConfig::getType, 2).list(); + systemConfigService.removeBatchByIds(list); + SystemConfig systemConfig = new SystemConfig(); + systemConfig.setType(2); + systemConfig.setContent(JSON.toJSONString(indexConfigSetDto)); + systemConfigService.save(systemConfig); + return R.ok(); + } + @PostMapping("/index/detail") + @ApiOperation(value = "宣传图片-公司简介", tags = {"后台-广告管理-首页配置","小程序-首页"}) + public R<IndexConfigSetDto> detail(){ + SystemConfig one = systemConfigService.lambdaQuery().eq(SystemConfig::getType, 2).one(); + if (one==null){ + return R.ok(); + } + IndexConfigSetDto indexConfigSetDto = JSONObject.parseObject(one.getContent(), IndexConfigSetDto.class); + return R.ok(indexConfigSetDto); + } @@ -42,5 +64,6 @@ SystemConfig one = systemConfigService.lambdaQuery().eq(SystemConfig::getType, type).last("limit 1").one(); return R.ok(one); } + } -- Gitblit v1.7.1