weno2o项目模块介绍

16 篇文章 0 订阅
15 篇文章 0 订阅

环境配置:

apache-maven-3.5.3,本地仓库,阿里云库在配置文件中配好

安装jdk1.8.0_162

apache-tomcat-8.5.29-windows-x64

IntelliJ IDEA 2018.1//它的安装破解就不多讲述了,千万别下载社区版。。。

项目开始

在idea中创建maven项目,https://www.cnblogs.com/wql025/p/5215570.html,不懂得人这里有教程

可以在pom.xml中加入plugins加入maven的依赖编译工具,plugins:表示插件,也可以在web.xml中加入

welcome-file-list来表示这是默认访问的文件。welcome:欢迎

模块介绍

1.明确各模块职责,了解各模块涉及的对象

实体类设计(表的设计)

实体类的设计和数据表建立

entity:实体,area区域


权重是指谁的优先级更高,区域id

创建tb_area表

create table 'tb_area' (

‘areaId’ int[2] NOT NOll AUTO_INCREMENT,PRIMARY KEY

‘areaName’ varchar[200]   NOR NULL,//varchar[200]设置大些没关系,因为会根据实际数值调整

 'priority' int[2] NOT NOLL DEFAULT '0',

'creatTime' dataTime DEFAULT NULL,

'creatLastTime' dataTime DEFAULT NULL,//选datetime的原因是datetime的范围更广,精度高,time的优势是会自适应当前的时区

unique key uk_area(‘areaName’)//给area设置为唯一属性,并且改名为uk_area

)engine = innodb auto_incriment default =1 default charset=utf-8//表明引擎是innodb 主间自增长1 编码为utf-8

解释:ENGINE=innodb,mysql一共两种引擎,innodb和MYISAM(最常用的两种)

MYISAM是基于表级索的(对整张表锁,其他线程不能改变里面的记录)只有等当前线程结束了,释放锁才能访问。但是它读的性能高,因为它是基于整张表的,只读的话用它

innoDB是行级锁了,写的性能高些,支持事物控制

用户表


创建用户表和实体类

CREATE TABLE 'tb_person_info'(
'usr_id' INT(10) NOT NULL AUTO_INCREMENT,
'name' VARCHAR(30) 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:允许使用本商场',
'usr_type' INT(2) NOT NULL DEFAULT '1' COMMENT '1:顾客,2:商户,3:超级管理员',
'create_time' DATETIME DEFAULT NULL,
'last_edit_time' DATETIME DEFAULT NULL,
PRIMARY KEY ('usr_id')

)ENGINE=INNODB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8

微信号实体

用户id是跟用户表的id绑定的,主外键关系,openID是跟微信账号和公众号绑定的标识


WechatAuth微信授权


创建实体类和数据库表,

create table ‘tb_wechat_auth'(

'wechat_auth_id' int(10) not null auto_incrememt primary key,

'user_id' int(10) not null,

'oper_id’varchar(1024) NOT NULL UNIQUE ,//openID是跟微信账号和公众号绑定的标识

'create_time 'datatime DEFAULT NULL,

constraint 'fk_wechatauth_profile' foreign key('user_id') references 'tb_person_info'('user_id')

)engine=innoDB auto_increment=1 default charset=utf8;

//备注:增加唯一索引能提高检索速率,但是索引过多会影响速率。

create table 'tb_local_auth'(

'local_auth_id' int(10) not null auto_increment primary key,

'user_id' int (10) not null,

'username' varchar(128) not null,

'password' varchar(128) not null,

'creat_time 'datetime default null,

'last_edit_time' datetime default null,

unique key 'uk_local_profile'('username'),

constraint 'fk_localauth_profile' foreign key('user_id) references 'tb_person_info'('user_id')

)engine=innoDB auto_increment=1 default charset=utf8;

user_id因为是以外键的关系存在的,所以它的值完全取决于用户表的user_id值.

头条实体类设计与数据库表创建

create table 'tb_head_line'(

'line_id' int(100) not null 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;

店铺类别

上级id是一层一层的

create table 'tb_shop_category'(

'shop_category_id' int(11) NOT NULL 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,

'create_edit_time' datetime default null,

'parent_id' int(11) default null,

constraint 'fk_shop_category_self' foreign key ('parent_id') references 'tb_shop_category'

('shop_category_id')

)engine=innoDB AUTO_INCRMENT=1 DEFAULT CHARSET=UTF8;

核心店铺

创建数据库表

create  table tb_shop(

'shop_id’int(10) not null auto_increment primary key,

'shop_name' varchar(256) not null ,

'owner_id' int(10) NOT NULL comment '店铺创始人',

'area_id' int(5) default null,

'shop_category_id' int(11) default null,

'shop_deac' varchar(1024) default null,

'phone' varchar(128) default null,

'shop_addr' varchar(200) default null,

'shop_img' varchar(1024) default null,

'priority' int(3) default '0',

'create_time' datetime,

'last_edit_time' datetime,

'enable_status' int(2) not null default '0',

'advice' varchar(255),

constraint 'fk_shop_area' forelgn key('area_id) references'tb_area'(area_id),

constraint 'fk_shop_profile'forelgn key('owner_id')REFERNCES 'tb_person_ifo'('user_id;),

constraint 'fk_shop_shopcate' forelgn key(shop_category_id)references 'tb_shop_category'('shop_category_id')

)engine=innodb auto_increment=1 default charset=utf8


商品类别

商品类别有 商品id 店id 商品名称 权重,和创建时间。

创建数据库表

create table 'tb_product_category'(

'product_category_id' int(11) not null auto_increment primary key,

'product_category_name' varchar(100) NOT NULL,

'priority' int(2) default '0',

'create_time' dutetime DEFAULT NULL,

'shop_id' int(20) not null default '0'

constraint 'fk_procate_shop' forelgn key('shop_id) references 'tb_shop'(shop_id)

)engine=innodb auto_increment=1 default charset=utf8

商品图片

商品图片id 图片的位置,图片介绍,权重,创建时间,商品id(那个商品的详情图片)

商品表:

create table 'tb_product_img'(

'product_img_id' int(20) not null 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,

constraint 'fk_proimg_product' forelgn key('prduct_id') references 'tb_product'(product_id)

)engine=innodb auto_increment=1 default charset=utf8

商品

create table 'tb_product'(

'product_id' int(100) not null 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),

'promotion_price' varchar(100),

'priority' int(2) not null default '0',

'creat_time' datetime,

'last_edit_time' datetime,

'last_edit_time' datetime,

'enable_status' int(2) not null default '0',

'product_category_id' int(11) ,

'shop_id' int(20) not null default '0'

constraint 'fk_product_procate' foreign key

('product_category_id)references 'tb_product_category'(product_category_id),

constraint 'fk_product_shop' foreige key('shop_id')references 'tb_shop'(shop_id)

)engine=innodb auto_increment=1 default charset=utf8

总结:注意从属关系,比如微信用户属于用户,微信用户关联用户,一个商品多张图片,图片关联商品


  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值