/**
Source Server Version: 8.0.31
Source Database: backendsys
Date: 2023/09/05 00:20:22
*/

# 一个订单对应多个商品规格，一条记录显示一个规格信息

DROP TABLE IF EXISTS `b2c_order_snapshoot_good`;
CREATE TABLE `b2c_order_snapshoot_good` (
    PRIMARY KEY (`id`),
    `id` BIGINT AUTO_INCREMENT,
    `order_id` BIGINT NOT NULL COMMENT '订单ID',
    `order_code` VARCHAR(200) NOT NULL COMMENT '订单编号',
    `spec_sku_id` BIGINT NOT NULL COMMENT '规格ID',
    `good_id` BIGINT NOT NULL COMMENT '商品ID (快照)',
    `good_name` VARCHAR(20) NOT NULL COMMENT '商品名称 (快照)',
    `good_description` VARCHAR(500) COMMENT '商品描述 (快照)',
    `good_thumb` VARCHAR(1000) DEFAULT NULL COMMENT '商品缩略图 (快照)',
    `spec_ids` VARCHAR(200) NOT NULL COMMENT '规格ID集合 (快照)',
    `spec_groups` VARCHAR(1000) NOT NULL COMMENT '规格集合 ("名称:值, 名称:值") (快照)',
    `unit_price` DECIMAL(10, 2) NOT NULL COMMENT '单价 (快照)',
    `quantity` BIGINT NOT NULL COMMENT '购买数量 (快照)'
) ENGINE=INNODB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='订单商品快照表';

INSERT INTO b2c_order_snapshoot_good(order_id, order_code, spec_sku_id, good_id, good_name, good_description,
                                     good_thumb, spec_ids, spec_groups, unit_price, quantity) VALUES
    (1, 'OR-4A1630863421851', 1, 1, '测试商品', '测试商品描述内容', '', '1,4', '尺寸:大, 颜色:红', 60, 1),
    (1, 'OR-4A1630863421852', 2, 1, '测试商品', '测试商品描述内容', '', '1,5', '尺寸:大, 颜色:蓝', 50, 2)
;
