aaa
doum
2026-06-08 cf2da3b2a63840888815c6a81cbd7948faf93533
server/service/src/main/java/com/doumee/service/business/impl/GoodsServiceImpl.java
@@ -628,6 +628,12 @@
        if(!Objects.isNull(category)){
            goods.setCategoryName(category.getName());
        }
        if (goods.getSubCategoryId() != null) {
            Category subCategory = categoryMapper.selectById(goods.getSubCategoryId());
            if (subCategory != null) {
                goods.setSubCategoryName(subCategory.getName());
            }
        }
        goods.setMultifileList(multifileMapper.selectList(new QueryWrapper<Multifile>().eq("OBJ_TYPE",Constants.ZERO).eq("OBJ_ID",id)));
        return goods;
    }
@@ -714,6 +720,7 @@
        IPage<Goods> goodsIPage =  goodsJoinMapper.selectJoinPage(page, Goods.class, queryWrapper);
        String prefixUrl = systemDictDataBiz.queryByCode(Constants.OSS, Constants.RESOURCE_PATH).getCode()
                + systemDictDataBiz.queryByCode(Constants.OSS, Constants.GOODS_IMG).getCode();
        fillSubCategoryNames(goodsIPage.getRecords());
        goodsIPage.getRecords().forEach(i->{
            i.setPrefixUrl(prefixUrl);
            if(i.getType().equals(Constants.ONE)){
@@ -1288,6 +1295,30 @@
        }
    }
    private void fillSubCategoryNames(List<Goods> goodsList) {
        if (goodsList == null || goodsList.isEmpty()) {
            return;
        }
        List<Integer> subCategoryIds = goodsList.stream()
                .map(Goods::getSubCategoryId)
                .filter(Objects::nonNull)
                .distinct()
                .collect(Collectors.toList());
        if (subCategoryIds.isEmpty()) {
            return;
        }
        List<Category> subCategories = categoryMapper.selectList(new QueryWrapper<Category>()
                .in("ID", subCategoryIds)
                .eq("ISDELETED", Constants.ZERO));
        Map<Integer, String> nameMap = subCategories.stream()
                .collect(Collectors.toMap(Category::getId, Category::getName, (a, b) -> a));
        goodsList.forEach(goods -> {
            if (goods.getSubCategoryId() != null) {
                goods.setSubCategoryName(nameMap.get(goods.getSubCategoryId()));
            }
        });
    }
    public void dealGoodsMsg(List<Goods> goodsList){