1. add mall product
This commit is contained in:
2026-02-06 00:22:54 +08:00
parent 4d18d698df
commit cc812cf1d3
3 changed files with 189 additions and 101 deletions

View File

@@ -1,49 +1,53 @@
CREATE TABLE user_order
(
id int8 DEFAULT 0 NOT NULL PRIMARY KEY,
user_id int8 DEFAULT 0 NOT NULL,
user_phone int8,
user_name varchar(128),
order_type int4 DEFAULT 0 NOT NULL,
order_id int8 DEFAULT 0 NOT NULL,
title VARCHAR(256) DEFAULT '' NOT NULL,
images VARCHAR(512) NULL,
quantity int4 NULL,
description VARCHAR(200) DEFAULT '' NOT NULL,
order_status int4 DEFAULT 0 NOT NULL,
total_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
actual_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
payment_type int4 DEFAULT 0 NOT NULL,
payment_time TIMESTAMP NULL,
payment_track VARCHAR(255) DEFAULT '' NOT NULL,
payment_status int4 DEFAULT 1 NOT NULL,
create_user int8 NULL,
create_dept int8 NULL,
create_time TIMESTAMP(6) NULL,
update_user int8 NULL,
update_time TIMESTAMP(6) NULL,
status int4 NULL,
is_deleted int4 DEFAULT 0 NULL
id int8 NOT NULL PRIMARY KEY,
user_id int8 NOT NULL,
consignee_phone varchar(128) NOT NULL,
consignee varchar(128) NOT NULL,
order_type varchar(128) NOT NULL,
item_code varchar(128) NOT NULL,
item_name varchar(128) NOT NULL,
image_url VARCHAR(512) NULL,
quantity int4 DEFAULT 1 NOT NULL,
delivery_address text NULL,
express_company VARCHAR(100) NULL,
express_no VARCHAR(100) NULL,
order_status int4 DEFAULT 0 NOT NULL,
total_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
actual_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
payment_type int4 DEFAULT 0 NOT NULL,
payment_time TIMESTAMP NULL,
payment_status int4 DEFAULT 0 NOT NULL,
payment_track VARCHAR(255) DEFAULT '' NOT NULL,
create_user int8 NULL,
create_dept int8 NULL,
create_time TIMESTAMP(6) NULL,
update_user int8 NULL,
update_time TIMESTAMP(6) NULL,
status int4 NULL,
is_deleted int4 DEFAULT 0 NULL
);
COMMENT ON TABLE user_order IS '用户订单';
COMMENT ON COLUMN user_order.id IS '主键';
COMMENT ON COLUMN user_order.user_id IS '用户id';
COMMENT ON COLUMN user_order.user_phone IS '用户手机号';
COMMENT ON COLUMN user_order.user_name IS '用户名称';
COMMENT ON COLUMN user_order.consignee_phone IS '收件人手机号';
COMMENT ON COLUMN user_order.consignee IS '收件人';
COMMENT ON COLUMN user_order.order_type IS '订单类型';
COMMENT ON COLUMN user_order.order_id IS '订单id';
COMMENT ON COLUMN user_order.title IS '订单名称';
COMMENT ON COLUMN user_order.images IS '图片';
COMMENT ON COLUMN user_order.item_code IS '商品编号';
COMMENT ON COLUMN user_order.item_name IS '商品名称';
COMMENT ON COLUMN user_order.image_url IS '图片';
COMMENT ON COLUMN user_order.quantity IS '数量';
COMMENT ON COLUMN user_order.description IS '订单描述';
COMMENT ON COLUMN user_order.order_status IS '订单状态';
COMMENT ON COLUMN user_order.delivery_address IS '收货地址(实物商品必填,虚拟商品可为空)';
COMMENT ON COLUMN user_order.order_status IS '订单状态 0=待支付 1=已支付(待发货/待使用)2=已取消 3=已发货/已出票(进行中)4=已完成 5=已关闭(超时未支付)6=退款中 7: 已退款';
COMMENT ON COLUMN user_order.total_amount IS '订单金额';
COMMENT ON COLUMN user_order.actual_amount IS '实际支付金额';
COMMENT ON COLUMN user_order.payment_type IS '支付方式';
COMMENT ON COLUMN user_order.payment_time IS '支付时间';
COMMENT ON COLUMN user_order.payment_track IS '支付凭证编号';
COMMENT ON COLUMN user_order.payment_status IS '支付状态';
COMMENT ON COLUMN user_order.payment_status IS '支付状态 0=未支付 1=已支付 2=支付失败 3=支付中(如跳转网银)';
COMMENT ON COLUMN user_order.express_company IS '快递公司名称';
COMMENT ON COLUMN user_order.express_no IS '快递单号(物流单号)';
COMMENT ON COLUMN user_order.create_user IS '创建人';
COMMENT ON COLUMN user_order.create_dept IS '创建部门';
COMMENT ON COLUMN user_order.create_time IS '创建时间';
@@ -51,7 +55,9 @@ COMMENT ON COLUMN user_order.update_user IS '修改人';
COMMENT ON COLUMN user_order.update_time IS '修改时间';
COMMENT ON COLUMN user_order.status IS '状态';
CREATE INDEX user_order_index ON user_order (user_id, order_type);
CREATE INDEX idx_user_order_user_status_time ON user_order (user_id, order_status, create_time DESC);
CREATE INDEX idx_user_order_status_time ON user_order (order_status, create_time DESC);
alter table user_order
owner to yicha1lu;
@@ -62,12 +68,12 @@ CREATE TABLE mall_summary_order
user_id int8 DEFAULT 0 NOT NULL,
user_phone int8,
user_name varchar(128),
products_info text NULL,
order_info text NULL,
confirm_info text NULL,
products_info text NULL,
order_info text NULL,
confirm_info text NULL,
vendor_regions_id int8 NOT NULL,
address_id int8 NOT NULL,
delivery_info text NULL,
delivery_info text NULL,
freight_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
cost_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
order_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
@@ -78,20 +84,20 @@ CREATE TABLE mall_summary_order
extra_type int4 DEFAULT 0 NOT NULL,
payment_status int4 DEFAULT 0 NOT NULL,
order_status int4 DEFAULT 0 NOT NULL,
payment_completed_time TIMESTAMP NULL,
payment_completed_time TIMESTAMP NULL,
payment_track VARCHAR(200) DEFAULT '' NOT NULL,
expire_time TIMESTAMP NULL,
is_recorded int4 DEFAULT 0 NULL,
is_statistics int4 DEFAULT 0 NULL,
expire_time TIMESTAMP NULL,
is_recorded int4 DEFAULT 0 NULL,
is_statistics int4 DEFAULT 0 NULL,
remarks VARCHAR(200) DEFAULT '' NOT NULL,
version int8 DEFAULT 0 NULL,
create_user int8 NULL,
create_dept int8 NULL,
create_time TIMESTAMP NULL,
update_user int8 NULL,
update_time TIMESTAMP NULL,
status int4 DEFAULT 0 NULL,
is_deleted int4 DEFAULT 0 NULL
version int8 DEFAULT 0 NULL,
create_user int8 NULL,
create_dept int8 NULL,
create_time TIMESTAMP NULL,
update_user int8 NULL,
update_time TIMESTAMP NULL,
status int4 DEFAULT 0 NULL,
is_deleted int4 DEFAULT 0 NULL
);
@@ -148,10 +154,10 @@ CREATE TABLE mall_detail_order
summary_order_id int8 DEFAULT 0 NOT NULL,
spu_id int8 DEFAULT 0 NOT NULL,
quantity int4 DEFAULT 0 NOT NULL,
sku_snapshot text NULL,
sku_snapshot text NULL,
freight_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
actual_cost_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
order_amount DECIMAL(10, 2) NULL,
order_amount DECIMAL(10, 2) NULL,
cost_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
actual_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
remarks VARCHAR(200) DEFAULT '' NOT NULL,
@@ -159,15 +165,15 @@ CREATE TABLE mall_detail_order
freight VARCHAR(200) DEFAULT 0.00 NOT NULL,
logistics VARCHAR(200) DEFAULT 0.00 NOT NULL,
delivery_time timestamp(6),
products_info text NULL,
version int4 DEFAULT 0 NULL,
create_user int8 NULL,
create_dept int8 NULL,
create_time TIMESTAMP NULL,
update_user int8 NULL,
update_time TIMESTAMP NULL,
status int4 DEFAULT -1 NULL,
is_deleted int4 DEFAULT 0 NULL
products_info text NULL,
version int4 DEFAULT 0 NULL,
create_user int8 NULL,
create_dept int8 NULL,
create_time TIMESTAMP NULL,
update_user int8 NULL,
update_time TIMESTAMP NULL,
status int4 DEFAULT -1 NULL,
is_deleted int4 DEFAULT 0 NULL
);
COMMENT ON TABLE mall_detail_order IS '商城详情订单';
@@ -211,27 +217,27 @@ CREATE TABLE mall_summary_order_after
goods_id int8 DEFAULT -1 NOT NULL,
sku_id int8 NOT NULL,
goods_name VARCHAR(256) NOT NULL,
quantity int4 DEFAULT -1 NULL,
apply_type int4 NULL,
quantity int4 DEFAULT -1 NULL,
apply_type int4 NULL,
apply_reason VARCHAR(100) DEFAULT '-1' NULL,
apply_pic_urls TEXT NULL,
apply_pic_urls TEXT NULL,
refund_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
refund_status int4 DEFAULT 0 NULL,
refund_reason VARCHAR(255) NULL,
receiver VARCHAR(125) NULL,
receiver_phone VARCHAR(255) NULL,
receiver_addr VARCHAR(255) NULL,
receiver_delivery_no VARCHAR(255) NULL,
remarks VARCHAR(200) DEFAULT '' NULL,
version int4 DEFAULT 0 NULL,
create_user int8 NULL,
create_dept int8 NULL,
create_time TIMESTAMP NULL,
update_user int8 NULL,
update_time TIMESTAMP NULL,
status int4 DEFAULT 0 NULL,
is_deleted int4 DEFAULT 0 NULL,
after_info JSON NULL
refund_status int4 DEFAULT 0 NULL,
refund_reason VARCHAR(255) NULL,
receiver VARCHAR(125) NULL,
receiver_phone VARCHAR(255) NULL,
receiver_addr VARCHAR(255) NULL,
receiver_delivery_no VARCHAR(255) NULL,
remarks VARCHAR(200) DEFAULT '' NULL,
version int4 DEFAULT 0 NULL,
create_user int8 NULL,
create_dept int8 NULL,
create_time TIMESTAMP NULL,
update_user int8 NULL,
update_time TIMESTAMP NULL,
status int4 DEFAULT 0 NULL,
is_deleted int4 DEFAULT 0 NULL,
after_info JSON NULL
);
COMMENT ON TABLE mall_summary_order_after IS '商品售后订单表';

