瀏覽代碼

商品瀑布区和标签

xw 2 天之前
父節點
當前提交
5feb0a5be0

+ 2 - 1
fs-admin/src/main/java/com/fs/hisStore/controller/FsStoreProductScrmController.java

@@ -154,7 +154,8 @@ public class FsStoreProductScrmController extends BaseController
         FsStoreProductScrm product=fsStoreProductService.selectFsStoreProductById(productId);
         List<FsStoreProductAttrScrm> attrs=attrService.selectFsStoreProductAttrByProductId(productId);
         List<Long> tagIds = fsStoreProductService.selectTagIdsByProductId(productId);
-        return R.ok().put("data",product).put("attrs", attrs).put("tagIds", tagIds);
+        List<Long> userEndCategoryIds = fsStoreProductService.selectUserEndCategoryIdsByProductId(productId);
+        return R.ok().put("data",product).put("attrs", attrs).put("tagIds", tagIds).put("userEndCategoryIds", userEndCategoryIds);
     }
 
     @PreAuthorize("@ss.hasPermi('store:storeProduct:add')")

+ 3 - 0
fs-service/src/main/java/com/fs/hisStore/param/FsStoreProductAddEditParam.java

@@ -302,6 +302,9 @@ public class FsStoreProductAddEditParam implements Serializable
     /** 所属小程序app_id,多个用逗号隔开 */
     private String appIds;
 
+    /** 用户端分类ID列表(金刚区/瀑布流多选) */
+    private List<Long> userEndCategoryIds;
+
     /** 商品标签ID列表(最多3个) */
     private List<Long> tagIds;
 

+ 2 - 0
fs-service/src/main/java/com/fs/hisStore/service/IFsStoreProductScrmService.java

@@ -155,4 +155,6 @@ public interface IFsStoreProductScrmService
     R updateCache(Long productId);
 
     List<Long> selectTagIdsByProductId(Long productId);
+
+    List<Long> selectUserEndCategoryIdsByProductId(Long productId);
 }

+ 17 - 0
fs-service/src/main/java/com/fs/hisStore/service/impl/FsStoreProductScrmServiceImpl.java

@@ -169,6 +169,9 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
     @Autowired
     private FsStoreProductTagRelationScrmMapper fsStoreProductTagRelationScrmMapper;
 
+    @Autowired
+    private FsStoreProductUserEndCategoryMapper fsStoreProductUserEndCategoryMapper;
+
     /**
      * 清除商品详情缓存
      * @param productId 商品ID
@@ -273,6 +276,7 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
         if (productIds != null) {
             for (Long pid : productIds) {
                 if (pid != null) {
+                    fsStoreProductUserEndCategoryMapper.deleteByProductId(pid);
                     fsStoreProductTagRelationScrmMapper.deleteByProductId(pid);
                 }
             }
@@ -538,6 +542,7 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
     public int deleteFsStoreProductById(Long productId)
     {
         if (productId != null) {
+            fsStoreProductUserEndCategoryMapper.deleteByProductId(productId);
             fsStoreProductTagRelationScrmMapper.deleteByProductId(productId);
         }
         int result = fsStoreProductMapper.deleteFsStoreProductById(productId);
@@ -797,6 +802,10 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
         } else {
             addProductAttr(product.getProductId(),param.getItems(),param.getValues());
         }
+        fsStoreProductUserEndCategoryMapper.deleteByProductId(product.getProductId());
+        if (param.getUserEndCategoryIds() != null && !param.getUserEndCategoryIds().isEmpty()) {
+            fsStoreProductUserEndCategoryMapper.insertBatch(product.getProductId(), param.getUserEndCategoryIds());
+        }
         fsStoreProductTagRelationScrmMapper.deleteByProductId(product.getProductId());
         if (param.getTagIds() != null && !param.getTagIds().isEmpty()) {
             if (param.getTagIds().size() > 3) {
@@ -1748,4 +1757,12 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
         }
         return fsStoreProductTagRelationScrmMapper.selectTagIdsByProductId(productId);
     }
+
+    @Override
+    public List<Long> selectUserEndCategoryIdsByProductId(Long productId) {
+        if (productId == null) {
+            return Collections.emptyList();
+        }
+        return fsStoreProductUserEndCategoryMapper.selectCategoryIdsByProductId(productId);
+    }
 }