提交 ec23cadb 编写于 作者: tangyaologin's avatar tangyaologin

通过点击实体生成相应模型 第二版

上级 8e338395
......@@ -118,7 +118,8 @@ public class MetaEntityExService extends MetaEntityServiceImpl {
*/
public LinkedHashSet<Property> findParRelation(MetaEntity et) {
Property property;
List<MetaEntity> parEntityList;
Property temp;
MetaEntity parEntity;
PropertyMapping propertyMapping;
LinkedHashSet<PropertyMapping> propertyMappingSet;
LinkedHashSet<Property> parPropertyList = new LinkedHashSet<>();
......@@ -127,27 +128,33 @@ public class MetaEntityExService extends MetaEntityServiceImpl {
List<MetaRelationship> parList = metaRelationshipService.selectByEntityId(et.getEntityId());
if (!ObjectUtils.isEmpty(parList)) {
List<String> refIds = parList.stream().map(MetaRelationship::getRefEntityId).collect(Collectors.toList());
parEntityList = baseMapper.selectBatchIds(refIds);
for (int i = 0; i < parEntityList.size(); i++) {
for (int i = 0; i < refIds.size(); i++) {
parEntity = baseMapper.selectById(refIds.get(i));
// 存储对象参数集合
property = new Property();
propertyMapping = new PropertyMapping();
property.setPropertyName(parEntityList.get(i).getEntityName() == null ? "" : parEntityList.get(i).getEntityName());
property.setSystem(parEntityList.get(i).getSystemId() == null ? "" : parEntityList.get(i).getSystemId());
property.setPropertyEntity(parEntityList.get(i).getTableName() == null ? "" : parEntityList.get(i).getTableName());
property.setPropertyName(parEntity.getEntityName() == null ? "" : parEntity.getEntityName());
property.setSystem(parEntity.getSystemId() == null ? "" : parEntity.getSystemId());
property.setPropertyEntity(parEntity.getTableName() == null ? "" : parEntity.getTableName());
// 对应存储相同实体id关系
for (MetaEntity metaEntity : parEntityList) {
if (metaEntity.getEntityId().equals(parList.get(i).getRefEntityId())) {
propertyMapping.setSelfPropertyColumn(parList.get(i).getCodeName() == null ? "" : parList.get(i).getCodeName());
propertyMapping.setJoinPropertyName(parList.get(i).getEntityName() == null ? "" : parList.get(i).getEntityName());
propertyMapping.setJoinPropertyColumn(parList.get(i).getCodeName() == null ? "" : parList.get(i).getCodeName());
}
propertyMapping.setSelfPropertyColumn(parList.get(i).getCodeName() == null ? "" : parList.get(i).getCodeName());
propertyMapping.setJoinPropertyName(parList.get(i).getEntityName() == null ? "" : parList.get(i).getEntityName());
propertyMapping.setJoinPropertyColumn(parList.get(i).getCodeName() == null ? "" : parList.get(i).getCodeName());
// 添加主实体在集合头部
if (i == 0) {
temp = new Property();
temp.setPropertyName(et.getEntityName());
temp.setSystem(et.getSystemId());
temp.setPropertyEntity(et.getTableName());
parPropertyList.add(temp);
}
propertyMappingSet = new LinkedHashSet<>();
parPropertyList.add(property);
propertyMappingSet.add(propertyMapping);
property.setPropertyMappings(propertyMappingSet);
}
}
return parPropertyList;
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册