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));