liyong
3 天以前 4635770544e2d57416ad88a8983ee293919f5fec
src/main/java/com/ruoyi/project/system/controller/SysConfigController.java
@@ -1,12 +1,10 @@
package com.ruoyi.project.system.controller;
import java.util.List;
import com.ruoyi.framework.web.domain.R;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.system.domain.SysConfig;
import com.ruoyi.project.system.service.ISysConfigService;
@@ -16,9 +14,11 @@
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
 * 参数配置 信息操作处理
 *
 *
 * @author ruoyi
 */
@RestController
@@ -55,18 +55,18 @@
     */
    @PreAuthorize("@ss.hasPermi('system:config:query')")
    @GetMapping(value = "/{configId}")
    public R<?> getInfo(@PathVariable Long configId)
    public AjaxResult getInfo(@PathVariable Long configId)
    {
        return R.ok(configService.selectConfigById(configId));
        return success(configService.selectConfigById(configId));
    }
    /**
     * 根据参数键名查询参数值
     */
    @GetMapping(value = "/configKey/{configKey}")
    public R<?> getConfigKey(@PathVariable String configKey)
    public AjaxResult getConfigKey(@PathVariable String configKey)
    {
        return R.ok(configService.selectConfigByKey(configKey));
        return success(configService.selectConfigByKey(configKey));
    }
    /**
@@ -75,15 +75,14 @@
    @PreAuthorize("@ss.hasPermi('system:config:add')")
    @Log(title = "参数管理", businessType = BusinessType.INSERT)
    @PostMapping
    public R<?> add(@Validated @RequestBody SysConfig config)
    public AjaxResult add(@Validated @RequestBody SysConfig config)
    {
        if (!configService.checkConfigKeyUnique(config))
        {
            return R.fail("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
            return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
        }
        config.setCreateBy(getUsername());
        configService.insertConfig(config);
        return R.ok();
        return toAjax(configService.insertConfig(config));
    }
    /**
@@ -92,15 +91,14 @@
    @PreAuthorize("@ss.hasPermi('system:config:edit')")
    @Log(title = "参数管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public R<?> edit(@Validated @RequestBody SysConfig config)
    public AjaxResult edit(@Validated @RequestBody SysConfig config)
    {
        if (!configService.checkConfigKeyUnique(config))
        {
            return R.fail("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
            return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
        }
        config.setUpdateBy(getUsername());
        configService.updateConfig(config);
        return R.ok();
        return toAjax(configService.updateConfig(config));
    }
    /**
@@ -109,10 +107,10 @@
    @PreAuthorize("@ss.hasPermi('system:config:remove')")
    @Log(title = "参数管理", businessType = BusinessType.DELETE)
    @DeleteMapping("/{configIds}")
    public R<?> remove(@PathVariable Long[] configIds)
    public AjaxResult remove(@PathVariable Long[] configIds)
    {
        configService.deleteConfigByIds(configIds);
        return R.ok();
        return success();
    }
    /**
@@ -121,9 +119,9 @@
    @PreAuthorize("@ss.hasPermi('system:config:remove')")
    @Log(title = "参数管理", businessType = BusinessType.CLEAN)
    @DeleteMapping("/refreshCache")
    public R<?> refreshCache()
    public AjaxResult refreshCache()
    {
        configService.resetConfigCache();
        return R.ok();
        return success();
    }
}
}