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/BaseSettingController.java | 43 +++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 41 insertions(+), 2 deletions(-) diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/BaseSettingController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/BaseSettingController.java index 32ea9cf..15f82cf 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/BaseSettingController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/BaseSettingController.java @@ -1,8 +1,14 @@ package com.ruoyi.other.controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import com.alibaba.fastjson2.JSONObject; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.other.api.domain.BaseSetting; +import com.ruoyi.other.service.BaseSettingService; +import io.swagger.annotations.Api; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; /** * <p> @@ -14,7 +20,40 @@ */ @RestController @RequestMapping("/base-setting") +@Api("基础配置") public class BaseSettingController { + @Resource + private BaseSettingService baseSettingService; + + + /** + * 获取基础配置 + * @param id + * @return + */ + @ResponseBody + @PostMapping("/getBaseSetting") + public R<BaseSetting> getBaseSetting(@RequestParam("id") Integer id){ + BaseSetting baseSetting = baseSettingService.getById(id); + return R.ok(baseSetting); + } + + /** + * 保存设置 + */ + @PostMapping("/save") + public R saveActivityConfig(@RequestBody String json){ + JSONObject jsonObject = JSONObject.parseObject(json); + Integer id = jsonObject.getInteger("id"); + BaseSetting baseSetting = baseSettingService.getById(id); + baseSetting.setContent(jsonObject.getString("content")); + baseSettingService.saveOrUpdate(baseSetting); + return R.ok(); + } + + + + } -- Gitblit v1.7.1