|
@@ -1,13 +1,17 @@
|
|
|
-package cn.iocoder.yudao.adminserver.modules.infra.controller.config;
|
|
|
+package cn.iocoder.yudao.module.infra.controller.admin.config;
|
|
|
|
|
|
import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.config.InfConfigDO;
|
|
|
+import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
|
|
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
|
|
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
|
|
import cn.iocoder.yudao.adminserver.modules.infra.controller.config.vo.*;
|
|
|
-import cn.iocoder.yudao.adminserver.modules.infra.convert.config.InfConfigConvert;
|
|
|
-import cn.iocoder.yudao.adminserver.modules.infra.service.config.InfConfigService;
|
|
|
+import cn.iocoder.yudao.module.infra.controller.admin.config.vo.*;
|
|
|
+import cn.iocoder.yudao.module.infra.convert.config.InfConfigConvert;
|
|
|
+import cn.iocoder.yudao.module.infra.service.config.InfConfigService;
|
|
|
+import cn.iocoder.yudao.module.infra.controller.config.vo.*;
|
|
|
+import cn.iocoder.yudao.module.infra.enums.InfErrorCodeConstants;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
@@ -24,13 +28,12 @@ import java.util.List;
|
|
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
|
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
|
|
-import static cn.iocoder.yudao.adminserver.modules.infra.enums.InfErrorCodeConstants.CONFIG_GET_VALUE_ERROR_IF_SENSITIVE;
|
|
|
|
|
|
@Api(tags = "参数配置")
|
|
|
@RestController
|
|
|
@RequestMapping("/infra/config")
|
|
|
@Validated
|
|
|
-public class InfConfigController {
|
|
|
+public class ConfigController {
|
|
|
|
|
|
@Resource
|
|
|
private InfConfigService configService;
|
|
@@ -38,14 +41,14 @@ public class InfConfigController {
|
|
|
@PostMapping("/create")
|
|
|
@ApiOperation("创建参数配置")
|
|
|
@PreAuthorize("@ss.hasPermission('infra:config:create')")
|
|
|
- public CommonResult<Long> createConfig(@Valid @RequestBody InfConfigCreateReqVO reqVO) {
|
|
|
+ public CommonResult<Long> createConfig(@Valid @RequestBody ConfigCreateReqVO reqVO) {
|
|
|
return success(configService.createConfig(reqVO));
|
|
|
}
|
|
|
|
|
|
@PutMapping("/update")
|
|
|
@ApiOperation("修改参数配置")
|
|
|
@PreAuthorize("@ss.hasPermission('infra:config:update')")
|
|
|
- public CommonResult<Boolean> updateConfig(@Valid @RequestBody InfConfigUpdateReqVO reqVO) {
|
|
|
+ public CommonResult<Boolean> updateConfig(@Valid @RequestBody ConfigUpdateReqVO reqVO) {
|
|
|
configService.updateConfig(reqVO);
|
|
|
return success(true);
|
|
|
}
|
|
@@ -63,7 +66,7 @@ public class InfConfigController {
|
|
|
@ApiOperation("获得参数配置")
|
|
|
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
|
|
@PreAuthorize("@ss.hasPermission('infra:config:query')")
|
|
|
- public CommonResult<InfConfigRespVO> getConfig(@RequestParam("id") Long id) {
|
|
|
+ public CommonResult<ConfigRespVO> getConfig(@RequestParam("id") Long id) {
|
|
|
return success(InfConfigConvert.INSTANCE.convert(configService.getConfig(id)));
|
|
|
}
|
|
|
|
|
@@ -76,7 +79,7 @@ public class InfConfigController {
|
|
|
return null;
|
|
|
}
|
|
|
if (config.getSensitive()) {
|
|
|
- throw exception(CONFIG_GET_VALUE_ERROR_IF_SENSITIVE);
|
|
|
+ throw ServiceExceptionUtil.exception(InfErrorCodeConstants.CONFIG_GET_VALUE_ERROR_IF_SENSITIVE);
|
|
|
}
|
|
|
return success(config.getValue());
|
|
|
}
|
|
@@ -84,7 +87,7 @@ public class InfConfigController {
|
|
|
@GetMapping("/page")
|
|
|
@ApiOperation("获取参数配置分页")
|
|
|
@PreAuthorize("@ss.hasPermission('infra:config:query')")
|
|
|
- public CommonResult<PageResult<InfConfigRespVO>> getConfigPage(@Valid InfConfigPageReqVO reqVO) {
|
|
|
+ public CommonResult<PageResult<ConfigRespVO>> getConfigPage(@Valid ConfigPageReqVO reqVO) {
|
|
|
PageResult<InfConfigDO> page = configService.getConfigPage(reqVO);
|
|
|
return success(InfConfigConvert.INSTANCE.convertPage(page));
|
|
|
}
|
|
@@ -93,13 +96,13 @@ public class InfConfigController {
|
|
|
@ApiOperation("导出参数配置")
|
|
|
@PreAuthorize("@ss.hasPermission('infra:config:export')")
|
|
|
@OperateLog(type = EXPORT)
|
|
|
- public void exportSysConfig(@Valid InfConfigExportReqVO reqVO,
|
|
|
+ public void exportSysConfig(@Valid ConfigExportReqVO reqVO,
|
|
|
HttpServletResponse response) throws IOException {
|
|
|
List<InfConfigDO> list = configService.getConfigList(reqVO);
|
|
|
// 拼接数据
|
|
|
- List<InfConfigExcelVO> datas = InfConfigConvert.INSTANCE.convertList(list);
|
|
|
+ List<ConfigExcelVO> datas = InfConfigConvert.INSTANCE.convertList(list);
|
|
|
// 输出
|
|
|
- ExcelUtils.write(response, "参数配置.xls", "数据", InfConfigExcelVO.class, datas);
|
|
|
+ ExcelUtils.write(response, "参数配置.xls", "数据", ConfigExcelVO.class, datas);
|
|
|
}
|
|
|
|
|
|
}
|