商品分类和商品类型新增店铺控制
This commit is contained in:
parent
fe9c33009e
commit
669bd33b5f
@ -83,4 +83,7 @@ public class ShopBaseProductType implements Serializable {
|
|||||||
@TableField(updateStrategy=NOT_EMPTY)
|
@TableField(updateStrategy=NOT_EMPTY)
|
||||||
private Integer type_buildin;
|
private Integer type_buildin;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "所属店铺")
|
||||||
|
private Integer store_id;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,6 +21,8 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.suisung.mall.common.utils.ContextUtil.getCurrentUser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 商品类型表-强调共性,类别cat是强调区别. 前端控制器
|
* 商品类型表-强调共性,类别cat是强调区别. 前端控制器
|
||||||
@ -56,7 +58,9 @@ public class ShopBaseProductTypeController {
|
|||||||
@RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
|
@RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
|
||||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||||
QueryWrapper<ShopBaseProductType> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<ShopBaseProductType> queryWrapper = new QueryWrapper<>();
|
||||||
|
Integer store_id = Convert.toInt(getCurrentUser().getStore_id());
|
||||||
queryWrapper.orderByAsc("type_id");
|
queryWrapper.orderByAsc("type_id");
|
||||||
|
queryWrapper.eq("store_id", store_id);
|
||||||
if (CheckUtil.isNotEmpty(shopBaseProductType.getType_name())) {
|
if (CheckUtil.isNotEmpty(shopBaseProductType.getType_name())) {
|
||||||
queryWrapper.like("type_name", shopBaseProductType.getType_name());
|
queryWrapper.like("type_name", shopBaseProductType.getType_name());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -245,11 +245,13 @@ public class ShopBaseProductCategoryServiceImpl extends BaseServiceImpl<ShopBase
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Map> getCategoryTree() {
|
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)) {
|
if (CollUtil.isNotEmpty(cateTree)) {
|
||||||
return cateTree;
|
return cateTree;
|
||||||
}
|
}
|
||||||
QueryWrapper<ShopBaseProductCategory> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<ShopBaseProductCategory> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("store_id", store_id);
|
||||||
queryWrapper.orderByAsc("category_order");
|
queryWrapper.orderByAsc("category_order");
|
||||||
List<Map> categories = Convert.toList(Map.class, find(queryWrapper));
|
List<Map> categories = Convert.toList(Map.class, find(queryWrapper));
|
||||||
categories = shopProductBaseService.fixProductTypeDate(categories);
|
categories = shopProductBaseService.fixProductTypeDate(categories);
|
||||||
@ -271,7 +273,6 @@ public class ShopBaseProductCategoryServiceImpl extends BaseServiceImpl<ShopBase
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private List<Map> getCategoryTreeMap(QueryWrapper<ShopBaseProductCategory> queryWrapper, Integer category_parent_id) {
|
private List<Map> getCategoryTreeMap(QueryWrapper<ShopBaseProductCategory> queryWrapper, Integer category_parent_id) {
|
||||||
List<ShopBaseProductCategory> list = find(queryWrapper);
|
List<ShopBaseProductCategory> list = find(queryWrapper);
|
||||||
return buildTreeMap(list, category_parent_id);
|
return buildTreeMap(list, category_parent_id);
|
||||||
|
|||||||
2
sql/shop/dev/202506013_3_dml.sql
Normal file
2
sql/shop/dev/202506013_3_dml.sql
Normal 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;
|
||||||
Loading…
Reference in New Issue
Block a user