|
@@ -1,6 +1,7 @@
|
|
package com.ruoyi.web.controller.system;
|
|
package com.ruoyi.web.controller.system;
|
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
@@ -26,13 +27,13 @@ import com.ruoyi.system.service.ISysConfigService;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 参数配置 信息操作处理
|
|
* 参数配置 信息操作处理
|
|
- *
|
|
|
|
|
|
+ *
|
|
* @author ruoyi
|
|
* @author ruoyi
|
|
*/
|
|
*/
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping("/system/config")
|
|
@RequestMapping("/system/config")
|
|
-public class SysConfigController extends BaseController
|
|
|
|
-{
|
|
|
|
|
|
+public class SysConfigController extends BaseController {
|
|
|
|
+
|
|
@Autowired
|
|
@Autowired
|
|
private ISysConfigService configService;
|
|
private ISysConfigService configService;
|
|
|
|
|
|
@@ -41,8 +42,7 @@ public class SysConfigController extends BaseController
|
|
*/
|
|
*/
|
|
@PreAuthorize("@ss.hasPermi('system:config:list')")
|
|
@PreAuthorize("@ss.hasPermi('system:config:list')")
|
|
@GetMapping("/list")
|
|
@GetMapping("/list")
|
|
- public TableDataInfo list(SysConfig config)
|
|
|
|
- {
|
|
|
|
|
|
+ public TableDataInfo list(SysConfig config) {
|
|
startPage();
|
|
startPage();
|
|
List<SysConfig> list = configService.selectConfigList(config);
|
|
List<SysConfig> list = configService.selectConfigList(config);
|
|
return getDataTable(list);
|
|
return getDataTable(list);
|
|
@@ -51,8 +51,7 @@ public class SysConfigController extends BaseController
|
|
@Log(title = "参数管理", businessType = BusinessType.EXPORT)
|
|
@Log(title = "参数管理", businessType = BusinessType.EXPORT)
|
|
@PreAuthorize("@ss.hasPermi('system:config:export')")
|
|
@PreAuthorize("@ss.hasPermi('system:config:export')")
|
|
@GetMapping("/export")
|
|
@GetMapping("/export")
|
|
- public AjaxResult export(SysConfig config)
|
|
|
|
- {
|
|
|
|
|
|
+ public AjaxResult export(SysConfig config) {
|
|
List<SysConfig> list = configService.selectConfigList(config);
|
|
List<SysConfig> list = configService.selectConfigList(config);
|
|
ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
|
|
ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
|
|
return util.exportExcel(list, "参数数据");
|
|
return util.exportExcel(list, "参数数据");
|
|
@@ -63,8 +62,7 @@ public class SysConfigController extends BaseController
|
|
*/
|
|
*/
|
|
@PreAuthorize("@ss.hasPermi('system:config:query')")
|
|
@PreAuthorize("@ss.hasPermi('system:config:query')")
|
|
@GetMapping(value = "/{configId}")
|
|
@GetMapping(value = "/{configId}")
|
|
- public AjaxResult getInfo(@PathVariable Long configId)
|
|
|
|
- {
|
|
|
|
|
|
+ public AjaxResult getInfo(@PathVariable Long configId) {
|
|
return AjaxResult.success(configService.selectConfigById(configId));
|
|
return AjaxResult.success(configService.selectConfigById(configId));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -72,8 +70,7 @@ public class SysConfigController extends BaseController
|
|
* 根据参数键名查询参数值
|
|
* 根据参数键名查询参数值
|
|
*/
|
|
*/
|
|
@GetMapping(value = "/configKey/{configKey}")
|
|
@GetMapping(value = "/configKey/{configKey}")
|
|
- public AjaxResult getConfigKey(@PathVariable String configKey)
|
|
|
|
- {
|
|
|
|
|
|
+ public AjaxResult getConfigKey(@PathVariable String configKey) {
|
|
return AjaxResult.success(configService.selectConfigByKey(configKey));
|
|
return AjaxResult.success(configService.selectConfigByKey(configKey));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -84,10 +81,8 @@ public class SysConfigController extends BaseController
|
|
@Log(title = "参数管理", businessType = BusinessType.INSERT)
|
|
@Log(title = "参数管理", businessType = BusinessType.INSERT)
|
|
@PostMapping
|
|
@PostMapping
|
|
@RepeatSubmit
|
|
@RepeatSubmit
|
|
- public AjaxResult add(@Validated @RequestBody SysConfig config)
|
|
|
|
- {
|
|
|
|
- if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
|
|
|
|
- {
|
|
|
|
|
|
+ public AjaxResult add(@Validated @RequestBody SysConfig config) {
|
|
|
|
+ if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) {
|
|
return AjaxResult.error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
|
return AjaxResult.error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
|
}
|
|
}
|
|
config.setCreateBy(SecurityUtils.getUsername());
|
|
config.setCreateBy(SecurityUtils.getUsername());
|
|
@@ -100,10 +95,8 @@ public class SysConfigController extends BaseController
|
|
@PreAuthorize("@ss.hasPermi('system:config:edit')")
|
|
@PreAuthorize("@ss.hasPermi('system:config:edit')")
|
|
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
|
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
|
@PutMapping
|
|
@PutMapping
|
|
- public AjaxResult edit(@Validated @RequestBody SysConfig config)
|
|
|
|
- {
|
|
|
|
- if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
|
|
|
|
- {
|
|
|
|
|
|
+ public AjaxResult edit(@Validated @RequestBody SysConfig config) {
|
|
|
|
+ if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) {
|
|
return AjaxResult.error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
|
return AjaxResult.error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
|
}
|
|
}
|
|
config.setUpdateBy(SecurityUtils.getUsername());
|
|
config.setUpdateBy(SecurityUtils.getUsername());
|
|
@@ -116,20 +109,8 @@ public class SysConfigController extends BaseController
|
|
@PreAuthorize("@ss.hasPermi('system:config:remove')")
|
|
@PreAuthorize("@ss.hasPermi('system:config:remove')")
|
|
@Log(title = "参数管理", businessType = BusinessType.DELETE)
|
|
@Log(title = "参数管理", businessType = BusinessType.DELETE)
|
|
@DeleteMapping("/{configIds}")
|
|
@DeleteMapping("/{configIds}")
|
|
- public AjaxResult remove(@PathVariable Long[] configIds)
|
|
|
|
- {
|
|
|
|
|
|
+ public AjaxResult remove(@PathVariable Long[] configIds) {
|
|
return toAjax(configService.deleteConfigByIds(configIds));
|
|
return toAjax(configService.deleteConfigByIds(configIds));
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * 清空缓存
|
|
|
|
- */
|
|
|
|
- @PreAuthorize("@ss.hasPermi('system:config:remove')")
|
|
|
|
- @Log(title = "参数管理", businessType = BusinessType.CLEAN)
|
|
|
|
- @DeleteMapping("/clearCache")
|
|
|
|
- public AjaxResult clearCache()
|
|
|
|
- {
|
|
|
|
- configService.clearCache();
|
|
|
|
- return AjaxResult.success();
|
|
|
|
- }
|
|
|
|
}
|
|
}
|