校园电商项目2(基于SSM)——模块设计
Posted figsprite
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了校园电商项目2(基于SSM)——模块设计相关的知识,希望对你有一定的参考价值。
步骤一:各模块职责
步骤二:实体类设计
package com.figsprite.o2o.bean; import java.util.Date; public class Area { private Integer areaId; private String areaName; private Integer priority; private Date createTime; private Date lastEditTime; public Integer getAreaId() { return areaId; } public void setAreaId(Integer areaId) { this.areaId = areaId; } public String getAreaName() { return areaName; } public void setAreaName(String areaName) { this.areaName = areaName; } public Integer getPriority() { return priority; } public void setPriority(Integer priority) { this.priority = priority; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public Date getLastEditTime() { return lastEditTime; } public void setLastEditTime(Date lastEditTime) { this.lastEditTime = lastEditTime; } }
接下来创建数据库
接着按照上面的javabean,添加列
package com.figsprite.o2o.bean; import java.util.Date; 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 Long getUserId() { return userId; } public void setUserId(Long userId) { this.userId = userId; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getProfileImg() { return profileImg; } public void setProfileImg(String profileImg) { this.profileImg = profileImg; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getGender() { return gender; } public void setGender(String gender) { this.gender = gender; } public Integer getEnableStatus() { return enableStatus; } public void setEnableStatus(Integer enableStatus) { this.enableStatus = enableStatus; } public Integer getUserType() { return userType; } public void setUserType(Integer userType) { this.userType = userType; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public Date getLastEditTime() { return lastEditTime; } public void setLastEditTime(Date lastEditTime) { this.lastEditTime = lastEditTime; } }
USE school_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, `user_type` INT(2) NOT NULL DEFAULT 1 , `create_time` DATETIME DEFAULT NULL, `last_edit_time` DATETIME DEFAULT NULL, PRIMARY KEY(`user_id`) )ENGINE=INNODB AUTO_INCREMENT=1 DEFAULT CHARSET = utf8
在这里,简单介绍一下mysql的两个常用引擎的区别:
( • ?ω•? )?
MyISAM只支持表级锁,什么是表级锁呢?比如如果一个线程要更改第二行记录,那么另外一个线程想更改第三行记录,但是因为MyISAM是表级锁,所以后面那个线程只好在哪里静静等待,不过MyISAM的读能力很强,因为它是基于权标扫描,然而InnoDB是行级锁,也就是小A同学在改第一行的时候,小B同学可以同时改第三行(反正不要再改第一行都OK),
总之,InnoDB在写的方面略强于MyISAM,然而在读方面MyISAM远强于InnoDB, 但InnoDB支持事务控制,因此如果读的操作比较多建议使用MyISAM
package com.figsprite.o2o.bean; import java.util.Date; public class WechatAuth { private Long wechatAuthId; private String openId; private Date createTime; private PersonInfo personInfo; public Long getWechatAuthId() { return wechatAuthId; } public void setWechatAuthId(Long wechatAuthId) { this.wechatAuthId = wechatAuthId; } public String getOpenId() { return openId; } public void setOpenId(String openId) { this.openId = openId; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public PersonInfo getPersonInfo() { return personInfo; } public void setPersonInfo(PersonInfo personInfo) { this.personInfo = personInfo; } }
这里用户ID相对于该表是个外键,所以在JavaBean里我们通过一个对象引用的方式表示外键
package com.figsprite.o2o.bean; import java.util.Date; public class LocalAuth { private Long localAuthId; private String username; private String password; private Date createTime; private Date lastEditTime; private PersonInfo personInfo; public Long getLocalAuthId() { return localAuthId; } public void setLocalAuthId(Long localAuthId) { this.localAuthId = localAuthId; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public Date getLastEditTime() { return lastEditTime; } public void setLastEditTime(Date lastEditTime) { this.lastEditTime = lastEditTime; } public PersonInfo getPersonInfo() { return personInfo; } public void setPersonInfo(PersonInfo personInfo) { this.personInfo = personInfo; } }
以上是关于校园电商项目2(基于SSM)——模块设计的主要内容,如果未能解决你的问题,请参考以下文章
基于SSM+SpringBoot《校园二手交易平台项目》实战开发教程(附论文及源码)-毕业设计
java基于微信小程序的校园订餐系统+ssm+uinapp+Mysql+计算机毕业设计
基于SSM校园二手交易平台设计与实现.rar(毕业设计+项目源码+数据库文件+答辩PPT)