View File

@@ -207,16 +207,26 @@ CREATE INDEX idx_product_category ON mall_product (category_id);
CREATE INDEX idx_product_status ON mall_product (status) WHERE is_deleted = 0;
CREATE INDEX idx_product_tags ON mall_product USING GIN (tags);
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
VALUES ('2019341061775732737', '2016445919294554113', 'mallProduct', '商城商品', 'menu', '/mall/mallProduct', NULL, 1, 1, 0, 1, NULL, 0);
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
VALUES ('2019341061775732738', '2019341061775732737', 'mallProduct_add', '新增', 'add', '/mall/mallProduct/add', 'plus', 1, 2, 1, 1, NULL, 0);
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
VALUES ('2019341061775732739', '2019341061775732737', 'mallProduct_edit', '修改', 'edit', '/mall/mallProduct/edit', 'form', 2, 2, 2, 1, NULL, 0);
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
VALUES ('2019341061775732740', '2019341061775732737', 'mallProduct_delete', '删除', 'delete', '/api/blade-mallproduct/mallProduct/remove', 'delete', 3, 2, 3, 1, NULL, 0);
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
VALUES ('2019341061775732741', '2019341061775732737', 'mallProduct_view', '查看', 'view', '/mall/mallProduct/view', 'file-text', 4, 2, 2, 1, NULL, 0);
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
is_deleted)
VALUES ('2019341061775732737', '2016445919294554113', 'mallProduct', '商城商品', 'menu', '/mall/mallProduct', NULL, 1,
1, 0, 1, NULL, 0);
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
is_deleted)
VALUES ('2019341061775732738', '2019341061775732737', 'mallProduct_add', '新增', 'add', '/mall/mallProduct/add', 'plus',
1, 2, 1, 1, NULL, 0);
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
is_deleted)
VALUES ('2019341061775732739', '2019341061775732737', 'mallProduct_edit', '修改', 'edit', '/mall/mallProduct/edit',
'form', 2, 2, 2, 1, NULL, 0);
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
is_deleted)
VALUES ('2019341061775732740', '2019341061775732737', 'mallProduct_delete', '删除', 'delete',
'/api/blade-mallproduct/mallProduct/remove', 'delete', 3, 2, 3, 1, NULL, 0);
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
is_deleted)
VALUES ('2019341061775732741', '2019341061775732737', 'mallProduct_view', '查看', 'view', '/mall/mallProduct/view',
'file-text', 4, 2, 2, 1, NULL, 0);
------------------------------------------------------------------------------------------------------------------------
CREATE TABLE mall_category
@@ -253,18 +263,89 @@ COMMENT ON COLUMN mall_category.status IS '状态:1-启用,2-禁用';
COMMENT ON COLUMN mall_category.create_dept IS '创建部门';
CREATE INDEX idx_category_pid ON mall_category (pid);
CREATE INDEX idx_category_sort ON mall_category(sort);
CREATE INDEX idx_category_sort ON mall_category (sort);
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
VALUES ('2019341061003980801', '2016445919294554113', 'mallCategory', '商品分类', 'menu', '/mall/mallCategory', NULL, 1, 1, 0, 1, NULL, 0);
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
VALUES ('2019341061003980802', '2019341061003980801', 'mallCategory_add', '新增', 'add', '/mall/mallCategory/add', 'plus', 1, 2, 1, 1, NULL, 0);
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
VALUES ('2019341061003980803', '2019341061003980801', 'mallCategory_edit', '修改', 'edit', '/mall/mallCategory/edit', 'form', 2, 2, 2, 1, NULL, 0);
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
VALUES ('2019341061003980804', '2019341061003980801', 'mallCategory_delete', '删除', 'delete', '/api/blade-mallcategory/mallCategory/remove', 'delete', 3, 2, 3, 1, NULL, 0);
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
VALUES ('2019341061003980805', '2019341061003980801', 'mallCategory_view', '查看', 'view', '/mall/mallCategory/view', 'file-text', 4, 2, 2, 1, NULL, 0);
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
is_deleted)
VALUES ('2019341061003980801', '2016445919294554113', 'mallCategory', '商品分类', 'menu', '/mall/mallCategory', NULL, 1,
1, 0, 1, NULL, 0);
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
is_deleted)
VALUES ('2019341061003980802', '2019341061003980801', 'mallCategory_add', '新增', 'add', '/mall/mallCategory/add',
'plus', 1, 2, 1, 1, NULL, 0);
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
is_deleted)
VALUES ('2019341061003980803', '2019341061003980801', 'mallCategory_edit', '修改', 'edit', '/mall/mallCategory/edit',
'form', 2, 2, 2, 1, NULL, 0);
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
is_deleted)
VALUES ('2019341061003980804', '2019341061003980801', 'mallCategory_delete', '删除', 'delete',
'/api/blade-mallcategory/mallCategory/remove', 'delete', 3, 2, 3, 1, NULL, 0);
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
is_deleted)
VALUES ('2019341061003980805', '2019341061003980801', 'mallCategory_view', '查看', 'view', '/mall/mallCategory/view',
'file-text', 4, 2, 2, 1, NULL, 0);
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
CREATE TABLE user_order
(
id int8 NOT NULL PRIMARY KEY,
user_id int8 NOT NULL,
consignee_phone varchar(128) NOT NULL,
consignee varchar(128) NOT NULL,
order_type varchar(128) NOT NULL,
item_code varchar(128) NOT NULL,
item_name varchar(128) NOT NULL,
image_url VARCHAR(512) NULL,
quantity int4 DEFAULT 1 NOT NULL,
delivery_address text NULL,
express_company VARCHAR(100) NULL,
express_no VARCHAR(100) NULL,
order_status int4 DEFAULT 0 NOT NULL,
total_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
actual_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
payment_type int4 DEFAULT 0 NOT NULL,
payment_time TIMESTAMP NULL,
payment_status int4 DEFAULT 0 NOT NULL,
payment_track VARCHAR(255) DEFAULT '' NOT NULL,
create_user int8 NULL,
create_dept int8 NULL,
create_time TIMESTAMP(6) NULL,
update_user int8 NULL,
update_time TIMESTAMP(6) NULL,
status int4 NULL,
is_deleted int4 DEFAULT 0 NULL
);
COMMENT ON TABLE user_order IS '用户订单';
COMMENT ON COLUMN user_order.id IS '主键';
COMMENT ON COLUMN user_order.user_id IS '用户id';
COMMENT ON COLUMN user_order.consignee_phone IS '收件人手机号';
COMMENT ON COLUMN user_order.consignee IS '收件人';
COMMENT ON COLUMN user_order.order_type IS '订单类型';
COMMENT ON COLUMN user_order.item_code IS '商品编号';
COMMENT ON COLUMN user_order.item_name IS '商品名称';
COMMENT ON COLUMN user_order.image_url IS '图片';
COMMENT ON COLUMN user_order.quantity IS '数量';
COMMENT ON COLUMN user_order.delivery_address IS '收货地址(实物商品必填,虚拟商品可为空)';
COMMENT ON COLUMN user_order.order_status IS '订单状态 0=待支付 1=已支付(待发货/待使用)2=已取消 3=已发货/已出票(进行中)4=已完成 5=已关闭(超时未支付)6=退款中 7: 已退款';
COMMENT ON COLUMN user_order.total_amount IS '订单金额';
COMMENT ON COLUMN user_order.actual_amount IS '实际支付金额';
COMMENT ON COLUMN user_order.payment_type IS '支付方式';
COMMENT ON COLUMN user_order.payment_time IS '支付时间';
COMMENT ON COLUMN user_order.payment_track IS '支付凭证编号';
COMMENT ON COLUMN user_order.payment_status IS '支付状态 0=未支付 1=已支付 2=支付失败 3=支付中(如跳转网银)';
COMMENT ON COLUMN user_order.express_company IS '快递公司名称';
COMMENT ON COLUMN user_order.express_no IS '快递单号(物流单号)';
COMMENT ON COLUMN user_order.create_user IS '创建人';
COMMENT ON COLUMN user_order.create_dept IS '创建部门';
COMMENT ON COLUMN user_order.create_time IS '创建时间';
COMMENT ON COLUMN user_order.update_user IS '修改人';
COMMENT ON COLUMN user_order.update_time IS '修改时间';
COMMENT ON COLUMN user_order.status IS '状态';
CREATE INDEX idx_user_order_user_status_time ON user_order (user_id, order_status, create_time DESC);
CREATE INDEX idx_user_order_status_time ON user_order (order_status, create_time DESC);

View File

@@ -25,6 +25,7 @@
*/
package org.springblade.modules.mall.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springblade.modules.api.vo.MallProductApiVO;
import org.springblade.modules.mall.convert.AppMallConvert;
import org.springblade.modules.mall.pojo.entity.MallProductEntity;
@@ -53,7 +54,7 @@ public class MallProductServiceImpl extends BaseServiceImpl<MallProductMapper, M
@Override
public List<MallProductApiVO> apiVoList() {
List<MallProductEntity> list = list();
List<MallProductEntity> list = list(Wrappers.<MallProductEntity>lambdaQuery().eq(MallProductEntity::getStatus, 1).eq(MallProductEntity::getIsDeleted, 0).orderByDesc(MallProductEntity::getRetailPrice));
return AppMallConvert.INSTANCE.convertMallProductApiListVO(list);
}