From 8c3fe353be5d68f1ed252eef12f5fcdc0a1e3c83 Mon Sep 17 00:00:00 2001 From: Charles7c Date: Thu, 14 Nov 2024 20:41:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E9=85=8D=E7=BD=AE=E5=8F=82=E6=95=B0=E6=BC=8F?= =?UTF-8?q?=E6=B4=9E=20:boom:?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #96 --- .../system/enums/OptionCategoryEnum.java | 41 +++++++++++++++++++ .../admin/system/model/query/OptionQuery.java | 3 +- .../controller/common/CommonController.java | 12 +++--- 3 files changed, 49 insertions(+), 7 deletions(-) create mode 100644 continew-module-system/src/main/java/top/continew/admin/system/enums/OptionCategoryEnum.java diff --git a/continew-module-system/src/main/java/top/continew/admin/system/enums/OptionCategoryEnum.java b/continew-module-system/src/main/java/top/continew/admin/system/enums/OptionCategoryEnum.java new file mode 100644 index 00000000..b61db781 --- /dev/null +++ b/continew-module-system/src/main/java/top/continew/admin/system/enums/OptionCategoryEnum.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package top.continew.admin.system.enums; + +/** + * 参数类别枚举 + * + * @author Charles7c + * @since 2024/11/14 20:00 + */ +public enum OptionCategoryEnum { + + /** + * 系统配置 + */ + SITE, + + /** + * 密码配置 + */ + PASSWORD, + + /** + * 邮箱配置 + */ + MAIL, +} diff --git a/continew-module-system/src/main/java/top/continew/admin/system/model/query/OptionQuery.java b/continew-module-system/src/main/java/top/continew/admin/system/model/query/OptionQuery.java index 8a3d44a4..ecbfc85d 100644 --- a/continew-module-system/src/main/java/top/continew/admin/system/model/query/OptionQuery.java +++ b/continew-module-system/src/main/java/top/continew/admin/system/model/query/OptionQuery.java @@ -18,6 +18,7 @@ package top.continew.admin.system.model.query; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; +import top.continew.admin.system.enums.OptionCategoryEnum; import top.continew.starter.data.core.annotation.Query; import top.continew.starter.data.core.enums.QueryType; @@ -49,5 +50,5 @@ public class OptionQuery implements Serializable { * 类别 */ @Schema(description = "类别", example = "SITE") - private String category; + private OptionCategoryEnum category; } \ No newline at end of file diff --git a/continew-webapi/src/main/java/top/continew/admin/controller/common/CommonController.java b/continew-webapi/src/main/java/top/continew/admin/controller/common/CommonController.java index e14bca97..926db67f 100644 --- a/continew-webapi/src/main/java/top/continew/admin/controller/common/CommonController.java +++ b/continew-webapi/src/main/java/top/continew/admin/controller/common/CommonController.java @@ -24,7 +24,6 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.enums.ParameterIn; import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import lombok.RequiredArgsConstructor; import org.dromara.x.file.storage.core.FileInfo; @@ -32,6 +31,7 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import top.continew.admin.common.constant.CacheConstants; +import top.continew.admin.system.enums.OptionCategoryEnum; import top.continew.admin.system.model.query.*; import top.continew.admin.system.model.resp.FileUploadResp; import top.continew.admin.system.service.*; @@ -104,12 +104,12 @@ public class CommonController { } @SaIgnore - @Operation(summary = "查询参数字典", description = "查询参数字典") - @GetMapping("/dict/option") - @Cached(key = "#category", name = CacheConstants.OPTION_KEY_PREFIX) - public List> listOptionDict(@NotBlank(message = "类别不能为空") String category) { + @Operation(summary = "查询系统配置参数", description = "查询系统配置参数") + @GetMapping("/dict/option/site") + @Cached(key = "'SITE'", name = CacheConstants.OPTION_KEY_PREFIX) + public List> listSiteOptionDict() { OptionQuery optionQuery = new OptionQuery(); - optionQuery.setCategory(category); + optionQuery.setCategory(OptionCategoryEnum.SITE); return optionService.list(optionQuery) .stream() .map(option -> new LabelValueResp<>(option.getCode(), StrUtil.nullToDefault(option.getValue(), option