SpringBoot actual combat e-commerce project mall (18K + STAR) Address: github.com/macrozheng/…
Abstract
This paper mainly analyzes the coupon function related table, using the form of database table and function comparison.
Correlation table structure
Coupons table
It is used to store coupon information. It should be noted that the use type of coupon is 0-> universal. 1-> Specify the category; 2-> For specified goods, the range of use of coupons is different for different types of use.
create table sms_coupon
(
id bigint not null auto_increment,
type int(1) comment 'Coupon type; 0-> Free coupon; 1-> Membership coupon; 2-> Shopping coupons; 3-> Registration Coupon '.name varchar(100) comment 'name',
platform int(1) comment 'Use platform: 0-> all; 1 - > mobile; 2->PC'.count int comment 'number',
amount decimal(10.2) comment 'value',
per_limit int comment 'Limit of cards per person',
min_point decimal(10.2) comment 'Use threshold; 0 means no threshold ',
start_time datetime comment 'Start time',
end_time datetime comment 'End of use time',
use_type int(1) comment 'Use type: 0-> general use; 1-> Specify the category; 2-> Specified goods',
note varchar(200) comment 'note',
publish_count int comment 'Issue quantity',
use_count int comment 'Quantity used',
receive_count int comment 'Quantity claimed',
enable_time datetime comment 'Available date',
code varchar(64) comment 'Promo code',
member_level int(1) comment 'Type of membership available: 0-> Unlimited',
primary key (id));Copy the code
Coupon history sheet
It is used to store the records of members receiving and using coupons. When members receive coupons, a record of coupons will be generated. It is necessary to pay attention to its usage status: 0-> unused; 1-> Used; 2-> Expired.
create table sms_coupon_history
(
id bigint not null auto_increment,
coupon_id bigint comment 'Coupon ID',
member_id bigint comment 'user id',
order_id bigint comment 'order id',
coupon_code varchar(64) comment 'Coupon code',
member_nickname varchar(64) comment 'Recipient nickname',
get_type int(1) comment 'Get type: 0-> background gift; 1-> Active acquisition ',
create_time datetime comment 'Creation time',
use_status int(1) comment 'Used status: 0-> Not used; 1-> Used; 2-> Expired ',
use_time datetime comment 'Use time',
order_sn varchar(100) comment 'Order Number',
primary key (id));Copy the code
A list of coupons and merchandise
It is used to store the relationship between coupons and commodities. When the use type of coupons is specified commodities, the relationship between coupons and commodities needs to be established.
create table sms_coupon_product_relation
(
id bigint not null auto_increment,
coupon_id bigint comment 'Coupon ID',
product_id bigint comment 'commodity id',
product_name varchar(500) comment 'Trade Name',
product_sn varchar(200) comment 'Barcode for Commodity',
primary key (id));Copy the code
Coupon and merchandise classification relationship table
It is used to store the relationship between coupons and product categories. If a coupon is used for a specified category, the relationship between coupons and product categories needs to be established.
create table sms_coupon_product_category_relation
(
id bigint not null auto_increment,
coupon_id bigint comment 'Coupon ID',
product_category_id bigint comment 'Category ID',
product_category_name varchar(200) comment 'Category name',
parent_category_name varchar(200) comment 'Parent category name',
primary key (id));Copy the code
Management Side Display
Coupon list
Edit coupons
His general
Specify the commodity
Specify the classification
Check coupons
Mobile display
My coupon
Don’t use
Has been used
expired
Coupon Details
The public,
Mall project full set of learning tutorials serialized, attention to the public number the first time access.