| | |
| | | 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;
|
| | |
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.validation.annotation.Validated;
|
| | | import org.springframework.web.bind.annotation.*;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | /**
|
| | | * 参数配置 信息操作处理
|
| | |
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:config:query')")
|
| | | @GetMapping(value = "/{configId}")
|
| | | public AjaxResult getInfo(@PathVariable Long configId)
|
| | | public R<?> getInfo(@PathVariable Long configId) |
| | | {
|
| | | return success(configService.selectConfigById(configId));
|
| | | return R.ok(configService.selectConfigById(configId)); |
| | | }
|
| | |
|
| | | /**
|
| | | * 根据参数键名查询参数值
|
| | | */
|
| | | @GetMapping(value = "/configKey/{configKey}")
|
| | | public AjaxResult getConfigKey(@PathVariable String configKey)
|
| | | public R<?> getConfigKey(@PathVariable String configKey) |
| | | {
|
| | | return success(configService.selectConfigByKey(configKey));
|
| | | return R.ok(configService.selectConfigByKey(configKey)); |
| | | }
|
| | |
|
| | | /**
|
| | |
| | | @PreAuthorize("@ss.hasPermi('system:config:add')")
|
| | | @Log(title = "参数管理", businessType = BusinessType.INSERT)
|
| | | @PostMapping
|
| | | public AjaxResult add(@Validated @RequestBody SysConfig config)
|
| | | public R<?> add(@Validated @RequestBody SysConfig config) |
| | | {
|
| | | if (!configService.checkConfigKeyUnique(config))
|
| | | {
|
| | | return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
| | | return R.fail("新增参数'" + config.getConfigName() + "'失败,参数键名已存在"); |
| | | }
|
| | | config.setCreateBy(getUsername());
|
| | | return toAjax(configService.insertConfig(config));
|
| | | configService.insertConfig(config); |
| | | return R.ok(); |
| | | }
|
| | |
|
| | | /**
|
| | |
| | | @PreAuthorize("@ss.hasPermi('system:config:edit')")
|
| | | @Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
| | | @PutMapping
|
| | | public AjaxResult edit(@Validated @RequestBody SysConfig config)
|
| | | public R<?> edit(@Validated @RequestBody SysConfig config) |
| | | {
|
| | | if (!configService.checkConfigKeyUnique(config))
|
| | | {
|
| | | return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
| | | return R.fail("修改参数'" + config.getConfigName() + "'失败,参数键名已存在"); |
| | | }
|
| | | config.setUpdateBy(getUsername());
|
| | | return toAjax(configService.updateConfig(config));
|
| | | configService.updateConfig(config); |
| | | return R.ok(); |
| | | }
|
| | |
|
| | | /**
|
| | |
| | | @PreAuthorize("@ss.hasPermi('system:config:remove')")
|
| | | @Log(title = "参数管理", businessType = BusinessType.DELETE)
|
| | | @DeleteMapping("/{configIds}")
|
| | | public AjaxResult remove(@PathVariable Long[] configIds)
|
| | | public R<?> remove(@PathVariable Long[] configIds) |
| | | {
|
| | | configService.deleteConfigByIds(configIds);
|
| | | return success();
|
| | | return R.ok(); |
| | | }
|
| | |
|
| | | /**
|
| | |
| | | @PreAuthorize("@ss.hasPermi('system:config:remove')")
|
| | | @Log(title = "参数管理", businessType = BusinessType.CLEAN)
|
| | | @DeleteMapping("/refreshCache")
|
| | | public AjaxResult refreshCache()
|
| | | public R<?> refreshCache() |
| | | {
|
| | | configService.resetConfigCache();
|
| | | return success();
|
| | | return R.ok(); |
| | | }
|
| | | }
|