【购物车系统】01需求分析和建表


使用技术:
数据库:mysql
前端:bootstrap
后端:springboot+thymleaf+mybatis

需求分析

  • 登录页
    商家、用户、管理员登陆
  • 商家登陆
    商家对产品的CRUD
  • 客户登陆
    购物车,添加的商品选择在购物车页面,产品的增加和删除
  • 订单页面,购物车的CRUD(支付页面,总共支付多少钱 不同用户有不同的支付和购物车)
  • 购物车是已完成、订单是未完成的

数据表的构建思考

index 显示不同商家的上架的不同产品【商家信息展示、商品信息展示】

merchant 商家

  • registry注册(商铺责任人、电话、邮箱、店铺名、密码)
  • login 登陆(商铺责任人、密码)
  • product 产品 上架(产品名称、产品数量、产品价格、产品上市日期、产品图片)【商品增加、修改、删除】
  • order 查看不同用户的订单,点击确认后,产品页面数量减少【销售管理 查看订单、确认发货 给已支付和未支付状态】

customer 顾客

  • 登陆、注册(顾客名、密码、电话、邮件、初始金额)
  • trolley /cart 购物车(产品名称、产品数量、产品价格)【未完成】
  • order 查看自己的订单 【已完成】
  • payment 支付页(产品名称、产品数量、产品价格,总价格 )

【待解决问题】

支付页面是购物车的视图,还增加了总价格
商家/用户登陆后显示,欢迎xxx上线
商家点击确认订单发货后,产品页数量才会减少,金钱减少
图片管理
客户和商家注册信息不同,登陆的都是名字和密码,需不需要判断

数据表构建

merchant(id,mer_name,mer_pass,shop_name(外),tel,email,mer_amount)

customer(id,cus_name,cus_pass,gender,tel,email,cus_amount)

admin(id,ad_name,ad_pass)

shop(id,shop_name,address,merchant_id(外))

product(id,pro_name,pro_price,pro_num,type,des,shop_id(外),type_id(外))

protype(id,type)

orders(id ,order_num,order_date,user_id,pro_id )

create database lamborshop;
use lamborshop;

--商家注册信息
create table merchant(
id int primary key auto_increment,
mer_name varchar(30),
mer_pass varchar(30),
shop_name varchar(30),
tel varchar(30),
email varchar(30),
mer_amount int
)

--客户注册信息
create table customer(
id int primary key auto_increment,
cus_name varchar(30),
cus_pass varchar(30),
gender varchar(30),
tel varchar(30),
email varchar(30),
cus_amount int
)

--系统管理员
create table admin(
id int primary key auto_increment,
ad_name varchar(30),
ad_pass varchar(30)

)

--店铺信息
create table shop(
id int primary key auto_increment,
shop_name varchar(30),
address varchar(50),
mer_id int

)

--产品信息
create table product(
id int primary key auto_increment,
pro_name varchar(30),
pro_price int,
pro_num int,
type varchar(30),
des varchar(100),
shop_id int,
type_id int,
img varchar(100)
)

drop table protype;
--这张表不需要,不要建
--产品类型信息
create table protype(
id int primary key auto_increment,
type varchar(30)
)
--给id增加自增长属性
alter table protype modify id int auto_increment;
--给自增值设置初始值
alter table protype auto_increment=1;

--订单/购物车信息
create table orders(
id int primary key auto_increment,
order_num int,
order_date date,
user_id int,
pro_id int,
state int
)


insert into admin(ad_name,ad_pass) values('lambor','666'),('qiqi','666'),('zhangxu','666')

insert into merchant(mer_name,mer_pass,shop_name,tel,email,mer_amount) values('wangwang','wangwang','旺仔有限公司','111','111@qqcom',100),('alibaba','alibaba','阿里巴巴有限公司','222','222@qqcom',200),('pingduoduo','pingduoduo','拼多多有限公司','333','333@qqcom',300)

update merchant set email='[email protected]' where mer_name='wangwang'
update merchant set email='[email protected]' where mer_name='alibaba'
update merchant set email='[email protected]' where mer_name='pingduoduo'

insert into customer(cus_name,cus_pass,gender,tel,email,cus_amount)values('longlong1','888','女','888','[email protected]',400),('longlong2','888','男','888','[email protected]',500),('longlong3','888','女','888','[email protected]',600)

insert into shop(shop_name,address,mer_id)values('旺仔有限公司','广州市云南白药村',1),('拼多多有限公司','湖北荆州集散中心',3)

insert into product(pro_name,pro_price,pro_num,type,des,shop_id,type_id)values('苹果',12,40,'水果','鲜美多汁,美味',3,1)

insert into protype(type)values('水果'),('零食')

配置设置 创建一个springboot项目 基本步骤

【JavaWeb】springboot+thymleaf+mybatis快速入门
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

构建实体集

实体都是类,类名要记得大写
下面是一个错误示范
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

创建5个实体 entity

在这里插入图片描述

编写业务模型 接口mapper

在这里插入图片描述
下面是错误示范 column后为数据库的值,property为java的属性值
在这里插入图片描述
在这里插入图片描述

service

在这里插入图片描述
编写所有impl
在这里插入图片描述

写完这一步就开始写前端页面,然后写controller层

管理员登陆后

  • 查看用户信息、商家信息 、跳转到用户和商家登陆页面
发布了56 篇原创文章 · 获赞 16 · 访问量 5060

猜你喜欢

转载自blog.csdn.net/qq_40892702/article/details/103148872