From e08c0cc1f59dace1abfc7f0cd20cc5136d2b969f Mon Sep 17 00:00:00 2001 From: ruying408 <1877972603@qq.com> Date: Mon, 22 Jul 2024 23:45:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8F=92=E4=BB=B6=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/cool/core/plugin/service/CoolPluginService.java | 9 ++++++--- .../com/cool/modules/plugin/entity/PluginInfoEntity.java | 3 ++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/cool/core/plugin/service/CoolPluginService.java b/src/main/java/com/cool/core/plugin/service/CoolPluginService.java index 1595963..a0e4de4 100644 --- a/src/main/java/com/cool/core/plugin/service/CoolPluginService.java +++ b/src/main/java/com/cool/core/plugin/service/CoolPluginService.java @@ -249,17 +249,20 @@ public class CoolPluginService { public void updatePlugin(PluginInfoEntity entity) { PluginInfoEntity dbPluginInfoEntity = pluginInfoService.getPluginInfoEntityByIdNoJarFile( entity.getId()); - boolean updateConfig = false; + // 调用插件更新配置标识 + boolean invokePluginConfig = false; if (!MapExtUtil.compareMaps(entity.getConfig(), dbPluginInfoEntity.getConfig())) { // 不一致,说明更新了配置 + entity.setPluginJson(dbPluginInfoEntity.getPluginJson()); entity.getPluginJson().setConfig(entity.getConfig()); - updateConfig = true; + // 更新了配置, 且插件是开启状态 + invokePluginConfig = ObjUtil.equals(dbPluginInfoEntity.getStatus(), 1); } if (!ObjUtil.equals(entity.getStatus(), dbPluginInfoEntity.getStatus())) { // 更新状态 updateStatus(entity, dbPluginInfoEntity); } - if (updateConfig) { + if (invokePluginConfig) { // 更新配置 CoolPluginInvokers.setPluginJson(dbPluginInfoEntity.getKey(), entity); } diff --git a/src/main/java/com/cool/modules/plugin/entity/PluginInfoEntity.java b/src/main/java/com/cool/modules/plugin/entity/PluginInfoEntity.java index 5a9cbcb..e07c504 100644 --- a/src/main/java/com/cool/modules/plugin/entity/PluginInfoEntity.java +++ b/src/main/java/com/cool/modules/plugin/entity/PluginInfoEntity.java @@ -5,6 +5,7 @@ import com.cool.core.config.PluginJson; import com.mybatisflex.annotation.Column; import com.mybatisflex.annotation.Table; import com.mybatisflex.core.handler.Fastjson2TypeHandler; +import com.mybatisflex.core.handler.JacksonTypeHandler; import com.tangzc.autotable.annotation.Ignore; import com.tangzc.autotable.annotation.Index; import com.tangzc.mybatisflex.autotable.annotation.ColumnDefine; @@ -55,7 +56,7 @@ public class PluginInfoEntity extends BaseEntity { private byte[] jarFile; @ColumnDefine(comment = "配置", type = "json") - @Column(typeHandler = Fastjson2TypeHandler.class) + @Column(typeHandler = JacksonTypeHandler.class) private Map config; @Ignore