照着谷粒商城做什么都没错为什么错在这种一脸懵的bug上,为什么视频展开到最后一级手机就可以选择手机,为什么我的最后一级手机还可以展开啊?
心态大蹦
谷粒商城-品牌管理-关联分类中新增关联选取不了数据,如图点手机还有下一级。
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
3条回答 默认 最新
- cbx942213 2022-04-02 10:13关注
改成这样就行了:
private List<PmsCategory> getChildren(PmsCategory root, List<PmsCategory> all) { List<PmsCategory> children = all.stream().filter(categoryEntity -> { // 找到当前id的子菜单 return categoryEntity.getParentCid().equals(root.getCatId()); }).map(categoryEntity -> { // 1 找到子菜单,递归找法 List<PmsCategory> res = getChildren(categoryEntity, all); if(res==null||res.size()==0){ categoryEntity.setChildren(null); }else{ categoryEntity.setChildren(res); } // categoryEntity.setChildren(getChildren(categoryEntity, all)); return categoryEntity; }).sorted((menu1, menu2) -> { // 2 菜单排序 return menu1.getSort() - menu2.getSort(); // menu1.getSort()==null?0;menu1.getSort() }).collect(Collectors.toList()); return children; }
那个==改成equals是idea提示包装类应采用equals比较相等,不改也不报错
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 2无用
悬赏问题
- ¥20 机器学习能否像多层线性模型一样处理嵌套数据
- ¥20 西门子S7-Graph,S7-300,梯形图
- ¥50 用易语言http 访问不了网页
- ¥50 safari浏览器fetch提交数据后数据丢失问题
- ¥15 matlab不知道怎么改,求解答!!
- ¥15 永磁直线电机的电流环pi调不出来
- ¥15 用stata实现聚类的代码
- ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
- ¥20 docker里部署springboot项目,访问不到扬声器
- ¥15 netty整合springboot之后自动重连失效