|
@@ -1,11 +1,13 @@
|
|
|
package com.bizmatics.system.controller.web;
|
|
|
|
|
|
import com.bizmatics.common.core.bean.ApiResult;
|
|
|
+import com.bizmatics.common.core.bean.CommonPage;
|
|
|
import com.bizmatics.common.core.exception.BusinessErrorCode;
|
|
|
import com.bizmatics.model.SysConfig;
|
|
|
import com.bizmatics.service.ISysConfigService;
|
|
|
import com.bizmatics.service.constants.SystemConst;
|
|
|
import com.bizmatics.system.controller.BaseController;
|
|
|
+import com.google.protobuf.Api;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -17,26 +19,23 @@ import java.util.List;
|
|
|
*/
|
|
|
@RestController
|
|
|
@RequestMapping("/config")
|
|
|
-public class SysConfigController extends BaseController {
|
|
|
+public class SysConfigController {
|
|
|
@Autowired
|
|
|
private ISysConfigService configService;
|
|
|
|
|
|
/**
|
|
|
* 获取参数配置列表
|
|
|
*/
|
|
|
- @PreAuthorize("@ss.hasPermi('system:config:list')")
|
|
|
@GetMapping("/list")
|
|
|
- public TableDataInfo list(SysConfig config) {
|
|
|
- startPage();
|
|
|
- List<SysConfig> list = configService.selectConfigList(config);
|
|
|
- return getDataTable(list);
|
|
|
+ public ApiResult<List<SysConfig>> list(SysConfig config) {
|
|
|
+ return ApiResult.success(configService.selectConfigList(config));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据参数编号获取详细信息
|
|
|
*/
|
|
|
@GetMapping(value = "/{configId}")
|
|
|
- public ApiResult getInfo(@PathVariable Long configId) {
|
|
|
+ public ApiResult<SysConfig> getInfo(@PathVariable Long configId) {
|
|
|
return ApiResult.success(configService.selectConfigById(configId));
|
|
|
}
|
|
|
|
|
@@ -44,51 +43,46 @@ public class SysConfigController extends BaseController {
|
|
|
* 根据参数键名查询参数值
|
|
|
*/
|
|
|
@GetMapping(value = "/configKey/{configKey}")
|
|
|
- public ApiResult getConfigKey(@PathVariable String configKey) {
|
|
|
+ public ApiResult<String> getConfigKey(@PathVariable String configKey) {
|
|
|
return ApiResult.success(configService.selectConfigByKey(configKey));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 新增参数配置
|
|
|
*/
|
|
|
- @PreAuthorize("@ss.hasPermi('system:config:add')")
|
|
|
@PostMapping
|
|
|
- public ApiResult add(@Validated @RequestBody SysConfig config) {
|
|
|
+ public ApiResult<Integer> add(@Validated @RequestBody SysConfig config) {
|
|
|
if (SystemConst.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) {
|
|
|
return ApiResult.error(BusinessErrorCode.BIZ_BUSINESS_ERROR.getCode(), "新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
|
|
}
|
|
|
- config.setCreateBy(SecurityUtils.getUser().getName());
|
|
|
- return toAjax(configService.insertConfig(config));
|
|
|
+ return ApiResult.success(configService.insertConfig(config));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 修改参数配置
|
|
|
*/
|
|
|
- @PreAuthorize("@ss.hasPermi('system:config:edit')")
|
|
|
@PutMapping
|
|
|
- public ApiResult edit(@Validated @RequestBody SysConfig config) {
|
|
|
+ public ApiResult<Integer> edit(@Validated @RequestBody SysConfig config) {
|
|
|
if (SystemConst.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) {
|
|
|
return ApiResult.error(BusinessErrorCode.BIZ_BUSINESS_ERROR.getCode(), "修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
|
|
}
|
|
|
- config.setUpdateBy(SecurityUtils.getUser().getName());
|
|
|
- return toAjax(configService.updateConfig(config));
|
|
|
+
|
|
|
+ return ApiResult.success(configService.updateConfig(config));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 删除参数配置
|
|
|
*/
|
|
|
- @PreAuthorize("@ss.hasPermi('system:config:remove')")
|
|
|
@DeleteMapping("/{configIds}")
|
|
|
- public ApiResult remove(@PathVariable Long[] configIds) {
|
|
|
- return toAjax(configService.deleteConfigByIds(configIds));
|
|
|
+ public ApiResult<Integer> remove(@PathVariable Long[] configIds) {
|
|
|
+ return ApiResult.success(configService.deleteConfigByIds(configIds));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 清空缓存
|
|
|
*/
|
|
|
- @PreAuthorize("@ss.hasPermi('system:config:remove')")
|
|
|
@DeleteMapping("/clearCache")
|
|
|
- public ApiResult clearCache() {
|
|
|
+ public ApiResult<Void> clearCache() {
|
|
|
configService.clearCache();
|
|
|
return ApiResult.success();
|
|
|
}
|