From 4947025a25114157229034c25faf9084603d308b Mon Sep 17 00:00:00 2001 From: liyj <1617420630@qq.com> Date: Fri, 27 Jun 2025 14:53:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E6=95=B0=E6=8D=AE=E5=92=8C?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E7=9B=B8=E5=85=B3=E9=97=AE=E9=A2=98=E8=A7=A3?= =?UTF-8?q?=E5=86=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/ShopProductInfoController.java | 4 ++++ .../product/mapper/ShopProductItemMapper.java | 2 ++ .../service/ShopProductItemService.java | 6 ++++++ .../impl/ShopProductBaseServiceImpl.java | 1 + .../impl/ShopProductItemServiceImpl.java | 6 +++++- .../impl/SyncShopImageServiceImpl.java | 20 +++++++++++++++++-- .../mapper/product/ShopProductItemMapper.xml | 10 ++++++++++ sql/shop/dev/202506012_dml.sql | 8 ++++---- sql/shop/dev/202506027_dml.sql | 5 +++++ 9 files changed, 55 insertions(+), 7 deletions(-) create mode 100644 sql/shop/dev/202506027_dml.sql diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/product/controller/admin/ShopProductInfoController.java b/mall-shop/src/main/java/com/suisung/mall/shop/product/controller/admin/ShopProductInfoController.java index 7d71b43f..49bf85b3 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/product/controller/admin/ShopProductInfoController.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/product/controller/admin/ShopProductInfoController.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.suisung.mall.common.api.CommonResult; import com.suisung.mall.common.api.StateCode; import com.suisung.mall.common.modules.product.*; +import com.suisung.mall.common.utils.StringUtils; import com.suisung.mall.shop.product.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -119,6 +120,9 @@ public class ShopProductInfoController { List assistIndexList = assistIndexService.find(indexQueryWrapper); HashMap map = new HashMap<>(); + if(StringUtils.isEmpty(shopProductInfo.getProduct_spec())){ + shopProductInfo.setProduct_spec("[]"); + } map.put("shop_product_info", shopProductInfo); map.put("shop_product_image", shopProductImages); map.put("shop_product_detail", shopProductDetail); diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/product/mapper/ShopProductItemMapper.java b/mall-shop/src/main/java/com/suisung/mall/shop/product/mapper/ShopProductItemMapper.java index 00c159b0..67ea4123 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/product/mapper/ShopProductItemMapper.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/product/mapper/ShopProductItemMapper.java @@ -9,6 +9,7 @@ import com.suisung.mall.common.pojo.dto.EduCourseDetailDTO; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; +import java.util.List; import java.util.Map; /** @@ -31,4 +32,5 @@ public interface ShopProductItemMapper extends BaseMapper { int lockSkuStock(@Param("item_id") Long itemId, @Param("cart_quantity") int cart_quantity); + void updateBatchByProductId(List list,Integer itemEnable); } diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/product/service/ShopProductItemService.java b/mall-shop/src/main/java/com/suisung/mall/shop/product/service/ShopProductItemService.java index 0bda568f..9b1773b5 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/product/service/ShopProductItemService.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/product/service/ShopProductItemService.java @@ -79,4 +79,10 @@ public interface ShopProductItemService extends IBaseService { void clearProductItemIdByStore(Integer store_id); + /** + * 更加产品名称更新状态 + * @param shopProductItemList + * @return + */ + void batchUpdateByCondition(List shopProductItemList); } diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/product/service/impl/ShopProductBaseServiceImpl.java b/mall-shop/src/main/java/com/suisung/mall/shop/product/service/impl/ShopProductBaseServiceImpl.java index c4870f84..cde27faa 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/product/service/impl/ShopProductBaseServiceImpl.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/product/service/impl/ShopProductBaseServiceImpl.java @@ -5379,6 +5379,7 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl shopProductItemList) { + shopProductItemMapper.updateBatchByProductId(shopProductItemList,shopProductItemList.get(0).getItem_enable()); + } } diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/sync/service/impl/SyncShopImageServiceImpl.java b/mall-shop/src/main/java/com/suisung/mall/shop/sync/service/impl/SyncShopImageServiceImpl.java index f638d5e2..6b3328cd 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/sync/service/impl/SyncShopImageServiceImpl.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/sync/service/impl/SyncShopImageServiceImpl.java @@ -12,6 +12,7 @@ import cn.hutool.core.collection.CollectionUtil; import com.suisung.mall.common.api.StateCode; import com.suisung.mall.common.modules.product.ShopProductBase; import com.suisung.mall.common.modules.product.ShopProductImage; +import com.suisung.mall.common.modules.product.ShopProductIndex; import com.suisung.mall.common.modules.product.ShopProductItem; import com.suisung.mall.common.modules.sync.ImageMappingDto; import com.suisung.mall.common.utils.StringUtils; @@ -19,6 +20,7 @@ import com.suisung.mall.shop.product.mapper.ShopProductImageMapper; import com.suisung.mall.shop.product.service.ShopProductBaseService; import com.suisung.mall.shop.product.service.ShopProductImageService; +import com.suisung.mall.shop.product.service.ShopProductIndexService; import com.suisung.mall.shop.product.service.ShopProductItemService; import com.suisung.mall.shop.sixun.utils.CommonUtil; import com.suisung.mall.shop.sync.mapper.ShopImageMappingTempMapper; @@ -54,6 +56,9 @@ public class SyncShopImageServiceImpl implements SyncShopImageService { @Autowired private ShopProductBaseService shopProductBaseService; + @Autowired + private ShopProductIndexService shopProductIndexService; + @Value("${project.static_domain}") private String staticDomain; @@ -146,6 +151,7 @@ public class SyncShopImageServiceImpl implements SyncShopImageService { List shopProductBaseList=new ArrayList<>(); List shopProductItemList=new ArrayList<>(); List shopProductImageList=new ArrayList<>(); + List shopProductIndexList=new ArrayList<>(); for (ImageMappingDto imageMappingDto:imageMappingDtos){ String mergedImageUrl=imageMappingDto.getMergedImageUrl(); if(StringUtils.isEmpty(mergedImageUrl)){ @@ -162,15 +168,22 @@ public class SyncShopImageServiceImpl implements SyncShopImageService { }else { shopProductImage.setItem_image_other(imageMappingDto.addDomainPrefix(staticDomain,mergedImageUrl)); } + String thumb=imageMappingDto.addDomainPrefix(staticDomain,imageMappingDto.getThumb()); shopProductImage.setProduct_id(imageMappingDto.getProductId()); shopProductImage.setProduct_image_id(imageMappingDto.getProductImageId()); - shopProductImage.setItem_image_default(imageMappingDto.addDomainPrefix(staticDomain,imageMappingDto.getThumb())); + shopProductImage.setItem_image_default(thumb); shopProductImageList.add(shopProductImage); shopProductBase.setProduct_id(imageMappingDto.getProductId()); + shopProductBase.setProduct_image(thumb); shopProductBase.setProduct_state_id(StateCode.PRODUCT_STATE_NORMAL); shopProductBaseList.add(shopProductBase); + shopProductItem.setProduct_id(imageMappingDto.getProductId()); shopProductItem.setItem_enable(StateCode.PRODUCT_STATE_NORMAL); shopProductItemList.add(shopProductItem); + ShopProductIndex shopProductIndex=new ShopProductIndex(); + shopProductIndex.setProduct_id(imageMappingDto.getProductId()); + shopProductIndex.setProduct_state_id(StateCode.PRODUCT_STATE_NORMAL); + shopProductIndexList.add(shopProductIndex); } if(CollectionUtil.isNotEmpty(shopProductImageList)){ shopProductImageService.updateBatchById(shopProductImageList); @@ -179,7 +192,10 @@ public class SyncShopImageServiceImpl implements SyncShopImageService { shopProductBaseService.updateBatchById(shopProductBaseList); } if(CollectionUtil.isNotEmpty(shopProductItemList)){ - shopProductItemService.updateBatchById(shopProductItemList); + shopProductItemService.batchUpdateByCondition(shopProductItemList); + } + if(CollectionUtil.isNotEmpty(shopProductIndexList)){ + shopProductIndexService.updateBatchById(shopProductIndexList); } } diff --git a/mall-shop/src/main/resources/mapper/product/ShopProductItemMapper.xml b/mall-shop/src/main/resources/mapper/product/ShopProductItemMapper.xml index f3581801..edebb1d3 100644 --- a/mall-shop/src/main/resources/mapper/product/ShopProductItemMapper.xml +++ b/mall-shop/src/main/resources/mapper/product/ShopProductItemMapper.xml @@ -218,4 +218,14 @@ where f.product_id = #{product_id} + + UPDATE shop_product_item + SET item_enable= #{itemEnable} + WHERE product_id in + + #{item.product_id} + + + + diff --git a/sql/shop/dev/202506012_dml.sql b/sql/shop/dev/202506012_dml.sql index 2a7b487e..7bccde49 100644 --- a/sql/shop/dev/202506012_dml.sql +++ b/sql/shop/dev/202506012_dml.sql @@ -1,20 +1,20 @@ INSERT INTO admin_base_menu (menu_parent_id,menu_rel,menu_name,menu_url,menu_path,menu_component,menu_close,menu_label,menu_order,menu_enable,menu_class,menu_icon,menu_bubble,menu_url_path,menu_url_mdu,menu_url_ctl,menu_url_met,menu_url_parem,menu_time,menu_type,menu_note,menu_func,menu_role,menu_hidden) VALUES - (320,'pageTab','分类管理','','category','@/views/base/product/category',0,'CategoryManagement',50,1,'','','','/admin/shop/shop-base-product-category/list','','Base_ProductCategory','index','','2024-07-12 21:33:44',1,'
+ (8021,'pageTab','分类管理','','category','@/views/base/product/category',0,'CategoryManagement',50,1,'','','','/admin/shop/shop-base-product-category/list','','Base_ProductCategory','index','','2024-07-12 21:33:44',1,'','',2,0), - (320,'pageTab','品牌管理','','brand','@/views/base/product/brand/index.vue',0,'BrandManagement',51,1,'','','','/admin/shop/shop-base-product-brand/list','','Base_ProductBrand','index','','2024-07-12 21:33:44',1,'
+ (8021,'pageTab','品牌管理','','brand','@/views/base/product/brand/index.vue',0,'BrandManagement',51,1,'','','','/admin/shop/shop-base-product-brand/list','','Base_ProductBrand','index','','2024-07-12 21:33:44',1,'','',2,0), - (320,'pageTab','类型管理','','type','@/views/base/product/type/index.vue',0,'Vab3204',52,1,'','','','/admin/shop/shop-base-product-type/list','','Base_ProductType','index','','2024-07-12 21:33:44',1,'
+ (8021,'pageTab','类型管理','','type','@/views/base/product/type/index.vue',0,'Vab3204',52,1,'','','','/admin/shop/shop-base-product-type/list','','Base_ProductType','index','','2024-07-12 21:33:44',1,'','',2,0), - (320,'pageTab','规格管理','','spec','@/views/base/product/spec/index.vue',0,'CpecManagement',53,1,'','','','m','','Base_ProductSpec','index','','2025-06-12 17:19:46',1,'
+ (8021,'pageTab','规格管理','','spec','@/views/base/product/spec/index.vue',0,'CpecManagement',53,1,'','','','m','','Base_ProductSpec','index','','2025-06-12 17:19:46',1,'
规格管理 规格将会对应到商品发布的规格,规格值由店铺自己添加。 默认安装中会添加一个默认颜色规格,请不要删除,只有这个颜色规格才能在商品详细页显示为图片。 diff --git a/sql/shop/dev/202506027_dml.sql b/sql/shop/dev/202506027_dml.sql new file mode 100644 index 00000000..c41e0ef0 --- /dev/null +++ b/sql/shop/dev/202506027_dml.sql @@ -0,0 +1,5 @@ +INSERT INTO `admin_base_protocol` (`ctl`, `met`, `db`, `rights_id`, `log`, `path`) VALUES ('/admin/shop/shop-sync-productMapper/syncShopImages', 'index', 'master', '', '0', '/admin/shop/shop-sync-productMapper/syncShopImages'); + +update admin_base_menu set menu_parent_id ='8021' where menu_url_path in('/admin/shop/shop-base-product-category/list','/admin/shop/shop-base-product-brand/list','/admin/shop/shop-base-product-type/list','/admin/shop/shop-base-product-spec/list') and menu_role='2'; + +update shop_product_image set item_image_default='1' where product_from ='1005' and item_image_default !='1';