From a82b5137554fec827f856d68c1ee689bf88226ad Mon Sep 17 00:00:00 2001 From: cb <275647614@qq.com> Date: Fri, 20 Jun 2025 16:14:10 +0800 Subject: [PATCH] no message --- .../src/main/resources/templates/goods/category/edit.html | 3 ++- .../goods/service/impl/DeptGoodsCategoryServiceImpl.java | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ghy-admin/src/main/resources/templates/goods/category/edit.html b/ghy-admin/src/main/resources/templates/goods/category/edit.html index 1e67f44d..e234651a 100644 --- a/ghy-admin/src/main/resources/templates/goods/category/edit.html +++ b/ghy-admin/src/main/resources/templates/goods/category/edit.html @@ -48,7 +48,8 @@
- +
diff --git a/ghy-goods/src/main/java/com/ghy/goods/service/impl/DeptGoodsCategoryServiceImpl.java b/ghy-goods/src/main/java/com/ghy/goods/service/impl/DeptGoodsCategoryServiceImpl.java index b47cc155..ca0bea2e 100644 --- a/ghy-goods/src/main/java/com/ghy/goods/service/impl/DeptGoodsCategoryServiceImpl.java +++ b/ghy-goods/src/main/java/com/ghy/goods/service/impl/DeptGoodsCategoryServiceImpl.java @@ -159,8 +159,11 @@ public class DeptGoodsCategoryServiceImpl implements DeptGoodsCategoryService { GoodsCategory goodsCategory = goodsCategoryService.selectById(checked[0]); Assert.notNull(goodsCategory, "不存在该类目: " + checked[0]); List oldList = deptGoodsCategoryMapper.selectByDeptId(parentId); - Map oldMap = oldList.stream().filter(x -> x.getType().equals(goodsCategory.getType())) - .collect(Collectors.toMap(GoodsCategory::getGoodsCategoryId, DeptGoodsCategory::getDeptGoodsCategoryId)); + + Map oldMap = oldList.stream() + .filter(x -> x.getType() != null && goodsCategory.getType() != null && x.getType().equals(goodsCategory.getType())) + .collect(Collectors.toMap(DeptGoodsCategory::getGoodsCategoryId, DeptGoodsCategory::getDeptGoodsCategoryId)); + HashSet newSet = new HashSet<>(Arrays.asList(checked)); Set intersection = oldList.stream().map(DeptGoodsCategory::getGoodsCategoryId).collect(Collectors.toSet()); intersection.addAll(Arrays.asList(checked));