照着谷粒商城做什么都没错为什么错在这种一脸懵的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无用
悬赏问题
- ¥30 vmware exsi重置后登不上
- ¥15 易盾点选的cb参数怎么解啊
- ¥15 MATLAB运行显示错误,如何解决?
- ¥15 c++头文件不能识别CDialog
- ¥15 Excel发现不可读取的内容
- ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题
- ¥20 yolov5自定义Prune报错,如何解决?
- ¥15 电磁场的matlab仿真
- ¥15 mars2d在vue3中的引入问题
- ¥50 h5唤醒支付宝并跳转至向小荷包转账界面