Fix su entityHierachy
This commit is contained in:
@@ -11,6 +11,7 @@ public class EntityHierarchyDTO {
|
|||||||
private String entityName;
|
private String entityName;
|
||||||
private String tableName;
|
private String tableName;
|
||||||
private Field field;
|
private Field field;
|
||||||
|
private boolean master;
|
||||||
private List<EntityHierarchyDTO> children;
|
private List<EntityHierarchyDTO> children;
|
||||||
|
|
||||||
public Class<? extends EntityBase> getClazz() {
|
public Class<? extends EntityBase> getClazz() {
|
||||||
@@ -47,6 +48,15 @@ public class EntityHierarchyDTO {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isMaster() {
|
||||||
|
return master;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityHierarchyDTO setMaster(boolean master) {
|
||||||
|
this.master = master;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public List<EntityHierarchyDTO> getChildren() {
|
public List<EntityHierarchyDTO> getChildren() {
|
||||||
return children;
|
return children;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,15 +80,18 @@ public class EntityPropertyHolder {
|
|||||||
Reflections reflections = new Reflections("it.integry.ems_model.entity");
|
Reflections reflections = new Reflections("it.integry.ems_model.entity");
|
||||||
List<EntityHierarchyDTO> mapping = new ArrayList<>();
|
List<EntityHierarchyDTO> mapping = new ArrayList<>();
|
||||||
Set<Class<? extends EntityBase>> classes = reflections.getSubTypesOf(EntityBase.class);
|
Set<Class<? extends EntityBase>> classes = reflections.getSubTypesOf(EntityBase.class);
|
||||||
|
|
||||||
for (Class<? extends EntityBase> entity : classes) {
|
for (Class<? extends EntityBase> entity : classes) {
|
||||||
if (entity.isAnnotationPresent(Master.class)) {
|
if(!entity.isAnnotationPresent(Table.class)) continue;
|
||||||
EntityHierarchyDTO dto = new EntityHierarchyDTO();
|
|
||||||
dto.setClazz(entity);
|
EntityHierarchyDTO dto = new EntityHierarchyDTO();
|
||||||
dto.setEntityName(entity.getSimpleName());
|
dto.setClazz(entity);
|
||||||
dto.setTableName(entity.getAnnotation(Table.class).value());
|
dto.setEntityName(entity.getSimpleName());
|
||||||
dto.setChildren(getEntityChildren(entity));
|
dto.setTableName(entity.getAnnotation(Table.class).value());
|
||||||
mapping.add(dto);
|
dto.setChildren(getEntityChildren(entity));
|
||||||
}
|
dto.setMaster(entity.isAnnotationPresent(Master.class));
|
||||||
|
|
||||||
|
mapping.add(dto);
|
||||||
}
|
}
|
||||||
return mapping;
|
return mapping;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user