| | |
| | | |
| | | import cn.dev33.satoken.annotation.SaCheckPermission; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.annotation.RepeatSubmit; |
| | | import com.ruoyi.common.constant.UserConstants; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | |
| | | @ApiOperation("导出参数配置列表") |
| | | @Log(title = "参数管理", businessType = BusinessType.EXPORT) |
| | | @SaCheckPermission("system:config:export") |
| | | @GetMapping("/export") |
| | | @PostMapping("/export") |
| | | public void export(SysConfig config, HttpServletResponse response) { |
| | | List<SysConfig> list = configService.selectConfigList(config); |
| | | ExcelUtil.exportExcel(list, "参数数据", SysConfig.class, response); |
| | |
| | | @ApiOperation("根据参数编号获取详细信息") |
| | | @SaCheckPermission("system:config:query") |
| | | @GetMapping(value = "/{configId}") |
| | | public AjaxResult<SysConfig> getInfo(@PathVariable Long configId) { |
| | | public AjaxResult<SysConfig> getInfo(@ApiParam("参数ID") @PathVariable Long configId) { |
| | | return AjaxResult.success(configService.selectConfigById(configId)); |
| | | } |
| | | |
| | |
| | | */ |
| | | @ApiOperation("根据参数键名查询参数值") |
| | | @GetMapping(value = "/configKey/{configKey}") |
| | | public AjaxResult<Void> getConfigKey(@PathVariable String configKey) { |
| | | public AjaxResult<Void> getConfigKey(@ApiParam("参数Key") @PathVariable String configKey) { |
| | | return AjaxResult.success(configService.selectConfigByKey(configKey)); |
| | | } |
| | | |
| | |
| | | @SaCheckPermission("system:config:add") |
| | | @Log(title = "参数管理", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | @RepeatSubmit |
| | | public AjaxResult<Void> add(@Validated @RequestBody SysConfig config) { |
| | | if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) { |
| | | return AjaxResult.error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在"); |
| | |
| | | @SaCheckPermission("system:config:remove") |
| | | @Log(title = "参数管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{configIds}") |
| | | public AjaxResult<Void> remove(@PathVariable Long[] configIds) { |
| | | public AjaxResult<Void> remove(@ApiParam("参数ID串") @PathVariable Long[] configIds) { |
| | | configService.deleteConfigByIds(configIds); |
| | | return success(); |
| | | } |