From d9602e8639bcd125b15faea5ca7f618429bcc50e Mon Sep 17 00:00:00 2001 From: Charles7c Date: Tue, 24 Sep 2024 22:33:21 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=AD=98=E5=82=A8=E6=97=B6=E5=90=8C=E6=97=B6=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E5=AD=98=E5=82=A8=E5=8F=8A=E5=90=AF=E7=94=A8?= =?UTF-8?q?=E5=88=A4=E6=96=AD=E9=A1=BA=E5=BA=8F=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/system/service/impl/StorageServiceImpl.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/continew-admin-system/src/main/java/top/continew/admin/system/service/impl/StorageServiceImpl.java b/continew-admin-system/src/main/java/top/continew/admin/system/service/impl/StorageServiceImpl.java index bf0022165..8af4d1fab 100644 --- a/continew-admin-system/src/main/java/top/continew/admin/system/service/impl/StorageServiceImpl.java +++ b/continew-admin-system/src/main/java/top/continew/admin/system/service/impl/StorageServiceImpl.java @@ -83,6 +83,11 @@ protected void beforeUpdate(StorageReq req, Long id) { .equals(newStatus), "[{}] 是默认存储,不允许禁用", oldStorage.getName()); this.decodeSecretKey(req, oldStorage); DisEnableStatusEnum oldStatus = oldStorage.getStatus(); + if (Boolean.TRUE.equals(req.getIsDefault())) { + CheckUtils.throwIf(this.isDefaultExists(id), "请先取消原有默认存储"); + CheckUtils.throwIf(!DisEnableStatusEnum.ENABLE.equals(oldStatus) && !DisEnableStatusEnum.ENABLE + .equals(newStatus), "请先启用该存储"); + } // 先卸载 if (DisEnableStatusEnum.ENABLE.equals(oldStatus)) { this.unload(BeanUtil.copyProperties(oldStorage, StorageReq.class)); @@ -91,10 +96,6 @@ protected void beforeUpdate(StorageReq req, Long id) { if (DisEnableStatusEnum.ENABLE.equals(newStatus)) { this.load(req); } - if (Boolean.TRUE.equals(req.getIsDefault())) { - CheckUtils.throwIf(!DisEnableStatusEnum.ENABLE.equals(oldStatus), "请先启用该存储"); - CheckUtils.throwIf(this.isDefaultExists(id), "请先取消原有默认存储"); - } } @Override