优化插件更新配置
This commit is contained in:
@@ -249,17 +249,20 @@ public class CoolPluginService {
|
|||||||
public void updatePlugin(PluginInfoEntity entity) {
|
public void updatePlugin(PluginInfoEntity entity) {
|
||||||
PluginInfoEntity dbPluginInfoEntity = pluginInfoService.getPluginInfoEntityByIdNoJarFile(
|
PluginInfoEntity dbPluginInfoEntity = pluginInfoService.getPluginInfoEntityByIdNoJarFile(
|
||||||
entity.getId());
|
entity.getId());
|
||||||
boolean updateConfig = false;
|
// 调用插件更新配置标识
|
||||||
|
boolean invokePluginConfig = false;
|
||||||
if (!MapExtUtil.compareMaps(entity.getConfig(), dbPluginInfoEntity.getConfig())) {
|
if (!MapExtUtil.compareMaps(entity.getConfig(), dbPluginInfoEntity.getConfig())) {
|
||||||
// 不一致,说明更新了配置
|
// 不一致,说明更新了配置
|
||||||
|
entity.setPluginJson(dbPluginInfoEntity.getPluginJson());
|
||||||
entity.getPluginJson().setConfig(entity.getConfig());
|
entity.getPluginJson().setConfig(entity.getConfig());
|
||||||
updateConfig = true;
|
// 更新了配置, 且插件是开启状态
|
||||||
|
invokePluginConfig = ObjUtil.equals(dbPluginInfoEntity.getStatus(), 1);
|
||||||
}
|
}
|
||||||
if (!ObjUtil.equals(entity.getStatus(), dbPluginInfoEntity.getStatus())) {
|
if (!ObjUtil.equals(entity.getStatus(), dbPluginInfoEntity.getStatus())) {
|
||||||
// 更新状态
|
// 更新状态
|
||||||
updateStatus(entity, dbPluginInfoEntity);
|
updateStatus(entity, dbPluginInfoEntity);
|
||||||
}
|
}
|
||||||
if (updateConfig) {
|
if (invokePluginConfig) {
|
||||||
// 更新配置
|
// 更新配置
|
||||||
CoolPluginInvokers.setPluginJson(dbPluginInfoEntity.getKey(), entity);
|
CoolPluginInvokers.setPluginJson(dbPluginInfoEntity.getKey(), entity);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.cool.core.config.PluginJson;
|
|||||||
import com.mybatisflex.annotation.Column;
|
import com.mybatisflex.annotation.Column;
|
||||||
import com.mybatisflex.annotation.Table;
|
import com.mybatisflex.annotation.Table;
|
||||||
import com.mybatisflex.core.handler.Fastjson2TypeHandler;
|
import com.mybatisflex.core.handler.Fastjson2TypeHandler;
|
||||||
|
import com.mybatisflex.core.handler.JacksonTypeHandler;
|
||||||
import com.tangzc.autotable.annotation.Ignore;
|
import com.tangzc.autotable.annotation.Ignore;
|
||||||
import com.tangzc.autotable.annotation.Index;
|
import com.tangzc.autotable.annotation.Index;
|
||||||
import com.tangzc.mybatisflex.autotable.annotation.ColumnDefine;
|
import com.tangzc.mybatisflex.autotable.annotation.ColumnDefine;
|
||||||
@@ -55,7 +56,7 @@ public class PluginInfoEntity extends BaseEntity<PluginInfoEntity> {
|
|||||||
private byte[] jarFile;
|
private byte[] jarFile;
|
||||||
|
|
||||||
@ColumnDefine(comment = "配置", type = "json")
|
@ColumnDefine(comment = "配置", type = "json")
|
||||||
@Column(typeHandler = Fastjson2TypeHandler.class)
|
@Column(typeHandler = JacksonTypeHandler.class)
|
||||||
private Map<String, Object> config;
|
private Map<String, Object> config;
|
||||||
|
|
||||||
@Ignore
|
@Ignore
|
||||||
|
|||||||
Reference in New Issue
Block a user