This commit is contained in:
2025-10-15 12:33:02 +08:00
parent b252928f83
commit 707a0decd5
2 changed files with 1083 additions and 0 deletions

198
doc/sql/biz-mysql.sql Normal file
View File

@@ -0,0 +1,198 @@
drop table if exists fly_admin.standard_product_unit;
create table fly_admin.standard_product_unit
(
`id` bigint(20) not null comment '商品ID',
`tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '000000' COMMENT '租户ID',
`source_type` int(2) null comment '三方供应商渠道商编号:1京东,2星链,3测试,4云商特卖 ,5厂商特卖,6天猫,7微唯宝特卖,8云链专供,9三方仓储,10华南一仓,11华南二仓',
`spu_sn` varchar(50) not null comment '商品编码',
`category_id` bigint(20) not null comment '分类id',
`band_name` varchar(50) null comment '商品品牌',
`title` varchar(100) not null comment '商品标题',
`thumbnail` varchar(500) null comment '商品缩略图',
`cover_url` varchar(500) not null comment 'spu主图',
`detail` text null comment 'spu详情图',
`is_limit_area` int(2) default 0 not null comment '是否地区限购',
`limit_area_type` varchar(100) null comment '限购地区名称',
`limit_area_id` int(6) null comment '限购地区id',
`price` decimal(10, 2) default 0.00 null comment '售价',
`is_on_stock` int(2) default 1 null comment '是否上架 1-上架 0-下架',
`is_own` int(2) default 1 not null comment '是否自营 1-自营 0-非自营',
`source_id` bigint(20) null comment '供应商id',
`sku_update_time` datetime(0) not null comment 'sku最后更新时间',
`off_stock_reason` varchar(200) null comment '下架原因',
`off_stock_user` bigint(20) null comment '下架操作人员',
`create_user` bigint(20) NULL DEFAULT NULL COMMENT '创建人',
`create_dept` bigint(20) NULL DEFAULT NULL COMMENT '创建部门',
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
`update_user` bigint(20) NULL DEFAULT NULL COMMENT '修改人',
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
`status` int(2) NULL DEFAULT NULL COMMENT '状态',
`is_deleted` int(2) NULL DEFAULT 0 NULL COMMENT '是否已删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_general_ci comment '商品表';
########################################################################################################################
drop table if exists fly_admin.stock_keeping_unit;
create table fly_admin.stock_keeping_unit
(
`id` bigint(20) not null comment '商品序号ID',
`tenant_id` varchar(12) NULL DEFAULT '000000' COMMENT '租户ID',
`product_id` bigint(20) not null comment '商品ID',
`sku_id` varchar(50) not null comment '规格编码',
`source_id` bigint(20) null comment '服务商ID',
`title` varchar(100) not null comment '规格名称',
`img` text null comment '商品图例',
`detail_img_list` text null comment '商品规格详情',
`detail` text null comment '商品介绍详情',
`source_type` int(2) null comment '商品来源(渠道商编号:1京东,2星链,3测试,4云商特卖 ,5厂商特卖,6天猫,7微唯宝特卖,8云链专供,9三方仓储,10华南一仓,11华南二仓)',
`retail_price` decimal(10, 2) default 0.00 not null comment '零售价',
`market_price` decimal(10, 2) default 0.00 not null comment '市场价',
`cost_price` decimal(10, 2) default 0.00 not null comment '成本价',
`points_price` decimal(10, 2) default 0.00 not null comment '积分价格',
`inventory` int default -1 null comment '库存(-1表示无限制)',
`limit_num` int default -1 null comment '限购数量(-1表示无限制)',
`lowest_num` int default -1 null comment '起购数量(-1表示无限制)',
`given_points` decimal(10, 2) default 0.00 null comment '赠送积分(自营商品送消费积分,非自营送免费积分)',
`is_limit_area` int(2) default 0 null comment '是否有限购地区',
`limit_area_type` int(2) null comment '限购地区ID',
`is_on_stock` int(2) default 1 null comment '是否上架 1-上架 0-下架',
`off_stock_reason` varchar(200) null comment '下架原因',
`off_stock_user` bigint(20) null comment '下架操作人员',
`attribute` json null comment 'json规格',
`create_user` bigint(20) NULL DEFAULT NULL COMMENT '创建人',
`create_dept` bigint(20) NULL DEFAULT NULL COMMENT '创建部门',
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
`update_user` bigint(20) NULL DEFAULT NULL COMMENT '修改人',
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
`status` int(2) NULL DEFAULT NULL COMMENT '状态',
`is_deleted` int(2) NULL DEFAULT 0 NULL COMMENT '是否已删除',
PRIMARY KEY (`id`) USING BTREE,
index (`product_id`)
) ENGINE = InnoDB
comment '商品规格表'
charset = UTF8MB4
COLLATE = utf8mb4_general_ci comment '规格表';
########################################################################################################################
drop table if exists fly_admin.product_category;
create table fly_admin.product_category
(
`id` bigint(20) not null comment 'id',
`name` varchar(50) null comment '分类名称',
`parent_id` bigint(20) not null comment '父类id',
`remark` varchar(255) null comment '备注',
`is_deleted` int(2) NULL DEFAULT 0 NULL COMMENT '是否已删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_general_ci comment '商品分类表';
########################################################################################################################
drop table if exists fly_admin.registration_order;
create table fly_admin.registration_order
(
`id` bigint(20) not null comment '挂单ID',
`spu_id` bigint(20) not null comment 'spuId',
`sku_id` bigint(20) not null comment 'skuId',
`title` varchar(100) not null comment '规格名称',
`transaction_type` int(2) not null comment '交易类型 1-买 2-卖',
`thumbnail` varchar(500) not null comment '商品缩略图',
`price` decimal(10, 2) not null comment '单价',
`point` decimal(10, 2) not null comment '单个赠送积分',
`quantity` int(5) not null comment '数量',
`remaining` int(5) not null comment '剩余数量',
`user_id` bigint(20) not null comment '用户id',
`in_transaction` int(2) default 0 not null comment '是否交易中 1-交易中 0-空闲中',
`is_full_package` int(2) default 0 not null comment '是否全量交易 1-是 0-否',
`region_code` varchar(10) null comment '收货地址区域编码',
`receiver_address` varchar(100) null comment '收货地址',
`is_virtual` int(2) default 0 not null comment '是否虚拟商品 1-是 0-否',
`is_closed` int(2) default 0 not null comment '是否交易完成 1-是 0-否',
`version` bigint(20) default 0 not null comment '乐观锁版本号',
`create_user` bigint(20) NULL DEFAULT NULL COMMENT '创建人',
`create_dept` bigint(20) NULL DEFAULT NULL COMMENT '创建部门',
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
`update_user` bigint(20) NULL DEFAULT NULL COMMENT '修改人',
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
`status` int(2) NULL DEFAULT NULL COMMENT '状态',
`is_deleted` int(2) NULL DEFAULT 0 NULL COMMENT '是否已删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_general_ci comment '挂单表';
########################################################################################################################
drop table if exists fly_admin.transaction_order;
create table fly_admin.transaction_order
(
`id` bigint(20) not null comment '交易单ID',
`registration_id` bigint(20) not null comment '挂单Id',
`sku_id` bigint(20) not null comment 'skuId',
`title` varchar(100) not null comment '规格名称',
`transaction_type` int(2) not null comment '交易类型 1-买 2-卖',
`thumbnail` varchar(500) not null comment '商品缩略图',
`price` decimal(10, 2) not null comment '单价',
`point` decimal(10, 2) not null comment '单个赠送积分',
`quantity` int(5) not null comment '数量',
`total_amount` decimal(10, 2) not null comment '总金额',
`total_points` decimal(10, 2) not null comment '总赠送积分',
`user_id` bigint(20) not null comment '用户id',
`voucher` varchar(500) null comment '凭证 买方为付款凭证 卖方为物流凭证',
`region_code` varchar(10) null comment '收货地址区域编码',
`receiver_address` varchar(100) null comment '收货地址',
`counterparty_order_id` bigint(20) default 0 not null comment '对手单单号',
`is_virtual` int(2) default 0 not null comment '是否虚拟商品 1-是 0-否',
`create_user` bigint(20) NULL DEFAULT NULL COMMENT '创建人',
`create_dept` bigint(20) NULL DEFAULT NULL COMMENT '创建部门',
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
`update_user` bigint(20) NULL DEFAULT NULL COMMENT '修改人',
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
`status` int(2) NULL DEFAULT NULL COMMENT '状态 1-待支付 2-已支付 3-待发货 4-已发货 5-已完成',
`is_deleted` int(2) NULL DEFAULT 0 NULL COMMENT '是否已删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_general_ci comment '交易单表';
########################################################################################################################
drop table if exists fly_admin.user_inventory;
create table fly_admin.user_inventory
(
`id` bigint(20) not null comment '库存ID',
`user_id` bigint(20) not null comment '用户Id',
`sku_id` bigint(20) not null comment 'skuId',
`title` varchar(100) not null comment '规格名称',
`thumbnail` varchar(500) not null comment '商品缩略图',
`price` decimal(10, 2) not null comment '单价',
`quantity` int(5) not null comment '数量',
`is_virtual` int(2) default 0 not null comment '是否虚拟商品 1-是 0-否',
`version` bigint(20) default 0 not null comment '乐观锁版本号',
`create_user` bigint(20) NULL DEFAULT NULL COMMENT '创建人',
`create_dept` bigint(20) NULL DEFAULT NULL COMMENT '创建部门',
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
`update_user` bigint(20) NULL DEFAULT NULL COMMENT '修改人',
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
`status` int(2) NULL DEFAULT NULL COMMENT '状态',
`is_deleted` int(2) NULL DEFAULT 0 NULL COMMENT '是否已删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_general_ci comment '用户库存';
########################################################################################################################

File diff suppressed because one or more lines are too long