diff --git a/collection/opendb-mall-sku/collection.json b/collection/opendb-mall-sku/collection.json index bd97304..aec4491 100644 --- a/collection/opendb-mall-sku/collection.json +++ b/collection/opendb-mall-sku/collection.json @@ -8,7 +8,8 @@ }, "goods_id": { "bsonType": "string", - "description": "商品 id,参考 opendb-mall-goods 表" + "description": "商品 id,参考 opendb-mall-goods 表", + "foreignKey":"opendb-mall-goods._id" }, "sku_name": { "bsonType": "string", @@ -16,11 +17,11 @@ }, "price": { "bsonType": "int", - "description": "价格" + "description": "价格,以分为单位,避免浮点计算的精度问题" }, "market_price": { "bsonType": "int", - "description": "市场价" + "description": "市场价,以分为单位,避免浮点计算的精度问题" }, "stock": { "bsonType": "int", @@ -36,5 +37,16 @@ } } }, - "index": [] + "index": [ + { + "IndexName": "goods_id_", + "MgoKeySchema": { + "MgoIndexKeys": [{ + "Name": "goods_id", + "Direction": "1" + }], + "MgoIsUnique": false + } + } + ] } diff --git a/collection/opendb-news-comments/collection.json b/collection/opendb-news-comments/collection.json index 8e13681..d4462f7 100644 --- a/collection/opendb-news-comments/collection.json +++ b/collection/opendb-news-comments/collection.json @@ -66,7 +66,7 @@ }, "data": [], "index": [ - { + { "IndexName": "article_id_", "MgoKeySchema": { "MgoIndexKeys": [{ diff --git a/opendb-mall.md b/opendb-mall.md index 6275f1b..5241078 100644 --- a/opendb-mall.md +++ b/opendb-mall.md @@ -15,10 +15,10 @@ | goods_desc | String | 否 | 商品详细描述 | | goods_thumb | String | 否 | 商品缩略图,用于在列表或搜索结果中预览显示 | | goods_banner_imgs | Array | 否 | 商品详情页的banner图地址 | -| remain_count | Integer | 是 | 库存数量 | -| month_sell_count | Integer | 是 | 月销量 | -| total_sell_count | Integer | 是 | 总销量 | -| comment_count | Integer | 是 | 累计评论数 | +| remain_count | int | 是 | 库存数量 | +| month_sell_count | int | 是 | 月销量 | +| total_sell_count | int | 是 | 总销量 | +| comment_count | int | 是 | 累计评论数 | | is_real | Boolean | 是 | 是否实物 | | is_on_sale | Boolean | 是 | 是否上架销售 | | is_alone_sale | Boolean | 是 | 是否能单独销售;如果不能单独销售,则只能作为某商品的配件或者赠品销售| @@ -29,6 +29,27 @@ | last_modify_date | Timestamp | 否 | 最后修改时间 | | seller_note | String | 否 | 商家备注,仅商家可见 | +### 商品 SKU 表 + +表名:opendb-mall-sku + +名词解释:sku:Stock Keeping Unit。 + +sku 在电商系统中可定义库存控制的最小单元,同一个商品如有多个属性,则可定义多个sku。举例来说,某手机有8G内存和16G内存,则可定义两个sku,表示这种型号的差异。 + +理论上,基于商品的每个属性差异,可定义多个sku,比如颜色、重量、大小、材质等,故opendb中的商品sku,仅定义通用售价、库存数量等参数,各属性差异可由开发者自行扩展。 + +| 字段 | 类型 | 必填 | 描述 | +| ---------------- | --------- | ---- | ------------------------------------------- | +| \_id | Object ID | 是 | 存储文档 ID(文章 ID),系统自动生成 | +| goods_id | String | 是 | 商品 id,参考 opendb-mall-goods 表 | +| sku_name | String | 是 | SKU名称 | +| price | int | 是 | 价格,以分为单位,避免浮点计算的精度问题 | +| market_price | int | 否 | 市场价,以分为单位,避免浮点计算的精度问题 | +| stock | int | 是 | 库存数量 | +| create_date | Timestamp | 是 | 创建时间 | +| update_date | Timestamp | 否 | 修改时间 | + ### 商品类别 表名:opendb-mall-categories