diff --git a/mall-common/src/main/java/com/suisung/mall/common/modules/base/ShopBaseProductType.java b/mall-common/src/main/java/com/suisung/mall/common/modules/base/ShopBaseProductType.java index 033c85aa..0901b1a7 100644 --- a/mall-common/src/main/java/com/suisung/mall/common/modules/base/ShopBaseProductType.java +++ b/mall-common/src/main/java/com/suisung/mall/common/modules/base/ShopBaseProductType.java @@ -83,4 +83,7 @@ public class ShopBaseProductType implements Serializable { @TableField(updateStrategy=NOT_EMPTY) private Integer type_buildin; + @ApiModelProperty(value = "所属店铺") + private Integer store_id; + } diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/base/controller/admin/ShopBaseProductTypeController.java b/mall-shop/src/main/java/com/suisung/mall/shop/base/controller/admin/ShopBaseProductTypeController.java index 11e5d72e..91874bb6 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/base/controller/admin/ShopBaseProductTypeController.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/base/controller/admin/ShopBaseProductTypeController.java @@ -21,6 +21,8 @@ import org.springframework.web.bind.annotation.RestController; import java.util.Arrays; import java.util.List; +import static com.suisung.mall.common.utils.ContextUtil.getCurrentUser; + /** *

* 商品类型表-强调共性,类别cat是强调区别. 前端控制器 @@ -56,7 +58,9 @@ public class ShopBaseProductTypeController { @RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) { QueryWrapper queryWrapper = new QueryWrapper<>(); + Integer store_id = Convert.toInt(getCurrentUser().getStore_id()); queryWrapper.orderByAsc("type_id"); + queryWrapper.eq("store_id", store_id); if (CheckUtil.isNotEmpty(shopBaseProductType.getType_name())) { queryWrapper.like("type_name", shopBaseProductType.getType_name()); } diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/base/service/impl/ShopBaseProductCategoryServiceImpl.java b/mall-shop/src/main/java/com/suisung/mall/shop/base/service/impl/ShopBaseProductCategoryServiceImpl.java index 2fde7ee2..90af0436 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/base/service/impl/ShopBaseProductCategoryServiceImpl.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/base/service/impl/ShopBaseProductCategoryServiceImpl.java @@ -245,11 +245,13 @@ public class ShopBaseProductCategoryServiceImpl extends BaseServiceImpl getCategoryTree() { - List cateTree = Convert.toList(Map.class, redisService.get(RedisConstant.Product_Cate_Key)); + Integer store_id = Convert.toInt(getCurrentUser().getStore_id()); + List cateTree = Convert.toList(Map.class, redisService.get(RedisConstant.Product_Cate_Key+":"+store_id)); if (CollUtil.isNotEmpty(cateTree)) { return cateTree; } QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("store_id", store_id); queryWrapper.orderByAsc("category_order"); List categories = Convert.toList(Map.class, find(queryWrapper)); categories = shopProductBaseService.fixProductTypeDate(categories); @@ -271,7 +273,6 @@ public class ShopBaseProductCategoryServiceImpl extends BaseServiceImpl getCategoryTreeMap(QueryWrapper queryWrapper, Integer category_parent_id) { List list = find(queryWrapper); return buildTreeMap(list, category_parent_id); diff --git a/sql/shop/dev/202506013_3_dml.sql b/sql/shop/dev/202506013_3_dml.sql new file mode 100644 index 00000000..e73e2d0a --- /dev/null +++ b/sql/shop/dev/202506013_3_dml.sql @@ -0,0 +1,2 @@ +alter table shop_base_product_type add column `store_id` int unsigned NOT NULL DEFAULT '0' COMMENT '店铺编号'; +alter table shop_base_product_type add index `store_id` (`store_id`) USING BTREE;