├── .gitignore ├── .idea ├── inspectionProfiles │ └── Project_Default.xml ├── misc.xml └── vcs.xml ├── HELP.md ├── README.md ├── mvnw ├── mvnw.cmd ├── pom.xml ├── src ├── main │ ├── java │ │ └── com │ │ │ └── sakura │ │ │ └── xdvideo │ │ │ ├── XdvideoApplication.java │ │ │ ├── config │ │ │ ├── Cors.java │ │ │ ├── IntercepterConfig.java │ │ │ ├── MyBatisConfig.java │ │ │ └── WechatConfig.java │ │ │ ├── controller │ │ │ ├── OrderController.java │ │ │ ├── TestController.java │ │ │ ├── VideoController.java │ │ │ ├── WechatController.java │ │ │ └── admin │ │ │ │ └── VideoAdminController.java │ │ │ ├── domain │ │ │ ├── Chapter.java │ │ │ ├── Comment.java │ │ │ ├── Episode.java │ │ │ ├── JsonData.java │ │ │ ├── User.java │ │ │ ├── Video.java │ │ │ └── VideoOrder.java │ │ │ ├── dto │ │ │ └── VideoOrderDto.java │ │ │ ├── exception │ │ │ ├── XdException.java │ │ │ └── XdExceptionHandler.java │ │ │ ├── interceoter │ │ │ └── LoginIntercepter.java │ │ │ ├── mapper │ │ │ ├── UserMapper.java │ │ │ ├── VideoMapper.java │ │ │ └── VideoOrderMapper.java │ │ │ ├── provider │ │ │ └── VideoProvider.java │ │ │ ├── service │ │ │ ├── UserService.java │ │ │ ├── VideoOrderService.java │ │ │ ├── VideoService.java │ │ │ └── impl │ │ │ │ ├── UserServiceImpl.java │ │ │ │ ├── VideoOrderServiceImpl.java │ │ │ │ └── VideoServiceImpl.java │ │ │ └── utils │ │ │ ├── CommonUtils.java │ │ │ ├── HttpUtils.java │ │ │ ├── IpUtils.java │ │ │ ├── JwtUtils.java │ │ │ └── WxPayUtils.java │ └── resources │ │ ├── application.properties │ │ └── logback-spring.xml └── test │ └── java │ └── com │ └── sakura │ └── xdvideo │ ├── CommonTest.java │ ├── XdvideoApplicationTests.java │ └── service │ └── VideoServiceTest.java └── target ├── classes ├── application.properties └── com │ └── sakura │ └── xdvideo │ ├── XdvideoApplication.class │ ├── config │ ├── IntercepterConfig.class │ ├── MyBatisConfig.class │ └── WechatConfig.class │ ├── controller │ ├── OrderController.class │ ├── TestController.class │ ├── VideoController.class │ ├── WechatController.class │ └── admin │ │ └── VideoAdminController.class │ ├── domain │ ├── Chapter.class │ ├── Comment.class │ ├── Episode.class │ ├── JsonData.class │ ├── User.class │ ├── Video.class │ └── VideoOrder.class │ ├── interceoter │ └── LoginIntercepter.class │ ├── mapper │ ├── UserMapper.class │ └── VideoMapper.class │ ├── provider │ ├── VideoProvider$1.class │ └── VideoProvider.class │ ├── service │ ├── UserService.class │ ├── VideoService.class │ └── impl │ │ ├── UserServiceImpl.class │ │ └── VideoServiceImpl.class │ └── utils │ ├── CommonUtils.class │ ├── HttpUtils.class │ └── JwtUtils.class └── test-classes └── com └── sakura └── xdvideo ├── CommonTest.class └── XdvideoApplicationTests.class /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .ignore support plugin (hsz.mobi) 2 | ### Example user template template 3 | ### Example user template 4 | 5 | # IntelliJ project files 6 | .idea 7 | *.iml 8 | /target 9 | /app_log/ 10 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 36 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /HELP.md: -------------------------------------------------------------------------------- 1 | # Getting Started 2 | 3 | ### Reference Documentation 4 | For further reference, please consider the following sections: 5 | 6 | * [Official Apache Maven documentation](https://maven.apache.org/guides/index.html) 7 | 8 | ### Guides 9 | The following guides illustrate how to use some features concretely: 10 | 11 | * [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/) 12 | * [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/) 13 | * [Building REST services with Spring](https://spring.io/guides/tutorials/bookmarks/) 14 | * [Quick Start](https://github.com/mybatis/spring-boot-starter/wiki/Quick-Start) 15 | * [Accessing data with MySQL](https://spring.io/guides/gs/accessing-data-mysql/) 16 | * [Messaging with Redis](https://spring.io/guides/gs/messaging-redis/) 17 | 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### 第一章项目介绍和前期准备 2 | 3 | #### 第1集 SpringBoot微信支付开发在线教育视频介绍 4 | 5 | **简介: 课程介绍,和小D课堂在线教育项目搭建开发** 6 | 7 | 8 | 9 | 10 | 11 | ``` 12 | 1、课程大纲介绍 13 | 2、微信支付项目效果演示 14 | 3、课程所需基础springboot2基础+javaweb+mysql+maven 15 | 4、开发环境 jdk8+eclipse和Idea 16 | ``` 17 | 18 | 19 | 20 | 21 | 22 | #### 第2集 中大型公司里面项目开发流程讲解 23 | 24 | **简介:讲解一个项目如何从零到上线,经历过怎样的步骤和流程** 25 | 26 | 27 | 28 | ``` 29 | 1、一个中大型项目的开发流程,从需求调研到项目上线 30 | 31 | 2、需求评审(产品/设计/前端/后端/测试/运营)->UI设计 32 | 33 | ->开发(前端架构->开发/ 后端架构->开发) 34 | 35 | -> 前端后端联调 36 | 37 | ->项目提测 38 | 39 | ->BugFix 40 | 41 | ->回归测试 42 | 43 | ->运维和开发部署上线 44 | 45 | ->灰度发布 46 | 47 | ->全量发布 48 | 49 | ->维护和运营 50 | ``` 51 | 52 | 53 | 54 | 55 | 56 | #### 第3集 在线教育站点需求分析和架构设计 57 | 58 | **简介:分析要开发的功能点和系统架构应该怎样架构** 59 | 60 | 61 | 62 | ``` 63 | 1、开发的功能: 64 | 首页视频列表 65 | 视频详情 (自己开发) 66 | 微信扫码登录 67 | 下单微信支付 68 | 我的订单列表 (自己开发) 69 | 70 | 2、架构设计 71 | 前端后端分离 -> 方案:node渲染 72 | 动静分离 -> 方案:静态资源如html,js放在cdn或者nginx服务器上 73 | 74 | 技术选择: 75 | 后端技术选择:Eclipse + Springboot2.0 + redis4.0+ HttpClient + mysql + ActiveMQ消息队列 76 | 77 | 前端技术选择:HTML5 + bootstrapt + jquery 78 | 79 | 测试要求: 80 | 首页和视频详情页qps单机qps要求 2000+ 81 | 82 | 83 | ``` 84 | 85 | 86 | 87 | 88 | 89 | #### 第4集 在线教育后台数据库设计 90 | 91 | **简介:讲解后端数据库设计 ,字段冗余的好处,及常见注意事项** 92 | 93 | 94 | 95 | ``` 96 | 1、数据库设计: 97 | er图: 98 | 实体对象:矩形 99 | 属性:椭圆 100 | 关系:菱形 101 | video表 102 | video_order表 103 | user表 104 | comment表 105 | chapter张 106 | episode节 107 | 108 | 2、字段冗余: 109 | 什么是字段冗余 110 | 什么时候选择字段冗余 111 | 优缺点 112 | 113 | 3、Mysql测试数据导入 114 | 115 | 4、mysql客户端软件 116 | 苹果系统:sequel pro 117 | windows:navicat 118 | 5、没有一成不变的架构,没有通用的设计方案 119 | 一定跟业务结合 120 | ``` 121 | 122 | 123 | 124 | 125 | 126 | ### 第二章 项目基础环境搭建和逆向工程构建 127 | 128 | #### 第1集 快速搭建SpringBoot项目,采用Eclipse 129 | 130 | **简介:使用SpringBoot start在线生成项目基本框架并导入到eclipse中** 131 | 132 | 133 | 134 | ``` 135 | 1、站点地址:http://start.spring.io/ 136 | 2、需要依赖 137 | spring-boot-starter-web 138 | spring-boot-starter-data-redis 139 | mybatis-spring-boot-starter 140 | mysql-connector-java 141 | 142 | 用什么包导什么包 143 | 144 | 注意事项: 145 | 如果一开始没加mysql的信息,则在pom.xml里面注解掉mysql相关依赖 146 | 147 | 148 | 3、启动项目hello world 149 | 150 | 4、访问入口:localhost:8080/test 151 | ``` 152 | 153 | 154 | 155 | 156 | 157 | #### 第2集 快速搭建SpringBoot项目,采用IDEA 158 | 159 | **简介:使用SpringBoot start在线生成项目基本框架并导入到IDEA中** 160 | 161 | 162 | 163 | ``` 164 | 参考资料: 165 | IDEA使用文档 166 | http://wiki.jikexueyuan.com/project/intellij-idea-tutorial/ 167 | ``` 168 | 169 | 170 | 171 | 172 | 173 | #### 第3集 热部署在Eclipse和IDE里面的使用 174 | 175 | **简介:讲解热部署的好处及使用注意事项,在eclipse里面默认开启,在IDE里面默认关闭** 176 | 177 | 178 | 179 | ``` 180 | 1、增加依赖 181 | 182 | org.springframework.boot 183 | spring-boot-devtools 184 | true 185 | 186 | 187 | 2、eclipse热部署默认自动开启 188 | 189 | 3、idea里面要设置 190 | 1、相关偏好里开启自动编译 191 | 2、Shift+Ctrl+Alt+/,选择Registry 192 | 选 compiler.automake.allow.when.app.running 193 | 重启项目就可以了 194 | 195 | 参考: 196 | https://www.cnblogs.com/aqsunkai/p/6690574.html 197 | compiler.automake.allow.when.app.running 198 | ``` 199 | 200 | 201 | 202 | 203 | 204 | #### 第4集 后端项目分层分包及资源文件处理 205 | 206 | **简介:项目基本目录结构,包名称建立,配置文件建立** 207 | 208 | 209 | 210 | 211 | 212 | ``` 213 | 1、基本目录结构 214 | controller 215 | service 216 | impl 217 | mapper 218 | utils 219 | domain 220 | config 221 | interceoter 222 | dto 223 | 2、application.properties配置文件 224 | 配置启动端口 225 | server.port=8082 226 | ``` 227 | 228 | 229 | 230 | 231 | 232 | #### 第5集 开源工具的优缺点选择和抽象方法的建议 233 | 234 | **简介:讲解开源工具的好处和弊端,如pageHeper分页拦截器,tk自动生成工具,抽象方法的利弊等** 235 | 236 | 237 | 238 | 239 | 240 | ``` 241 | 1、开源工具 242 | 好处:开发方便,使用简单,使用aop方式进行分页,只需要引入相关依赖,然后PageHelper.startPage(page, size); 开启分页 243 | 244 | 弊端:对于分库分表等情况下使用有问题,深度分页逻辑判断会复杂 245 | 246 | mysql资料: 247 | 深度分页常用案例: 248 | https://www.cnblogs.com/lpfuture/p/5772055.html 249 | https://blog.csdn.net/li772030428/article/details/52839987 250 | 推荐书籍: 251 | https://book.douban.com/subject/23008813/ 252 | 253 | 2、封装的好坏 254 | 关于抽象和不抽象的选择,比如tk这些工具,通用mapper,service,controller 255 | 好处: 256 | 代码量大大减少,开发新模块可以马上进行使用 257 | 弊端: 258 | 对应过度封装,新手等比较难理解,不能保证团队里面所有人都有对应的水平,或者有高度封装的思想,也不是过度封装 259 | 260 | 课程案例: 261 | 分页采用pageHelper 262 | 封装通用工具类,如缓存操作等 263 | 利于解耦,如切换缓存框架 264 | 265 | ``` 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | #### 第6集 Mysql逆向工程效率神器之使用IDE自动生成Java实体类 274 | 275 | **简介:实战使用IDE根据Mysql自动生成java pojo实体类** 276 | 277 | 278 | 279 | 280 | 281 | ``` 282 | 1、IDEA连接数据库 283 | 菜单View→Tool Windows→Database打开数据库工具窗口 284 | 285 | 2、左上角添加按钮“+”,选择数据库类型 286 | 287 | 3、mysql主机,账户密码 288 | 119.23.28.97 289 | root 290 | 4、通过IDEA生成实体类 291 | 选中一张表,右键--->Scripted Extensions--->选择Generate POJOS.clj或者Generate POJOS.groovy,选择需要存放的路径,完成 292 | 293 | 自定义包名 294 | net.xdclass.xdvideo.domain 295 | 常用类型 296 | java.util.Date 297 | 298 | 5、大家一定要遵守规范 299 | 300 | 301 | ``` 302 | 303 | 304 | 305 | 306 | 307 | #### 第7集 接口配置文件自动映射到属性和实体类配置 308 | 309 | **简介:使用@value注解配置文件自动映射到属性和实体类** 310 | 311 | 312 | 313 | 314 | 315 | ``` 316 | 1、添加 @Component或者Configuration 注解; 317 | 318 | 2、使用 @PropertySource 注解指定配置文件位置;(属性名称规范: 大模块.子模块.属性名) 319 | #=================================微信相关================== 320 | #公众号 321 | wxpay.appid=wx5beac15ca207cdd40c 322 | wxpay.appsecret=554801238f17fdsdsdd6f96b382fe548215e9 323 | 3、必须 通过注入IOC对象Resource 进来 , 才能在类中使用获取的配置文件值。 324 | @Autowired 325 | private WeChatConfig weChatConfig; 326 | 例子: 327 | @Configuration 328 | @PropertySource(value="classpath:application.properties") 329 | public class WeChatConfig { 330 | @Value("${wxpay.appid}") 331 | private String appId; 332 | 333 | 334 | ``` 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | ### 第三章 开发在线教育视频站点核心业务之视频列表相关接口开发 343 | 344 | 345 | 346 | #### 第1集 整合Mybatis访问数据库和阿里巴巴数据源 347 | 348 | **简介:整合mysql 加入mybatis依赖,和加入alibaba druid数据源** 349 | 350 | 351 | 352 | ``` 353 | 1、加入依赖(可以用 http://start.spring.io/ 下载) 354 | 355 | 356 | 357 | 358 | org.mybatis.spring.boot 359 | mybatis-spring-boot-starter 360 | 1.3.2 361 | 362 | 363 | 364 | 365 | mysql 366 | mysql-connector-java 367 | runtime 368 | 369 | 370 | 371 | com.alibaba 372 | druid 373 | 1.1.6 374 | 375 | 376 | 377 | 2、加入配置文件 378 | #可以自动识别 379 | #spring.datasource.driver-class-name =com.mysql.jdbc.Driver 380 | 381 | spring.datasource.url=jdbc:mysql://localhost:3306/movie?useUnicode=true&characterEncoding=utf-8 382 | spring.datasource.username =root 383 | spring.datasource.password =password 384 | #如果不使用默认的数据源 (com.zaxxer.hikari.HikariDataSource) 385 | spring.datasource.type =com.alibaba.druid.pool.DruidDataSource 386 | 387 | 加载配置,注入到sqlSessionFactory等都是springBoot帮我们完成 388 | 389 | 3、启动类增加mapper扫描 390 | 391 | @MapperScan("net.xdclass.xdvideo.mapper") 392 | 393 | VideoMapper类例子 394 | @Select("SELECT * FROM video") 395 | @Results({ 396 | @Result(column = "create_time",property = "createTime") //javaType = java.util.Date.class 397 | }) 398 | List