商品图库附图新增
This commit is contained in:
parent
e1bd542c12
commit
30b24dda04
@ -195,6 +195,7 @@ public class LibraryProductImpl extends BaseServiceImpl<LibraryProductMapper, Li
|
||||
}
|
||||
List<String> updateTableIds=new ArrayList<>();
|
||||
List<LibraryProductImage> updateProductImageList=new ArrayList<>();
|
||||
List<LibraryProductImage> addProductImageList=new ArrayList<>();
|
||||
products.forEach(product->{
|
||||
if (null==product.getId()){
|
||||
throw new ApiException("id is null");
|
||||
@ -207,10 +208,19 @@ public class LibraryProductImpl extends BaseServiceImpl<LibraryProductMapper, Li
|
||||
if(null!=product.getProduct_image_list()&&!product.getProduct_image_list().isEmpty()){
|
||||
for(LibraryProductDTO.ProductImage productImage: product.getProduct_image_list()){
|
||||
LibraryProductImage libraryProductImage=new LibraryProductImage();
|
||||
libraryProductImage.setId(productImage.getId());
|
||||
libraryProductImage.setImageUrl(productImage.getImageUrl());
|
||||
libraryProductImage.setProductId(productImage.getProductId());
|
||||
updateProductImageList.add(libraryProductImage);
|
||||
if(null!=productImage.getId()){
|
||||
libraryProductImage.setId(productImage.getId());
|
||||
libraryProductImage.setImageUrl(productImage.getImageUrl());
|
||||
libraryProductImage.setProductId(productImage.getProductId());
|
||||
updateProductImageList.add(libraryProductImage);
|
||||
}else {
|
||||
libraryProductImage.setImageUrl(productImage.getImageUrl());
|
||||
libraryProductImage.setProductId(productImage.getProductId());
|
||||
libraryProductImage.setStatus(1);
|
||||
libraryProductImage.setIsMain(false);
|
||||
addProductImageList.add(libraryProductImage);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
updateProductList.add(libraryProduct);
|
||||
@ -221,6 +231,9 @@ public class LibraryProductImpl extends BaseServiceImpl<LibraryProductMapper, Li
|
||||
if(!updateProductImageList.isEmpty()){
|
||||
libraryProductImageService.updateBatchById(updateProductImageList,updateProductImageList.size());
|
||||
}
|
||||
if(!addProductImageList.isEmpty()){
|
||||
libraryProductImageService.saveBatch(addProductImageList,addProductImageList.size());
|
||||
}
|
||||
|
||||
if(result){
|
||||
redisService.del(updateTableIds);
|
||||
|
||||
@ -19,9 +19,9 @@
|
||||
<!-- 商品库商品图片集合映射-->
|
||||
<collection property="product_image_list"
|
||||
ofType="com.suisung.mall.common.pojo.dto.LibraryProductDTO$ProductImage">
|
||||
<result property="product_id" column="product_id"/>
|
||||
<result property="image_url" column="image_url"/>
|
||||
<result property="is_main" column="is_main"/>
|
||||
<result property="product_id" column="productId"/>
|
||||
<result property="image_url" column="imageUrl"/>
|
||||
<result property="is_main" column="isMain"/>
|
||||
<result property="seq" column="seq"/>
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user