From 2af534eea471f4adb104906c7a814bcc66d4d68d Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期一, 13 九月 2021 13:03:58 +0800 Subject: [PATCH] Merge branch 'master' of https://gitee.com/y_project/RuoYi-Vue into dev --- ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java | 46 +++++++++++++++++++--------------------------- 1 files changed, 19 insertions(+), 27 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 fb39a33..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 @@ -1,17 +1,5 @@ package com.ruoyi.web.controller.system; -import java.util.List; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.RepeatSubmit; import com.ruoyi.common.constant.UserConstants; @@ -19,14 +7,20 @@ 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; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +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,19 +37,16 @@ @GetMapping("/list") public TableDataInfo list(SysConfig config) { - startPage(); - List<SysConfig> list = configService.selectConfigList(config); - return getDataTable(list); + return configService.selectPageConfigList(config); } @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); } /** @@ -90,7 +81,7 @@ { return AjaxResult.error("鏂板鍙傛暟'" + config.getConfigName() + "'澶辫触锛屽弬鏁伴敭鍚嶅凡瀛樺湪"); } - config.setCreateBy(SecurityUtils.getUsername()); + config.setCreateBy(getUsername()); return toAjax(configService.insertConfig(config)); } @@ -106,7 +97,7 @@ { return AjaxResult.error("淇敼鍙傛暟'" + config.getConfigName() + "'澶辫触锛屽弬鏁伴敭鍚嶅凡瀛樺湪"); } - config.setUpdateBy(SecurityUtils.getUsername()); + config.setUpdateBy(getUsername()); return toAjax(configService.updateConfig(config)); } @@ -118,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