校园商店项目ssm到springboot笔记2 --系统功能 、 实体类设计和表设计

在这里插入图片描述

–系统功能

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

实体类设计和表设计

总览:
在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
商品类别

在这里插入图片描述

创建数据库 o2o

create database o2o;

创建实体类(生成对应字段的getter、setter方法)

Area    
PersonInfo   
WechatAuth    
LocalAuth   
HeadLine
ShopCategory  
Shop  
Product   
ProductImg   
ProductCategory
public class Area {
	//区域ID
	private Integer areaId;
	//区域名
	private String areaName;
	//权重  不同权重排名不同
	private Integer priority;
	//创建时间
	private Date createTime;
	//更新时间
	private Date lastEditTime;
public class PersonInfo {
	private Long userId;
	private String name;
	//用戶頭像地址
	private String profileImg;
	private String email;
	private String gender;
	//如果账号禁用 不能登陆商场操作
	private Integer enableStatus;
	//1.顧客  2.店家   3.超級管理員
	private Integer userType;
	private Date createTime;
	private Date lastEditTime;
public class WechatAuth {
	
	private Long wechatAuth;
	private String openId;
	private Date createTime;
	private PersonInfo personInfo;
public class LocalAuth {
	private Long localAuthId;
	private String username;
	private String password;
	private Date createTime;
	private Date lastEditTime;
	private PersonInfo personInfo;
public class HeadLine {
		
	private Long   lineId;
	private String lineName;
	private String lineLink;
	private String lineImg;
	private Integer priority;
	//0不可用  1  可用
	private Integer enableStatus;
	private Date createTime;
	private Date lastEditTime;
public class ShopCategory {
	private Long shopCategoryId;
	private String shopCategoryName;
	//店铺描述
	private String shopCategoryDesc;
	private String shopCategoryImg;
	private Integer priority;
	private Date createTime;
	private Date lastEditTime;
	//上级ID
	private ShopCategory parent;
public class Shop {
	private Long shopId;
	private String shopName;
	//店铺描述
	private String shopDesc;
	private String shopAddr;
	private String phone;
	private String shopImg;
	private Integer priority;
	private Date createTime;
	private Date lastEditTime;
	//-1不可用  0 审核中  1可用
	private Integer enableStatus;
	//管理员给店家的提醒
	private String advice;
	private Area area;
	private PersonInfo owner;
	private ShopCategory shopCategory;
public class Product {
	private Long productId;
	private String productName;
	private String productDesc;
	//简略图地址
	private String imgAddr;
	//原价
	private String normalPrice;
	//折扣价
	private String promotionPrice;
	//现实权重
	private Integer priority;
	private Date createTime;
	private Date lastEditTime;
	//0 下架  1 可展示
	private Integer enableStatus;
	
