use of com.hb0730.boot.admin.project.system.menu.model.dto.MenuDTO in project boot-admin by hb0730.
the class MenuServiceImpl method getChildrenByParenId.
@Override
@Nullable
public List<MenuDTO> getChildrenByParenId(@Nonnull Long id) {
Assert.notNull(id, "id不为空");
List<MenuEntity> entities = super.list();
List<MenuDTO> menu = BeanUtil.copyToList(entities, MenuDTO.class);
List<MenuDTO> result = Lists.newArrayList();
for (MenuDTO dto : menu) {
// 第一级
if (dto.getParentId().equals(id)) {
result.add(dto);
for (MenuDTO item : menu) {
if (dto.getId().equals(item.getParentId())) {
result.add(item);
}
}
}
}
return result;
}
Aggregations