From 304df7b69295d46dc2bace2a50920dd836873202 Mon Sep 17 00:00:00 2001 From: Hamm Date: Thu, 23 May 2024 13:16:36 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix(Bug):=20=E4=BC=98=E5=8C=96=E4=BA=86?= =?UTF-8?q?=E4=B8=80=E4=BA=9B=E5=B7=B2=E7=9F=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cn/hamm/airpower/root/RootService.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/airpower-core/src/main/java/cn/hamm/airpower/root/RootService.java b/airpower-core/src/main/java/cn/hamm/airpower/root/RootService.java index 50f1aa1..2ea0162 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/root/RootService.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/root/RootService.java @@ -518,13 +518,12 @@ public class RootService, R extends RootRepository> i MessageConstant.MISSING_ID_WHEN_QUERY, Utils.getReflectUtil().getDescription(getEntityClass()) )); - Optional optional = repository.findById(id); - if (optional.isPresent()) { - return optional.get(); - } - throw new ServiceException(ServiceError.DATA_NOT_FOUND, String.format( - MessageConstant.QUERY_DATA_NOT_FOUND, id, Utils.getReflectUtil().getDescription(getEntityClass()) - )); + return repository.findById(id).orElseThrow( + () -> new ServiceException(ServiceError.DATA_NOT_FOUND, String.format( + MessageConstant.QUERY_DATA_NOT_FOUND, + id, Utils.getReflectUtil().getDescription(getEntityClass())) + ) + ); } /** -- Gitee From 62b16ce34051616a31af56e17d3f1826533a6b20 Mon Sep 17 00:00:00 2001 From: Hamm Date: Thu, 23 May 2024 13:59:32 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix(Bug):=20=E4=BC=98=E5=8C=96=E4=BA=86?= =?UTF-8?q?=E4=B8=80=E4=BA=9B=E5=B7=B2=E7=9F=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/cn/hamm/airpower/util/AccessUtil.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/airpower-core/src/main/java/cn/hamm/airpower/util/AccessUtil.java b/airpower-core/src/main/java/cn/hamm/airpower/util/AccessUtil.java index 6478631..9d6f0cf 100644 --- a/airpower-core/src/main/java/cn/hamm/airpower/util/AccessUtil.java +++ b/airpower-core/src/main/java/cn/hamm/airpower/util/AccessUtil.java @@ -85,6 +85,18 @@ public class AccessUtil { method.getName(); } + /** + *

扫描并返回权限列表

+ * + * @param clazz 入口类 + * @param permissionClass 权限类 + * @param

权限类型 + * @return 权限列表 + */ + public final

> @NotNull List

scanPermission(@NotNull Class clazz, Class

permissionClass) { + return scanPermission(clazz.getPackageName(), permissionClass); + } + /** *

扫描并返回权限列表

* -- Gitee