	private List<ProductImg> productImgList;
 	private ProductCategory productCategory;
 	private Shop shop;
public class ProductImg {
	private Long productImgId;
	private String imgAddr;
	private String imgDesc;
	private Integer priority;
	private Date createTime;
	private Long productId;
public class ProductCategory {
	private Long productCategoryId;
	private Long shopId;
	private String productCategoryName;
	private Integer priority;
	private Date createTime;

创建表

use o2o;
create table tb_area(
area_id int(2) NOT NULL AUTO_INCREMENT,
area_name varchar(200) NOT NULL,
priority int(2) NOT NULL DEFAULT 0,
create_time datetime DEFAULT NULL,
last_edit_time datetime DEFAULT NULL,
primary key(area_id),
unique key(area_name)     COMMENT'唯一键'
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
use o2o;
create table tb_person_info(
user_id int(10) NOT NULL AUTO_INCREMENT,
name varchar(32) DEFAULT NULL,
profile_img varchar(1024) DEFAULT NULL,
email varchar(1024) DEFAULT NULL,
gender varchar(2) DEFAULT NULL,
enable_status int(2) NOT NULL DEFAULT 0 COMMENT'0不允许使用本商场',
user_type int(2) NOT NULL DEFAULT 1 COMMENT'1顾客,2店家 3管理员',
create_time datetime DEFAULT NULL,
primary key(user_id)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;```

use o2o;
create table tb_wechat_auth(
wechat_auth_id int(10) NOT NULL AUTO_INCREMENT,
user_id int (10) NOT NULL,
open_id varchar(1024) NOT NULL,
create_time datetime DEFAULT NULL,
primary key(wechat_auth_id),
unique key(open_id)     COMMENT'唯一键',
constraint foreign key(user_id) references tb_person_info (user_id)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

``

use o2o;
create table tb_local_auth(
local_auth_id int(10) NOT NULL AUTO_INCREMENT,
user_id int (10) NOT NULL,
username varchar (128) NOT NULL,
password varchar (128) NOT NULL,
create_time datetime DEFAULT NULL,
last_edit_time datetime DEFAULT NULL,
primary key(local_auth_id),
unique key(username)     COMMENT'唯一键',
constraint foreign key(user_id) references tb_person_info (user_id)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
use o2o;
create table tb_head_line(
line_id int(100) NOT NULL AUTO_INCREMENT,
line_name varchar(1000) DEFAULT NULL,
line_link varchar(2000) NOT NULL,
line_img varchar(2000) NOT NULL,
priority int(2) DEFAULT NULL,
enable_status int(2) NOT NULL DEFAULT 0 COMMENT'0不允许使用本商场',
create_time datetime DEFAULT NULL,
last_edit_time datetime DEFAULT NULL,
primary key(line_id)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
use o2o;
create table tb_shop_category(
shop_category_id int(11) NOT NULL AUTO_INCREMENT,
shop_category_name varchar(100) NOT NULL DEFAULT '',
shop_category_desc varchar(1000) DEFAULT '',
shop_category_img varchar(2000)  DEFAULT NULL,
priority int(2) NOT NULL DEFAULT 0,
create_time datetime DEFAULT NULL,
last_edit_time datetime DEFAULT NULL,
parent_id int(11) DEFAULT NULL,
primary key(shop_category_id),
constraint foreign key(parent_id) references tb_shop_category (shop_category_id)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
use o2o;
create table tb_shop(
shop_id int(10) NOT NULL AUTO_INCREMENT,
owner_id int(10) NOT NULL COMMENT '店铺创建人',
area_id int(5) DEFAULT NULL,
shop_category_id int(11) DEFAULT NULL,
shop_name varchar(256) NOT NULL,
shop_desc varchar(1024) DEFAULT NULL,
shop_addr varchar(200) DEFAULT NULL,
phone varchar(128) DEFAULT NULL,
shop_img varchar(1024) DEFAULT NULL,
priority int(3) DEFAULT 0,
create_time datetime DEFAULT NULL,
last_edit_time datetime DEFAULT NULL,
enable_status int(2) NOT NULL DEFAULT 0,
advice varchar(255) DEFAULT NULL,
primary key(shop_id),
constraint foreign key(area_id) references tb_area (area_id),
constraint foreign key(owner_id) references tb_person_info (user_id),
constraint foreign key(shop_category_id) references tb_shop_category (shop_category_id)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
use o2o;
create table tb_product(
product_id int(100) NOT NULL AUTO_INCREMENT,
product_name varchar(100)  NOT NULL,
product_desc varchar(2000) DEFAULT NULL,
img_addr varchar(2000) DEFAULT '',
normal_price varchar(100) DEFAULT NULL,
promotion_price varchar(100) DEFAULT NULL,
priority int(2) DEFAULT 0,
create_time datetime DEFAULT NULL,
last_edit_time datetime DEFAULT NULL,
enable_status int(2) NOT NULL  DEFAULT 0,
product_category_id int(11) DEFAULT NULL,
shop_id int(20) NOT NULL  DEFAULT 0,
primary key(product_id),
constraint foreign key(product_category_id) references tb_product_category (product_category_id),
constraint foreign key(shop_id) references tb_shop (shop_id)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
use o2o;
create table tb_product_img(
product_img_id int(20) NOT NULL AUTO_INCREMENT,
img_addr varchar(2000) NOT NULL,
img_desc varchar(2000) DEFAULT NULL,
priority int(2) DEFAULT 0,
create_time datetime DEFAULT NULL,
product_id int(20) DEFAULT NULL,
primary key(product_img_id),
constraint foreign key(product_id) references tb_product (product_id)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
use o2o;
create table tb_product_category(
product_category_id int(11) NOT NULL AUTO_INCREMENT,
product_category_name varchar(100) NOT NULL,
priority int(2) DEFAULT 0,
create_time datetime DEFAULT NULL,
shop_id int(20) NOT NULL DEFAULT 0,
primary key(product_category_id),
constraint foreign key(shop_id) references tb_shop (shop_id)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

又到时间吃饭。。。。。。。。?!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值