feat: update docs (#47)

This commit is contained in:
vran
2022-03-13 22:15:23 +08:00
committed by GitHub
parent 6e798f4d97
commit 4b36dda6c2
35 changed files with 177 additions and 166 deletions

117
docs/README/build.md Normal file
View File

@@ -0,0 +1,117 @@
# 构建指南
## 前言
Databasir 采用了前后端分离的模式进行开发和部署,项目仓库地址分别位于
- 后端应用: https://github.com/vran-dev/databasir
- 前端应用: https://github.com/vran-dev/databasir-frontend
## 后端
**一、环境要求**
1. Java 11+
2. Mysql
3. Intellij IDEA
**二、主要框架**
1. Gradle构建工具
2. Spring-boot核心框架
1. Web
2. Security
3. Quartz定时任务调度
4. JOOQORM 框架
5. Lombok代码生成
6. Mapstruct代码生成
7. Flyway数据库脚本管理
**三、项目结构**
项目结构采用了分层结构
- api所有的 http 接口、定时任务都在该模块下
- common主要包含通用异常定义、加解密算法工具
- core包含了所有的业务核心逻辑包括 service、request/response data、converter 等
- dao针对数据库的操作类都在该模块下其中 generated-src 包含了 jooq 生成的代码src 主要包含了 dao 的实现类
- plugin主要包含了 JDBC 工具类,包括但不限于将数据库的元数据解析为 Java 对象 、PDF 导出等
项目配置都放在 api/src/main/resources 目录下
前端静态文件放在 api/src/main/resources/static 目录下
项目数据库脚本放在 dao/src/main/resources/db/migration 目录下
**四、项目启动**
1、通过 Java Main 方法启动
修改或创建配置文件 `api/src/main/resources/application-local.properties`
```properties
server.port=8080
logging.level.org.jooq=INFO
# 必须:数据库配置
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.username=root
spring.datasource.password=123456
spring.datasource.url=jdbc:mysql://localhost:3306/databasir
spring.jooq.sql-dialect=mysql
# 可选flyway 配置
spring.flyway.enabled=true
spring.flyway.baseline-on-migrate=true
spring.flyway.locations=classpath:db/migration
```
启动 DatabasirApplicationcom.databasir.DatabasirApplication 类,启动时需要加参数 `-Dspring.profiles.active=local`
启动完成后,可以通过 http://localhost:8080 访问
2、通过 Gradle 启动
与 Java 启动模式一样,首先需要准备配置文件
修改或创建配置文件 `api/src/main/resources/application-local.properties`
```properties
server.port=8080
logging.level.org.jooq=INFO
# 必须:数据库配置
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.username=root
spring.datasource.password=123456
spring.datasource.url=jdbc:mysql://localhost:3306/databasir
spring.jooq.sql-dialect=mysql
# 可选flyway 配置
spring.flyway.enabled=true
spring.flyway.baseline-on-migrate=true
spring.flyway.locations=classpath:db/migration
```
执行 Gradle 命令
```shell
./gradlew bootRun --args='--spring.profiles.active=local'
```
启动完成后,可以通过 http://localhost:8080 访问
## 前端
一、依赖
1. vue
2. vuex
3. element-plus
4. axios
二、运行
```shell
npm run serve
```
默认端口为 3000