ï¼éæ±
æ建ä¸ä¸ªçµåéç¨åååä¸å¿ï¼å¯æ¯æååçç§ç±»åå±æ§ç¹å¤ï¼å¯ä»¥å®åå®ç©ãèæãä¼åãæå¡ç±»ååãæ¯ä¸ç§ååå ·æä¸åçè§æ ¼ï¼ä¸åçè§æ ¼çååæå¤ç§ä»·æ ¼ï¼ååå¯æ¯æå¤ç§è´§å¸çæ¯ä»ã
1ï¼ç®çæ¯ä»ä¹ï¼
带大家ä¸èµ·å®ç°ä¸ä¸ªéç¨åååä¸å¿ï¼ä»ä¸å¦å°ä¸äºæ©å±æ§è®¾è®¡ææ³ã
2ï¼ä½ è½å¦å°ä»ä¹ï¼
- ç解è¡ä¸æ¯è¯åæ¦å¿µ
- å¨æsku表å设计
- å±æ§åskuæ©å±æ§è®¾è®¡
- ä»·æ ¼æ©å±æ§è®¾è®¡
- ååè§æ ¼è®¾è®¡
3ï¼ä¸è½å¦å°ä»ä¹ï¼
- ååå¾çåå¨è®¾è®¡
- ååä¸ä¸æ¶è®¾è®¡
- ååæ ç¾è®¾è®¡
- åºå设计
- æç´¢çé设计
2 ååçåºæ¬æ¦å¿µ
ååä¸å¿æ¯çµåå个系ç»çæåºç¡åå ï¼ä¸ºååã订åï¼ä¼æ ä¿éãåºåãä»å¨ç©æµçç³»ç»æä¾åºç¡æ°æ®ã
çµåçåºæ¬æ¯è¯ï¼
- SKUï¼ï¼Stock Keeping Uintï¼å³åºåéåä½ï¼ï¼åºåæ§å¶çæå°å¯ç¨åä½ãä¾å¦âiPhone 7 Plus 128Gé¶è²âå°±æ¯ä¸ä¸ªSKUï¼ä»åºç®¡çãéè´è¿è´§ãåºå管çé½æ¯ä»¥SKU为记å½åå ã
- SPUï¼ï¼Standard Product Unitï¼å³æ åå产ååå ï¼ï¼æ¯ä¸ç»æ ååä¿¡æ¯çéåï¼ä¾å¦âiPhone 7 Plusâå°±æ¯ä¸ä¸ªSPUã
-
ç±»ç®ï¼å³åç±»æ ãçµå常ç¨çæ两å±ç±»ç®ï¼åå°å±ç¤ºç±»ç®åå端ååç±»ç®ã
åå°ç±»ç®æçæ¯å±ç¤ºç»æ¶è´¹è ççç±»ç®ï¼ä¼æ ¹æ®å£èãéå®çç¥ãæ´»å¨è¿è¡åå¨ï¼
åå°ç±»ç®å±äºåºç¡æ°æ®ï¼ä¸å¯éæåå¨ï¼æ·»å SKUæ¶é½éè¦éæ©åå°ç±»ç®ï¼è¿è¡ç»å®ã
- å±æ§ï¼åä¸ºå ³é®å±æ§ãéå®å±æ§ãéå ³é®å±æ§ãç¹æ®å±æ§ã
- å ³é®å±æ§ æ¯æè½å¤å¯ä¸ç¡®å®äº§åçå±æ§ï¼æ¯å¿ 填项ï¼ä¾å¦ææºçå±å¹å°ºå¯¸ãåå·å±äºå ³é®å±æ§ã
- éå®å±æ§ æ¯ç»æSKUçç¹æ®å±æ§ï¼æ称为âè§æ ¼å±æ§âï¼ä¾å¦ææºçâé¢è²âãâå åâã
- éå ³é®å±æ§ æçæ¯é¤å ³é®å±æ§ãéå®å±æ§å¤çå ¶ä»å±æ§ï¼å¦åç½®æ象头åç´ ãåç½®æå头åç´ ã产å°ãå辨çã
- ç¹æ®å±æ§ æéè¦éè¿è°ç¨å ¶ä»æå¡æè½è·åå°çå±æ§ã
3 ååæ¶æå¾
åèä¸é¢çååç»æ模åå¾ï¼åå模åçç»æè¾ä¸ºå¤æï¼å¨å®ä¹SKUä¸SPUæ¶ï¼æ¶åç±»ç®ãå±æ§ãåçãç产信æ¯çæ°æ®çç»åï¼å¨å®ä¹åºSKUååå建SPUï¼å¨SPUä¸æ·»å ååæè¿°åè§æ ¼æåå°±æäºååãæ ¹æ®åååè¡çåºäºä»·æ ¼ç®¡çãè¯è®ºç®¡çãæç´¢çéç模åã
3.1 ååç»æ模åå¾
3.2 ååä¸å¿æ ¸å¿ERå¾
3.3 ååä¸å¿æ´ä½æ¶æå¾
4 ååç±»ç®
4.1 ç±»ç®ç®¡ç
ååç±»ç®å为两å±ï¼åºç¡æ°æ®ç±»ç®å±ï¼åå°ç±»ç®ï¼ãåå°å±ç¤ºç±»ç®å±ï¼åå°ç±»ç®ï¼ãé£ä¸ºä»ä¹è¦å°åãåå°ç±»ç®åå¼ç®¡çï¼èä¸æ¯åãåå°å ±ç¨ä¸å¥ç±»ç®å¢ï¼
åå°ç±»ç®é¢åå家æä¾åºé¾äººåï¼ååå±æ§ãéå®å±æ§ååççå¾å¤æ°æ®é½æ¯å¨åºç¡ç±»ç®ä¸è¿è¡ç®¡çï¼
åå°ç±»ç®é¢åç¨æ·ï¼æ¹ä¾¿ç¨æ·æ¥æ¾ååï¼è¿å¯ä»¥éçè¿è¥éè¦å»è°æ´ãæ¯å¦èä¸éçèæ¥ãæ¶ä»¤å£èååï¼è¿è¥ä¼ç»å¸¸åæ´åå°ç±»ç®ã
4.2 åå°ç±»ç®
åå°ç±»ç®ä¸»è¦é¢åå¹³å°è¿è¥äººåæå家ï¼ç¨äºç®¡çååãå±æ§ååççæ°æ®ã
åå°ç±»ç®ç¸å¯¹åºå®ï¼ç¡®å®äºä¹åä¸ä¼è½»æåæ´æå é¤ï¼å¦æç±»ç®ä¸æè½½æååï¼å°±ä¸è½å é¤æä½åºã
ç±»ç®æ çå±æ¬¡ä¸è½å¤ªæ·±ï¼ä¸è¬ä¸å±æåå±ãå¦æ太深ï¼å¯¹äºååç管çä¸å¤ªæ¹ä¾¿ãç±»ç®æ ä¸æåä¸å±ç±»ç®ç§°ä¸ºå¶åç±»ç®ï¼ååå¿ é¡»æè½½äºå¶åç±»ç®ä¸ã
4.3 åå°ç±»ç®
åå°ç±»ç®ä¸»è¦é¢åç¨æ·ï¼æ¹ä¾¿ç¨æ·çéæ¥æ¾ååï¼å¦å¾å¾æ示ã
åå°ç±»ç®å¯ä»¥æ ¹æ®è¿è¥éè¦ï¼çµæ´»å¤åãæ以å¤çååçå端类ç®æ¶ï¼å°±åºè¯¥æä¾å¤æ ·åçå端类ç®æ¥æ¯æã
åå°ç±»ç®å¯æ¯æä¸å客æ·ç«¯ç设置ãPC端ãH5端ãAPP端ç
åå°ç±»ç®ä¸åäºåºå®çåå°ç±»ç®ï¼ç¼è¾å¾çµæ´»ãå¯éå ãå¯å é¤ãå¯éæ¶åå¨ï¼å®æ¶çæã
4.4 ç±»ç®è¡¨ç»æ设计
4.1.1 å端类ç®è¡¨è®¾è®¡
CREATE TABLE `category` (
`id` bigint(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
`name` varchar(32) NOT NULL COMMENT 'ç±»ç®å称',
`parent_id` bigint(11) NOT NULL COMMENT 'ç¶id',
`leaf` tinyint(4) NOT NULL COMMENT 'æ¯å¦å¶åèç¹ 1æ¯ 0ä¸æ¯',
`level` tinyint(4) NOT NULL COMMENT 'ç±»ç®å±çº§',
`path` varchar(128) DEFAULT NULL COMMENT 'å®æ´ç¶çº§è·¯å¾ï¼ç¶ç¶id_ç¶id',
`sort` int(11) unsigned NOT NULL COMMENT 'æåºå段',
`status` tinyint(4) NOT NULL COMMENT 'åç±»ç¶æ:1ä¸æ¶ 2ä¸æ¶',
`del` tinyint(4) unsigned NOT NULL COMMENT 'æ¯å¦å é¤',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'å建æ¶é´',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'æ´æ°æ¶é´',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='ç±»ç®è¡¨';
4.4.2 å端类ç®æ°æ®å±ç¤º
5 SKU
SKUç®æ¯çµåä¸æåºç¡çæ¦å¿µï¼SKUæ¯æå°åºååå ã
以iPhone 8 Plusï¼SPUï¼ä¸ºä¾ï¼è¿ä¸ªSPUçè§æ ¼æå¤ç§ï¼é¢è²å å«é è²ãç½è²ãé»è²ãç«ç°éãé¶è²ã亮é»ã红è²ç6ç§ï¼å åå å«32Gã 128Gã256Gç3ç§ï¼ï¼å¯¹åº18ï¼å³3Ã6ï¼ç§SKUãæ¯å¦âiPhone 7 Plusç½ è²32GâãâiPhone 7 Plusé»è²32Gâè¿ä¸¤ä¸ªSKUé½è½å ·åå°å®ç©ãä»åºç³»ç»ãéè´ç³»ç»ãåºåç³»ç»çç³»ç»é½æ¯ä¸»è¦ç®¡çSKUã
5.1 sku表设计
CREATE TABLE `sku` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`sku_no` varchar(32) DEFAULT '' COMMENT 'åååºåå·',
`sku_name` varchar(50) DEFAULT NULL COMMENT 'ååå称',
`sku_description` varchar(256) DEFAULT NULL COMMENT 'ååæè¿°',
`sku_type` tinyint(4) DEFAULT NULL COMMENT 'ååç±»åï¼1å®ç©ååã2ä¼åååã3å¢å¼ååï¼4èæç©å',
`status` tinyint(4) NOT NULL COMMENT 'ç¶æ 1æªä¸æ¶2.å·²ä¸æ¶ 3.å·²ä¸æ¶',
`sort` int(10) DEFAULT '0' COMMENT 'æåº',
`boundle` tinyint(4) unsigned DEFAULT '0' COMMENT 'æ¯å¦ç»ååå 1æ¯ 0å¦',
`create_by` int(11) unsigned NOT NULL COMMENT 'å建人ID',
`update_by` int(11) unsigned DEFAULT NULL COMMENT 'ä¿®æ¹äººID',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'å建æ¶é´',
`update_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT 'æ´æ°æ¶é´',
PRIMARY KEY(`id`) USING BTREE,
UNIQUE KEY `uk_sku_no` (`sku_no`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 DEFAULT CHARSET = utf8mb4 COMMENT = 'åå表'
5.2 sku表æ°æ®
5.3 skuå±æ§è¡¨
æ©å±æ§1ï¼å¨ææ éå¶å建å±æ§æ°éã
CREATE TABLE `sku_attr` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`sku_no` varchar(32) DEFAULT '' COMMENT 'åååºåå·',
`sku_attrs` json DEFAULT NULL COMMENT 'skuå±æ§ï¼ååå±æ§ï¼',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'å建æ¶é´',
`update_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT 'æ´æ°æ¶é´',
PRIMARY KEY(`id`) USING BTREE,
UNIQUE KEY `uk_sku_no` (`sku_no`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 DEFAULT CHARSET = utf8mb4 COMMENT = 'ååå±æ§è¡¨'
5.4 skuå±æ§æ°æ®
ä¸å建æ°å段ï¼è¿å¯ä»¥ç¨sqlæ¥è¯¢ï¼ä½ å¾å°äºä»ä¹å¯åï¼
5.5 skuå¨æ表å
æ©å±æ§2ï¼æ ¹æ®ä¸åç±»ç®å è½½ä¸åå±æ§æ¸²æå¨æ表åã
å°ä¸ç»å±æ§æè½½å°ç±»ç®æ¥å®ç°å¨æ表åï¼ä½ å¾å°äºä»ä¹å¯åï¼
5.6 ååç±»ç®å ³è
CREATE TABLE `category_to_goods` (
`id` bigint(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
`category_id` bigint(20) DEFAULT NULL COMMENT 'ç±»ç®id',
`goods_no` varchar(32) DEFAULT NULL COMMENT 'ååç¼å·',
`goods_type` tinyint(4) DEFAULT NULL COMMENT 'ååç±»åï¼1skuã2spu',
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT 'å建æ¶é´',
`update_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT 'æ´æ°æ¶é´',
`is_deleted` tinyint(4) unsigned NOT NULL DEFAULT '0' COMMENT 'æ¯å¦å é¤:0-å¦ï¼1-æ¯',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COMMENT='ç±»ç®ååå
³è表';
5.7 ç»åskuå ³ç³»è¡¨
CREATE TABLE `bundle_to_sku` (
`id` bigint(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
`goods_id` bigint(20) DEFAULT NULL COMMENT 'ååid, ç»åååid',
`bundle_id` bigint(20) DEFAULT NULL COMMENT 'ç»åååid',
`quantity` int(11) DEFAULT NULL COMMENT 'ååæ°é',
`entity_type` tinyint(4) DEFAULT '1' COMMENT 'ååçç±»å:1sku,2ç»ååå',
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT 'å建æ¶é´',
`update_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT 'æ´æ°æ¶é´',
`is_deleted` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT 'æ¯å¦å é¤:0-å¦ï¼1-æ¯',
PRIMARY KEY (`id`) USING BTREE,
KEY `idx_bundle_to_goods_bundle_id_index` (`bundle_id`) USING BTREE,
KEY `idx_bundle_to_goods_object_id_entity_type_index` (`object_id`,`entity_type`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='å¥è£
åskuå
³è表||å¥è£
åspuå
³è表';
5.8 ç»åskuå ³ç³»æ°æ®
skuæ°æ®
5.9 å建ç»ååå表å
6 å±æ§
6.1 å±æ§ç®¡ç
为äºæ¹ä¾¿åå管çï¼æ们éè¦å¨ç³»ç»ä¸å»ºç«ä¸å¥å±æ§åºãå¨å®ä¹ä¸ä¸ªå±æ§æ¶ï¼éè¦æè½½å¨ç±»ç®ä¸ï¼åºåå±æ§åç±»ï¼å ³é®å±æ§ãéå®å±æ§ãéå ³é®å±æ§ãç¹æ®å±æ§ï¼ï¼å¹¶ç¡®å®å±æ§å¼ãæ¾ç¤ºç±»åï¼åéãå¤éãå¯èªå®ä¹ï¼ãæ¯å¦å¿ å¡«ã
6.2 å±æ§çåºç¨åºæ¯
- æ·»å ååæ¶åçåå表å渲æãå¨æ·»å ååæ¶ï¼å¯éè¿éæ©å¶åç±»ç®ï¼å°æè½½å°å¶åç±»ç®çå±æ§æ¸²æå°è¡¨åä¸ã
- å¨å®¢æ·ç«¯å¯¹å¯æ ¹æ®ä¸åçå±æ§è¿è¡æç´¢ãçéååã
- å¨spu页é¢ç¨æ·å¯å©ç¨ååè§æ ¼(éå®å±æ§)æ¥å®ä½åºä¸åçskuã
- åå详æ 页é¢å¯å±ç¤ºåºåå°é ç½®çå±æ§åæ°æ°æ®ã
6.3 å±æ§è¡¨è®¾è®¡
CREATE TABLE `attribute` (
`id` bigint(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
`name` varchar(32) NOT NULL DEFAULT '' COMMENT 'å±æ§å称',
`code` varchar(32) DEFAULT NULL COMMENT 'å±æ§ä»£ç (éå¿
å¡«)',
`attr_type` tinyint(4) NOT NULL COMMENT 'å±æ§åºç¨:1ååå±æ§,2éå®å±æ§,3ç¹æ®å±æ§',
`value_type` tinyint(4) DEFAULT NULL COMMENT 'å±æ§å¼ç±»å:1ï¼å符串,2ï¼æ°å',
`fill_type` tinyint(4) NOT NULL COMMENT 'å¡«åç±»å:1å¡«ååï¼å符ï¼,2å¡«ååï¼ä»
æ´æ°æ°åï¼,3éæ©åï¼åéå¼,éidï¼4éæ©åï¼å¤éå¼,éidï¼,5å¤è¾å
¥æ¡å±ç¤ºå',
`is_filter` tinyint(4) unsigned NOT NULL COMMENT 'æ¯å¦æ¯æåå°çé:0å¦ 1æ¯',
`status` tinyint(11) NOT NULL COMMENT 'ç¶æ:1 æªä¸æ¶ 2å·²ä¸æ¶ 3å·²ä¸æ¶',
`is_deleted` tinyint(4) unsigned NOT NULL COMMENT 'æ¯å¦å é¤',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'å建æ¶é´',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'ä¿®æ¹æ¶é´',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COMMENT='å±æ§è¡¨';
6.4 å±æ§è¡¨æ°æ®
6.5 å±æ§æ举表设计
CREATE TABLE `attribute_enum` (
`id` bigint(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
`attr_id` bigint(20) NOT NULL COMMENT 'å±æ§id',
`attr_code` varchar(32) DEFAULT NULL,
`enum_code` bigint(11) DEFAULT NULL COMMENT 'enumcode',
`enum_value` varchar(32) NOT NULL COMMENT 'å±æ§æ举å¼å称',
`sort` int(11) NOT NULL COMMENT 'æåº',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'å建æ¶é´',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'æ´æ°æ¶é´',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='å±æ§æ举表';
6.6 å±æ§æ举表æ°æ®
6.7 å±æ§åç±»ç®å ³è表设计
CREATE TABLE `category_to_attr` (
`id` bigint(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
`category_id` bigint(11) NOT NULL COMMENT 'åç±»id',
`attr_id` bigint(20) NOT NULL COMMENT 'å±æ§id',
`is_required` tinyint(4) unsigned NOT NULL COMMENT 'æ¯å¦å¿
å¡«',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'å建æ¶é´',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'æ´æ°æ¶é´',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='åç±»å±æ§å
³è表';
6.8 å¨æçæå±æ§è¡¨å
å½å±æ§åºæ建å®æåï¼å°±ä¼è¢«å个å¶åç±»ç®è°ç¨ï¼æ·»å ååæ¶å°±éè¦å¡«åè¿äºå±æ§ï¼ååå°±æäºè½½ä½ï¼å¦å¾æ示ã
æ ¹æ®è¿äºå±æ§ä¾¿è½ç¡®å®ååçå¯ä¸æ§ï¼SKUï¼ã æ·å®çååå±æ§ï¼ç±»ç®âç·è£ âââé£è¡£âï¼ ç¹å«éè¦æ³¨æçæ¯ä¸äºè§æ ¼å±æ§ï¼å¦é¢è²ãå°ºç çï¼ãå¾å¤äº§åæ å¤è§æ ¼ï¼ä¾å¦è¡£æãéåçã以ä¸åç·é为ä¾ï¼æé¢è²ï¼å设ç½ã红ã é»3ç§é¢è²ï¼ï¼æå°ºç ï¼ä»39ï½44å ±6ç§å°ºç ï¼ï¼é£ä¹è¿ä¸ªSPUï¼ç·éï¼ ä¸é¢å°±æ18个SKUãè¿äºSKUçå±æ§é¤äºè§æ ¼å±æ§å¤ï¼å ¶ä»å±æ§é½æ¯ä¸ è´çï¼æ以å¨æ°å»ºååæ¶ï¼å¯èåå°ä¸èµ·ï¼å ±ç¨å ¶ä»å±æ§ã
7 SPU
7.1 SPUæ¦å¿µ
SPU æ¯æ åå产ååå ãSPUä¸SKUçå ³ç³»æ许å¤ç§ï¼å¯ä»¥ä¸å¯¹å¤ãä¸å¯¹ä¸ï¼ ç»å¤§é¨åSPUä¸SKUé½æ¯ä¸å¯¹ä¸ï¼å¤è§æ ¼çSPUåSKUä¹é´æ¯éè¿è§æ ¼å±æ§æ¥è¿æ¥çãSPUçåºåæ¯ç±å ¶å¯¹åºçSKUåºåå ±åå³å®çã
以iPhone 11ï¼SPUï¼ä¸ºä¾ï¼è¿ä¸ªSPUçè§æ ¼æå¤ç§ï¼é¢è²å å«ç½è²ãé»è²ãé»éãç´«è²ã绿è²ã红è²ç6ç§ï¼å åå å«32Gã 128Gã256Gç3ç§ï¼ï¼å¯¹åº18ï¼å³3Ã6ï¼ç§SKUãæ¯å¦âiPhone 11 ç½è² 64GâãâiPhone 11 é»è² 64Gâè¿ä¸¤ä¸ªSKUé½è½å ·åå°å®ç©ãä»åºç³»ç»ãéè´ç³»ç»ãåºåç³»ç»çç³»ç»é½æ¯ä¸»è¦ç®¡çSKUã å¨æ¥å¸¸è¿è¥ä¸ä¹å¾å¸¸è§ä¸ä¸ªSKU对åºå¤ä¸ªSPUã
7.2 SPUåè§æ ¼è®¾è®¡
CREATE TABLE `spu` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
`name` varchar(64) DEFAULT NULL COMMENT 'spuå称',
`detail` varchar(256) DEFAULT NULL COMMENT 'ååä»ç»',
`status` tinyint(4) DEFAULT NULL COMMENT 'ç¶æ 1æªä¸æ¶2.å·²ä¸æ¶ 2.å·²ä¸æ¶',
`spu_specs` json DEFAULT NULL COMMENT 'ååè§æ ¼',
`creator_id` bigint(20) DEFAULT NULL COMMENT 'å建è
',
`is_deleted` tinyint(1) unsigned DEFAULT '0' COMMENT 'æ¯å¦å é¤ï¼0:æªå é¤ 1:å·²å é¤',
`sort` int(10) DEFAULT '0' COMMENT 'æåº',
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT 'å建æ¶é´',
`update_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT 'æ´æ°æ¶é´',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='spu';
7.3 SPUåè§æ ¼æ°æ®
skuå±æ§æ°æ®
spu表åå¾ç
7.4 spuåskuå ³è表
CREATE TABLE `spu_to_sku` (
`id` bigint(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
`sku_no` varchar(32) NOT NULL DEFAULT '' COMMENT 'sku id',
`spu_no` varchar(32) NOT NULL DEFAULT '' COMMENT 'spu id',
`is_deleted` tinyint(1) DEFAULT '0' COMMENT 'æ¯å¦å é¤ï¼0:æªå é¤ 1:å·²å é¤',
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT 'å建æ¶é´',
`update_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT 'æ´æ°æ¶é´',
PRIMARY KEY (`id`) USING BTREE,
KEY `idx_spu_to_sku` (`spu_no`,`sku_no`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COMMENT='spuååå
³è表';
8 ä»·æ ¼è®¾è®¡
ä»·æ ¼å æ¬ï¼ææ¬ä»·ãåä»·ãå®åä»·ãå®éãè¨èéçä¼éçéæ±çä¸æå¢å ï¼å°¤å ¶æ¯ä¸äºå¨çº¿æè²çåç´è¡ä¸çµå对éé¢ä¼æåç§ç©æ³ã
CREATE TABLE `sku_price` (
`id` bigint(11) NOT NULL AUTO_INCREMENT,
`sku_id` bigint(11) unsigned NOT NULL COMMENT 'ååid',
`sku_no` varchar(20) NOT NULL DEFAULT '' COMMENT 'ååç¼å·',
`sku_type` tinyint(4) NOT NULL COMMENT 'ååç±»å: 1åsku 2ç»åsku',
`sub_goods` tinyint(4) NOT NULL COMMENT 'æ¯å¦ååå:0å¦1æ¯',
`bundle_id` bigint(20) DEFAULT NULL COMMENT 'ç»åååid é»è®¤ 空',
`price` decimal(10, 2) NOT NULL COMMENT 'ä»·æ ¼',
`price_type` varchar(32) NOT NULL COMMENT 'ä»·æ ¼ç±»åæ举ï¼1.åååä»·REAL_PRICE 2.å®åä»·SELL_PRICE 3.å®ååºä»·... ï¼',
`currency_type` tinyint(4) NOT NULL DEFAULT '1' COMMENT 'è´§å¸ç±»å:1人æ°å¸ 2èæå¸',
`enable` tinyint(4) unsigned DEFAULT '1' COMMENT 'æ¯å¦å¯ç¨ 0 ä¸å¯ç¨ 1 å¯ç¨',
`create_by` int(11) unsigned NOT NULL COMMENT 'å建人ID',
`update_by` int(11) unsigned DEFAULT NULL COMMENT 'ä¿®æ¹äººID',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'å建æ¶é´',
`update_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT 'æ´æ°æ¶é´',
PRIMARY KEY (`id`) USING BTREE,
KEY `idx_sku_id` (`sku_id`) USING BTREE,
KEY `idx_sku_no` (`sku_no`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 DEFAULT CHARSET = utf8mb4 COMMENT = 'ååä»·æ ¼è¡¨' "
æ©å±æ§3ï¼ä¸å建æ°å段ï¼åä¸ä¸ªååå¯æ¯æå¤ç§ä»·æ ¼åè´§å¸ç§ç±»
9 æ»ç»
æ¬æ详ç»ä»ç»äºååä¸å¿è®¾è®¡æ©å±æ§è®¾è®¡ææ³ï¼å¹¶å¨è®¾è®¡æ¹é¢åäºå维度åæã
æ©å±æ§æ»ç»å¦ä¸ï¼
- å¨ææ éå¶å建å±æ§æ°éã
- æ ¹æ®ä¸åç±»ç®å è½½ä¸åå±æ§æ¸²æå¨æ表åã
- ä¸å建æ°å段ï¼åä¸ä¸ªååå¯æ¯æå¤ç§ä»·æ ¼åè´§å¸ç§ç±»ã
å¸æèªå·±æ»ç»çæ©å±æ§ææ³å¯ä»¥è®©å¤§å®¶å¨å¼åè¿ç¨ä¸ææå¯åã
æç« æ¥æºï¼äº¬ä¸ç©æµ_é«å³°_https://zhuanlan.zhihu.com/p/618405659