Merge remote-tracking branch 'origin/main'

This commit is contained in:
Jack 2025-12-01 17:36:03 +08:00
commit cb0d5e0cc3
3 changed files with 32 additions and 4 deletions

View File

@ -42,7 +42,7 @@ public class ShopProductImage implements Serializable {
@ApiModelProperty(value = "规格值")
private String color_name;
@ApiModelProperty(value = "商品主图")
@ApiModelProperty(value = "商品主图,0是编辑空图片1是同步空图片")
@TableField(updateStrategy = FieldStrategy.NOT_EMPTY)
private String item_image_default;

View File

@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p>
@ -114,6 +115,16 @@ public class ShopProductInfoController {
QueryWrapper<ShopProductImage> imageQueryWrapper = new QueryWrapper<>();
imageQueryWrapper.eq("product_id", product_id);
List<ShopProductImage> shopProductImages = imageService.find(imageQueryWrapper);
if(!shopProductImages.isEmpty()) {
shopProductImages=shopProductImages.stream().peek(s->{
if(s.getItem_image_default().equals("0")||s.getItem_image_default().equals("1")) {
s.setItem_image_default("");
}
if(s.getItem_image_other().equals("0")||s.getItem_image_other().equals("1")) {
s.setItem_image_other("");
}
}).collect(Collectors.toList());
}
// shop_product_assist_index
QueryWrapper<ShopProductAssistIndex> indexQueryWrapper = new QueryWrapper<>();
indexQueryWrapper.eq("product_id", product_id);

View File

@ -493,7 +493,7 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
Integer item_is_default = Convert.toInt(productItemMap.get("item_is_default"));
String item_image_default = Convert.toStr(productItemMap.get("main_color_img"), default_image); // 主图
if(com.suisung.mall.common.utils.StringUtils.isEmpty(item_image_default)){
item_image_default=default_image;
item_image_default="0";
}
List<String> item_image_other = Convert.toList(String.class, productItemMap.get("color_img"));
String _str_item_spec = (String) productItemMap.get("product_spec");
@ -587,7 +587,7 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
if (CollUtil.isNotEmpty(item_image_other)) {
image.setItem_image_other(StrUtil.join(",", item_image_other));
} else {
image.setItem_image_other("");
image.setItem_image_other("0");
}
// 如果为设置图片使用主图设置默认一个
@ -3741,6 +3741,13 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
if (CollUtil.isNotEmpty(product_ids)) {
List<ShopProductBase> shopProductBases = gets(product_ids);
if(!shopProductBases.isEmpty()){
shopProductBases=shopProductBases.stream().peek(s->{
if (s.getProduct_image().equals("0")||s.getProduct_image().equals("1")){
s.setProduct_image("");
}
}).collect(Collectors.toList());
}
product_base_rows = Convert.toList(Map.class, shopProductBases);
List<ShopProductInfo> ShopProductInfos = shopProductInfoService.gets(product_ids);
List<Map> product_info_rows = Convert.toList(Map.class, ShopProductInfos);
@ -6507,7 +6514,7 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
QueryWrapper<ShopProductIndex> cond_row = new QueryWrapper<>();
if (StrUtil.isNotBlank(productNumber)) {
cond_row.eq("product_number", productNumber);
cond_row.eq("product_number", productNumber.trim());
}
cond_row.eq("store_id", store_id);
List<ShopProductIndex> lists = shopProductIndexService.list(cond_row);
@ -6562,6 +6569,16 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl<ShopProductBaseM
QueryWrapper<ShopProductImage> imageQueryWrapper = new QueryWrapper<>();
imageQueryWrapper.eq("product_id", productId);
List<ShopProductImage> shopProductImages = shopProductImageService.find(imageQueryWrapper);
if(!shopProductImages.isEmpty()){
shopProductImages=shopProductImages.stream().peek(s->{
if(s.getItem_image_default().equals("0")||s.getItem_image_default().equals("1")){
s.setItem_image_default("");
}
if(s.getItem_image_other().equals("0")||s.getItem_image_other().equals("1")){
s.setItem_image_other("");
}
}).collect(Collectors.toList());
}
// shop_product_assist_index
QueryWrapper<ShopProductAssistIndex> indexQueryWrapper = new QueryWrapper<>();
indexQueryWrapper.eq("product_id", productId);