mirror of
https://github.com/cool-team-official/cool-admin-java.git
synced 2026-10-07 15:47:54 +08:00
插件依赖类使用异步方式加载,解决主流程加载慢问题
This commit is contained in:
+5
-1
@@ -9,6 +9,7 @@ import com.cool.core.annotation.IgnoreRecycleData;
|
||||
import com.cool.core.base.BaseController;
|
||||
import com.cool.core.plugin.service.CoolPluginService;
|
||||
import com.cool.core.request.R;
|
||||
import com.cool.core.util.EntityUtils;
|
||||
import com.cool.modules.plugin.entity.PluginInfoEntity;
|
||||
import com.cool.modules.plugin.service.PluginInfoService;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
@@ -34,8 +35,11 @@ public class AdminPluginInfoController extends BaseController<PluginInfoService,
|
||||
|
||||
@Override
|
||||
protected void init(HttpServletRequest request, JSONObject requestParams) {
|
||||
|
||||
setPageOption(createOp().queryWrapper(
|
||||
QueryWrapper.create().orderBy(PLUGIN_INFO_ENTITY.UPDATE_TIME, false)));
|
||||
QueryWrapper.create().orderBy(PLUGIN_INFO_ENTITY.UPDATE_TIME, false))
|
||||
.select(EntityUtils.getFieldNamesWithSuperClass(PLUGIN_INFO_ENTITY.DEFAULT_COLUMNS,
|
||||
PLUGIN_INFO_ENTITY.JAR_FILE.getName())));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -52,7 +52,7 @@ public class PluginInfoEntity extends BaseEntity<PluginInfoEntity> {
|
||||
@Column(typeHandler = Fastjson2TypeHandler.class)
|
||||
private PluginJson pluginJson;
|
||||
|
||||
@ColumnDefine(comment = "jar二进制文件-废弃", type = "longblob")
|
||||
@ColumnDefine(comment = "jar二进制文件(可配置是否入库)", type = "longblob")
|
||||
private byte[] jarFile;
|
||||
|
||||
@ColumnDefine(comment = "配置", type = "json")
|
||||
|
||||
@@ -7,4 +7,6 @@ public interface PluginInfoService extends BaseService<PluginInfoEntity> {
|
||||
PluginInfoEntity getByKey(String key);
|
||||
|
||||
PluginInfoEntity getPluginInfoEntityByHook(String hook);
|
||||
|
||||
PluginInfoEntity getPluginInfoEntityById(Long id);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.cool.modules.plugin.service.impl;
|
||||
import static com.cool.modules.plugin.entity.table.PluginInfoEntityTableDef.PLUGIN_INFO_ENTITY;
|
||||
|
||||
import com.cool.core.base.BaseServiceImpl;
|
||||
import com.cool.core.util.EntityUtils;
|
||||
import com.cool.modules.plugin.entity.PluginInfoEntity;
|
||||
import com.cool.modules.plugin.mapper.PluginInfoMapper;
|
||||
import com.cool.modules.plugin.service.PluginInfoService;
|
||||
@@ -31,8 +32,24 @@ public class PluginInfoServiceImpl extends BaseServiceImpl<PluginInfoMapper, Plu
|
||||
*/
|
||||
@Override
|
||||
public PluginInfoEntity getPluginInfoEntityByHook(String hook) {
|
||||
QueryWrapper queryWrapper = QueryWrapper.create().and(PLUGIN_INFO_ENTITY.HOOK.eq(hook))
|
||||
QueryWrapper queryWrapper = getPluginInfoEntityQueryWrapper().and(PLUGIN_INFO_ENTITY.HOOK.eq(hook))
|
||||
.and(PLUGIN_INFO_ENTITY.STATUS.eq(1)).limit(1);
|
||||
return getOne(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id获取插件信息,不带jar二进制
|
||||
*/
|
||||
@Override
|
||||
public PluginInfoEntity getPluginInfoEntityById(Long id) {
|
||||
QueryWrapper queryWrapper = getPluginInfoEntityQueryWrapper().and(PLUGIN_INFO_ENTITY.ID.eq(id));
|
||||
return getOne(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取查询对象,排除掉 jar二进制
|
||||
*/
|
||||
private QueryWrapper getPluginInfoEntityQueryWrapper() {
|
||||
return QueryWrapper.create().select(EntityUtils.getFieldNamesWithSuperClass(PLUGIN_INFO_ENTITY.DEFAULT_COLUMNS, PLUGIN_INFO_ENTITY.JAR_FILE.getName()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user