|
@@ -0,0 +1,125 @@
|
|
|
+package com.simuwang.manage.api.system;
|
|
|
+
|
|
|
+import com.simuwang.base.common.page.TableDataInfo;
|
|
|
+import com.simuwang.base.common.result.AjaxResult;
|
|
|
+import com.simuwang.base.pojo.vo.SysConfigVO;
|
|
|
+import com.simuwang.manage.api.base.BaseController;
|
|
|
+import com.simuwang.manage.service.system.SysConfigService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Controller;
|
|
|
+import org.springframework.ui.ModelMap;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 参数配置 信息操作处理
|
|
|
+ *
|
|
|
+ * @author ruoyi
|
|
|
+ */
|
|
|
+@Controller
|
|
|
+@RequestMapping("/system/config")
|
|
|
+public class SysConfigController extends BaseController
|
|
|
+{
|
|
|
+ private String prefix = "system/config";
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private SysConfigService configService;
|
|
|
+
|
|
|
+ @GetMapping()
|
|
|
+ public String config()
|
|
|
+ {
|
|
|
+ return prefix + "/config";
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询参数配置列表
|
|
|
+ */
|
|
|
+ @PostMapping("/list")
|
|
|
+ @ResponseBody
|
|
|
+ public TableDataInfo list(SysConfigVO config)
|
|
|
+ {
|
|
|
+ startPage();
|
|
|
+ List<SysConfigVO> list = configService.selectConfigList(config);
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 新增参数配置
|
|
|
+ */
|
|
|
+ @GetMapping("/add")
|
|
|
+ public String add()
|
|
|
+ {
|
|
|
+ return prefix + "/add";
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增保存参数配置
|
|
|
+ */
|
|
|
+ @PostMapping("/add")
|
|
|
+ @ResponseBody
|
|
|
+ public AjaxResult addSave(@Validated SysConfigVO config)
|
|
|
+ {
|
|
|
+ if (!configService.checkConfigKeyUnique(config))
|
|
|
+ {
|
|
|
+ return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
|
|
+ }
|
|
|
+ return toAjax(configService.insertConfig(config));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改参数配置
|
|
|
+ */
|
|
|
+ @GetMapping("/edit/{configId}")
|
|
|
+ public String edit(@PathVariable("configId") Long configId, ModelMap mmap)
|
|
|
+ {
|
|
|
+ mmap.put("config", configService.selectConfigById(configId));
|
|
|
+ return prefix + "/edit";
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改保存参数配置
|
|
|
+ */
|
|
|
+ @PostMapping("/edit")
|
|
|
+ @ResponseBody
|
|
|
+ public AjaxResult editSave(@Validated SysConfigVO config)
|
|
|
+ {
|
|
|
+ if (!configService.checkConfigKeyUnique(config))
|
|
|
+ {
|
|
|
+ return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
|
|
+ }
|
|
|
+ return toAjax(configService.updateConfig(config));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除参数配置
|
|
|
+ */
|
|
|
+ @PostMapping("/remove")
|
|
|
+ @ResponseBody
|
|
|
+ public AjaxResult remove(String ids)
|
|
|
+ {
|
|
|
+ configService.deleteConfigByIds(ids);
|
|
|
+ return success();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 刷新参数缓存
|
|
|
+ */
|
|
|
+ @GetMapping("/refreshCache")
|
|
|
+ @ResponseBody
|
|
|
+ public AjaxResult refreshCache()
|
|
|
+ {
|
|
|
+ configService.resetConfigCache();
|
|
|
+ return success();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 校验参数键名
|
|
|
+ */
|
|
|
+ @PostMapping("/checkConfigKeyUnique")
|
|
|
+ @ResponseBody
|
|
|
+ public boolean checkConfigKeyUnique(SysConfigVO config)
|
|
|
+ {
|
|
|
+ return configService.checkConfigKeyUnique(config);
|
|
|
+ }
|
|
|
+}
|