SpringBoot构建电商基础秒杀项目 - 笔记

SpringBoot构建电商基础秒杀项目

视频地址 https://www.imooc.com/video/18332

springboot项目搭建

创建Maven项目

maven-archetype-quickstart

不用springboot可以说使用maven-archetype-webapp,生成项目可以打包成war发布到容器

vuejs版本 https://gitee.com/349032805/miaosha-all

https://gitee.com/robei/miaosha https://github.com/hongjun500/miaosha

spring官方rest例子 https://spring.io/guides/gs/rest-service/

默认配置

resources目录下application.properties
server.port=8080

整合Mybatis

dependency:
数据库驱动 数据库连接池 如druid

com.alibaba
druid

org.mybatis.spring.boot
mybatis-spring-boot-starter

配置文件
mybatis.mapperLocations=classpath:mapping/*.xml spring.datasource.name= spring.dataourse.url= spring.datasource.username= spring.datasource.password=

spring.datasource.type=com.alibaba.druid.poll.DruidDataSource spring.datasource.driverClassName=

mapping创建在resources目录下

@MapperScan("com.xxxx.xxx")

mybatis自动生成器插件

mybatis-generator.xml

数据库设计

register_mode 注册方式 thrid_party_id 第三方id 密码跟用户主表分开存取

使用SpringMVC开发用户信息

service下model目录

controller下创建viewobject目录

BeanUtils.copyProperties(source, targert)

通用返回对象 error目录 enum EmBusinessError implements CommonError // 通用错误类型00001 PARAMETER_VALIDATION_ERROR(00001, "参数不合法") USER_NOT_EXIST(10001, “用户不存在”); int errCode String errMsg

秒杀模块

joda-time jar包

class PromoModel
Integer id
// 1 未开始 2 进行中 3 已结束
Integer status
// 秒杀活动名
String promoName
DateTime startDate
DateTime endDate
Integer itemId
// 秒杀活动商品价格
BigDecimal promoItemPrice

转载于:https://my.oschina.net/u/1440088/blog/3023547

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值