商品分类和商品类型新增店铺控制

This commit is contained in:
liyj 2025-06-13 17:41:04 +08:00
parent fe9c33009e
commit 669bd33b5f
4 changed files with 12 additions and 2 deletions

View File

@ -83,4 +83,7 @@ public class ShopBaseProductType implements Serializable {
@TableField(updateStrategy=NOT_EMPTY)
private Integer type_buildin;
@ApiModelProperty(value = "所属店铺")
private Integer store_id;
}

View File

@ -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;
/**
* <p>
* 商品类型表-强调共性,类别cat是强调区别. 前端控制器
@ -56,7 +58,9 @@ public class ShopBaseProductTypeController {
@RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
QueryWrapper<ShopBaseProductType> 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());
}

View File

@ -245,11 +245,13 @@ public class ShopBaseProductCategoryServiceImpl extends BaseServiceImpl<ShopBase
@Override
public List<Map> getCategoryTree() {
List<Map> cateTree = Convert.toList(Map.class, redisService.get(RedisConstant.Product_Cate_Key));
Integer store_id = Convert.toInt(getCurrentUser().getStore_id());
List<Map> cateTree = Convert.toList(Map.class, redisService.get(RedisConstant.Product_Cate_Key+":"+store_id));
if (CollUtil.isNotEmpty(cateTree)) {
return cateTree;
}
QueryWrapper<ShopBaseProductCategory> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("store_id", store_id);
queryWrapper.orderByAsc("category_order");
List<Map> categories = Convert.toList(Map.class, find(queryWrapper));
categories = shopProductBaseService.fixProductTypeDate(categories);
@ -271,7 +273,6 @@ public class ShopBaseProductCategoryServiceImpl extends BaseServiceImpl<ShopBase
return list;
}
private List<Map> getCategoryTreeMap(QueryWrapper<ShopBaseProductCategory> queryWrapper, Integer category_parent_id) {
List<ShopBaseProductCategory> list = find(queryWrapper);
return buildTreeMap(list, category_parent_id);

View File

@ -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;