phpcjl
2024-12-11 289dd88443b08fbdada0724d032f75c7fec0a6cf
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.*;
@@ -89,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);
    }
}