From 545f0bd4b0b2f84fb54c165bc551aa08ca9c073e Mon Sep 17 00:00:00 2001
From: 抓蛙师 <770492966@qq.com>
Date: 星期三, 25 八月 2021 20:24:35 +0800
Subject: [PATCH] saveAll支持有id则更新和无id则插入
---
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java
index d26de0a..13fdc67 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java
@@ -7,7 +7,6 @@
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
-import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.SysConfig;
import com.ruoyi.system.service.ISysConfigService;
@@ -16,11 +15,12 @@
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
+import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 鍙傛暟閰嶇疆 淇℃伅鎿嶄綔澶勭悊
- *
+ *
* @author ruoyi
*/
@RestController
@@ -43,11 +43,10 @@
@Log(title = "鍙傛暟绠$悊", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:config:export')")
@GetMapping("/export")
- public AjaxResult export(SysConfig config)
+ public void export(SysConfig config, HttpServletResponse response)
{
List<SysConfig> list = configService.selectConfigList(config);
- ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
- return util.exportExcel(list, "鍙傛暟鏁版嵁");
+ ExcelUtil.exportExcel(list, "鍙傛暟鏁版嵁", SysConfig.class, response);
}
/**
@@ -82,7 +81,7 @@
{
return AjaxResult.error("鏂板鍙傛暟'" + config.getConfigName() + "'澶辫触锛屽弬鏁伴敭鍚嶅凡瀛樺湪");
}
- config.setCreateBy(SecurityUtils.getUsername());
+ config.setCreateBy(getUsername());
return toAjax(configService.insertConfig(config));
}
@@ -98,7 +97,7 @@
{
return AjaxResult.error("淇敼鍙傛暟'" + config.getConfigName() + "'澶辫触锛屽弬鏁伴敭鍚嶅凡瀛樺湪");
}
- config.setUpdateBy(SecurityUtils.getUsername());
+ config.setUpdateBy(getUsername());
return toAjax(configService.updateConfig(config));
}
@@ -110,18 +109,19 @@
@DeleteMapping("/{configIds}")
public AjaxResult remove(@PathVariable Long[] configIds)
{
- return toAjax(configService.deleteConfigByIds(configIds));
+ configService.deleteConfigByIds(configIds);
+ return success();
}
/**
- * 娓呯┖缂撳瓨
+ * 鍒锋柊鍙傛暟缂撳瓨
*/
@PreAuthorize("@ss.hasPermi('system:config:remove')")
@Log(title = "鍙傛暟绠$悊", businessType = BusinessType.CLEAN)
- @DeleteMapping("/clearCache")
- public AjaxResult clearCache()
+ @DeleteMapping("/refreshCache")
+ public AjaxResult refreshCache()
{
- configService.clearCache();
+ configService.resetConfigCache();
return AjaxResult.success();
}
}
--
Gitblit v1.9.3