提交 72ca5383 编写于 作者: zhouweidong's avatar zhouweidong

初始化module

上级 685d5740
...@@ -89,19 +89,23 @@ public class LiteCoreService { ...@@ -89,19 +89,23 @@ public class LiteCoreService {
moduleService.list(new QueryWrapper<MetaModule>().select("codename").eq("systemid",sysModel.getSystemid())).forEach(module -> delModule.put(module.getCodeName(),1)); moduleService.list(new QueryWrapper<MetaModule>().select("codename").eq("systemid",sysModel.getSystemid())).forEach(module -> delModule.put(module.getCodeName(),1));
List<MetaEntityModel> metaEntityModels = sysModel.getEntities(); List<MetaEntityModel> metaEntityModels = sysModel.getEntities();
Set<MetaEntity> entities=new HashSet<>(); Set<MetaEntity> entities=new HashSet<>();
Set<MetaModule> modules=new HashSet<>(); Map<Object,MetaModule> modulesMap = new HashMap<>();
if(!ObjectUtils.isEmpty(metaEntityModels)){ if(!ObjectUtils.isEmpty(metaEntityModels)){
entities.addAll(entityMapping.toDomain(metaEntityModels)); entities.addAll(entityMapping.toDomain(metaEntityModels));
} }
entities.forEach(entity -> { entities.forEach(entity -> {
delDE.remove(entity.getEntityId()); delDE.remove(entity.getEntityId());
if(!ObjectUtils.isEmpty(entity.getModuleId()) && !ObjectUtils.isEmpty(entity.getModuleName())){ String moduleId=entity.getModuleId();
delModule.remove(entity.getModuleId()); String moduleName=entity.getModuleName();
if(!ObjectUtils.isEmpty(moduleId) && !ObjectUtils.isEmpty(moduleName)){
delModule.remove(moduleId);
if(!modulesMap.containsKey(moduleId)){
MetaModule module =new MetaModule(); MetaModule module =new MetaModule();
module.setCodeName(entity.getModuleId()); module.setCodeName(moduleId);
module.setName(entity.getModuleName()); module.setName(moduleName);
module.setSystemId(sysModel.getSystemid()); module.setSystemId(sysModel.getSystemid());
modules.add(module); modulesMap.put(moduleId,module);
}
} }
}); });
//移除无效资源 //移除无效资源
...@@ -112,8 +116,8 @@ public class LiteCoreService { ...@@ -112,8 +116,8 @@ public class LiteCoreService {
//存储或更新资源saveOrUpdate //存储或更新资源saveOrUpdate
if(entities.size()>0) if(entities.size()>0)
entityService.saveBatch(entities); entityService.saveBatch(entities);
if(modules.size()>0) if(modulesMap.size()>0)
moduleService.saveBatch(modules); moduleService.saveBatch(modulesMap.values());
} }
/** /**
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册