From a8d2cb07f6440dc54dc4005b0b06d5a47cb1517d Mon Sep 17 00:00:00 2001
From: luodangjia <luodangjia>
Date: 星期一, 16 十二月 2024 13:34:03 +0800
Subject: [PATCH] 12.16

---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/SystemConfigController.java |   53 ++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 48 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 21dd4a3..b050e55 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.LogisticsSetDto;
 import com.ruoyi.other.api.dto.StartPageSetDto;
 import com.ruoyi.other.service.SystemConfigService;
 import org.springframework.web.bind.annotation.*;
@@ -28,7 +29,7 @@
     @Resource
     private SystemConfigService systemConfigService;
     @PostMapping("/index/add")
-	@ApiOperation(value = "添加", tags = {"后台-广告管理-首页配置"})
+	@ApiOperation(value = "广告管理-首页配置-添加", tags = {"管理后台"})
 	public R add(@RequestBody IndexConfigSetDto indexConfigSetDto){
         //先删除type=2的数据
         List<SystemConfig> list = systemConfigService.lambdaQuery().eq(SystemConfig::getType, 2).list();
@@ -39,8 +40,8 @@
         systemConfigService.save(systemConfig);
         return R.ok();
       }
-    @PostMapping("/index/detail")
-	@ApiOperation(value = "宣传图片-公司简介", tags = {"后台-广告管理-首页配置","小程序-首页"})
+    @GetMapping("/index/detail")
+	@ApiOperation(value = "广告管理-首页配置-宣传图片-公司简介", tags = {"管理后台","小程序-首页"})
 	public R<IndexConfigSetDto> detail(){
         SystemConfig one = systemConfigService.lambdaQuery().eq(SystemConfig::getType, 2).one();
         if (one==null){
@@ -50,8 +51,21 @@
         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);
+	}
 
-    @PostMapping("/index/start")
+    @GetMapping("/index/start")
     @ApiOperation(value = "宣传图片-公司简介", tags = {"小程序-启动页"})
     public R<StartPageSetDto> indexstart(){
         SystemConfig one = systemConfigService.lambdaQuery().eq(SystemConfig::getType, 1).one();
@@ -64,7 +78,7 @@
     }
 
     @PostMapping("/startPage/add")
-    @ApiOperation(value = "添加", tags = {"后台-广告管理-启动页管理"})
+    @ApiOperation(value = "广告管理-启动页管理-添加", tags = {"管理后台"})
     public R startPageadd(@RequestBody StartPageSetDto startPageSetDto){
         //先删除type=1的数据
         List<SystemConfig> list = systemConfigService.lambdaQuery().eq(SystemConfig::getType, 1).list();
@@ -76,6 +90,35 @@
         return R.ok();
     }
 
+    /**
+     * 订单包邮设置
+     */
+    @PostMapping("/logistics/add")
+    @ApiOperation(value = "添加", tags = {"管理后台-商品管理-订单包邮设置"})
+    public R add(@RequestBody LogisticsSetDto logisticsSetDto){
+        List<SystemConfig> list = systemConfigService.lambdaQuery().eq(SystemConfig::getType, 3).list();
+        systemConfigService.removeBatchByIds(list);
+        SystemConfig  systemConfig = new SystemConfig();
+        systemConfig.setType(3);
+        systemConfig.setContent(JSON.toJSONString(logisticsSetDto));
+        systemConfigService.save(systemConfig);
+        return R.ok();
+    }
+
+    /**
+     * 获取订单包邮设置
+     */
+    @GetMapping("/logistics/detail")
+    @ApiOperation(value = "订单包邮设置", tags = {"管理后台-商品管理-订单包邮设置"})
+    public R<LogisticsSetDto> logisticsDetail(){
+        SystemConfig one = systemConfigService.lambdaQuery().eq(SystemConfig::getType, 3).one();
+        if (one==null){
+            return R.ok();
+        }
+        LogisticsSetDto logisticsSetDto = JSONObject.parseObject(one.getContent(), LogisticsSetDto.class);
+        return R.ok(logisticsSetDto);
+    }
+
 
 }
 

--
Gitblit v1.7.1