shop--2.项目设计和框架搭建
Posted windbag7
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了shop--2.项目设计和框架搭建相关的知识,希望对你有一定的参考价值。
功能划分
用户信息与微信账号和本地账号的关联(通过用户信息的id关联起来的)
商品类别与店铺信息通过商品类别下的shop_id关联
实体类
实体类1 区域
//id private Integer areaId; //名称 private String areaName; //权重 private Integer priority; //创建时间 private Date createTime; //更新时间 private Date lastEditTime;
use o2o; create table tb_area( area_id int auto_increment PRIMARY key, area_name varchar(200) not null, priority int not null default ‘0‘, create_time datetime DEFAULT null, last_edit_time datetime DEFAULT null, unique (area_name) )ENGINE=INNODB auto_increment=1 DEFAULT CHARSET=utf8;
实体2 用户信息
//用户id 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 lastTime;
use o2o; create table tb_person_info( user_id int(10) auto_increment PRIMARY KEY, name varchar(20) 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:禁止使用本商场,1:允许使用本商城‘, user_type int(2) not null DEFAULT ‘1‘ COMMENT‘1:顾客,2:店家,3:超级管理员‘, create_time datetime DEFAULT null, last_time datetime DEFAULT null )ENGINE=INNODB auto_increment=1 DEFAULT CHARSET=utf8
实体 3 4微信账号和本地账号
//id private Long wechatAuthId; // private String openId; //创建时间 private Date createTime; //与用户表关联 private PersonInfo personInfo; private Long localAuthId; private String username; private String password; private Date createTime; private Date lastEditTime; private PersonInfo personInfo;
use o2o; create table tb_wechat_auth( wechat_auth_id int(10) auto_increment PRIMARY KEY, open_id varchar(1024) not null, create_time datetime DEFAULT null, user_id int(10) not null REFERENCES tb_person_info(user_id) )ENGINE=INNODB auto_increment=1 DEFAULT CHARSET = utf8; create table tb_local_auth( local_auth_id int(10) auto_increment PRIMARY KEY, username varchar(128) not null, password varchar(128) not null, create_time datetime DEFAULT null, last_edit_time datetime DEFAULT null, user_id int(10) not null REFERENCES tb_person_info(user_id), UNIQUE (username) )ENGINE=INNODB auto_increment=1 DEFAULT CHARSET = utf8; alter table tb_wechat_auth add unique index(open_id)
实体5 头条
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;
use o2o; CREATE table tb_head_line( line_id int(100) auto_increment primary key, 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‘, create_time datetime DEFAULT null, last_edit_time datetime DEFAULT null )ENGINE=INNODB auto_increment=1 DEFAULT CHARSET=utf8;
实体6 店铺类别
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;
use o2o; CREATE table tb_shop_category( shop_category_id int(11) auto_increment primary key, 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 REFERENCES tb_shop_category(shop_category_id) )ENGINE=INNODB auto_increment=1 DEFAULT CHARSET=utf8;
实体 7 店铺
private Long shopId; private String shopName; private String shopDesc; private String shopAddr; private String phone; private String shopImg; private String 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;
use o2o; create table tb_shop( shop_id int(10) auto_increment primary key, owner_id int(10) not null COMMENT‘店铺创建人‘ REFERENCES tb_person_info(user_id), area_id int(5) DEFAULT null REFERENCES tb_area(area_id), shop_category_id int(11) DEFAULT NULL REFERENCES tb_shop_category(shop_category_id), 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 )ENGINE=INNODB auto_increment=1 DEFAULT CHARSET=utf8;
实体 8 商品类别
private Long productCategoryId; private Long shopId; private String productCategoryName; private Integer priority; private Date createTime;
use o2o; create table tb_product_category( product_category_id int(11) auto_increment primary key, 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‘ REFERENCES tb_shop(shop_id) )ENGINE=INNODB auto_increment=1 DEFAULT CHARSET=utf8;
实体9 商品图片
private Long productImgId; private String imgAddr; private String imgDesc; private Integer priority; private Date createTime; private Long productId;
use o2o; create table tb_product_img( product_img_id int(20) auto_increment primary key, 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 REFERENCES tb_product(product_id) )ENGINE=INNODB auto_increment=1 DEFAULT CHARSET=utf8;
实体10 商品
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;
use o2o; create table tb_product( product_id int(100) auto_increment PRIMARY KEY, 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) not null 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 REFERENCES tb_product_category(product_category_id), shop_id int(20) not null DEFAULT ‘0‘ REFERENCES tb_shop(shop_id) )ENGINE=INNODB auto_increment=1 DEFAULT CHARSET=utf8;
以上是关于shop--2.项目设计和框架搭建的主要内容,如果未能解决你的问题,请参考以下文章