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