# study-recode
**Repository Path**: happy60yeaar/study-recode
## Basic Information
- **Project Name**: study-recode
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2026-05-12
- **Last Updated**: 2026-05-19
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# 知识花园 - 智能学习心得记录平台

### 🌿 核心理念
将学习心得比作"种子",通过持续浇灌(复习)和知识分享,让个人知识像花园一样茁壮成长




---
## 📋 目录
- [项目介绍](#项目介绍)
- [系统要求](#系统要求)
- [技术栈](#技术栈)
- [快速开始](#快速开始)
- [后端开发](#后端开发)
- [前端开发](#前端开发)
- [数据库配置](#数据库配置)
- [API接口文档](#api接口文档)
- [项目结构](#项目结构)
- [常见问题](#常见问题)
- [许可证](#许可证)
---
## 🌟 项目介绍
**知识花园**是一款面向职场专业人士的智能学习心得记录平台,主要功能包括:
- ✅ **智能笔记管理** - Markdown编辑器,支持标签分类
- 🎯 **知识图谱可视化** - 自动生成知识点关联图谱
- 🧠 **思维导图生成** - 一键从笔记生成思维导图
- 📅 **间隔复习系统** - 基于艾宾浩斯遗忘曲线的科学复习
- 🤖 **AI智能助手** - 智能摘要、写作建议、知识问答
- 📊 **学习数据统计** - 可视化学习进度和成就系统
---
## 💻 系统要求
### 基础环境要求
| 环境 | 版本要求 | 说明 |
|------|---------|------|
| **JDK** | 17 或更高 | Java Development Kit |
| **Node.js** | 18.x 或更高 | 前端运行时环境 |
| **npm** | 9.x 或更高 | Node.js包管理器 |
| **MySQL** | 8.0 或更高 | 关系型数据库 |
| **Redis** | 6.x 或更高 | 缓存和会话存储(可选) |
### 开发工具推荐
- **后端IDE**: IntelliJ IDEA (推荐), Eclipse
- **前端IDE**: VS Code (推荐), WebStorm
- **数据库工具**: MySQL Workbench, Navicat
- **API测试**: Postman, Apifox
### 操作系统支持
- ✅ Windows 10/11
- ✅ macOS 10.15+
- ✅ Linux (Ubuntu 20.04+)
---
## 🛠 技术栈
### 后端技术
| 技术 | 版本 | 说明 |
|------|------|------|
| Spring Boot | 3.2.0 | 核心框架 |
| MyBatis-Plus | 3.5.5 | ORM框架 |
| MySQL | 8.0 | 数据库 |
| Redis | 7.0 | 缓存(可选) |
| JWT | 0.11.5 | 身份认证 |
| Lombok | - | 代码简化 |
### 前端技术
| 技术 | 版本 | 说明 |
|------|------|------|
| Vue 3 | 3.4 | 核心框架 |
| TypeScript | 5.3 | 类型系统 |
| Vite | 5.0 | 构建工具 |
| Element Plus | 2.4 | UI组件库 |
| Pinia | 2.1 | 状态管理 |
| ECharts | 5.4 | 数据可视化 |
| Axios | 1.6 | HTTP客户端 |
---
## 🚀 快速开始
### 1. 克隆项目
```bash
git clone https://github.com/your-username/study-record.git
cd study-record
```
### 2. 配置数据库
详细配置请参考 [数据库配置](#数据库配置) 章节
### 3. 启动后端服务
```bash
cd study-record-backend
mvn spring-boot:run
```
后端服务将在 `http://localhost:8080` 启动
### 4. 启动前端服务
```bash
cd study-record-frontend
npm install
npm run dev
```
前端服务将在 `http://localhost:3000` 启动
### 5. 访问应用
打开浏览器访问 `http://localhost:3000`,使用以下测试账号登录:
- 邮箱: `test@example.com`
- 密码: `123456`
> ⚠️ 请先在数据库中创建测试用户,或自行注册新账号
---
## 🔧 后端开发
### 项目结构
```
study-record-backend/
├── src/main/java/com/studyrecord/
│ ├── StudyRecordApplication.java # 启动类
│ ├── config/ # 配置类
│ │ ├── SecurityConfig.java # 安全配置
│ │ ├── MyBatisPlusConfig.java # MyBatis-Plus配置
│ │ └── WebConfig.java # Web配置
│ ├── controller/ # 控制器层
│ ├── service/ # 业务逻辑层
│ ├── mapper/ # 数据访问层
│ ├── entity/ # 实体类
│ ├── dto/ # 数据传输对象
│ ├── security/ # 安全认证
│ └── util/ # 工具类
├── src/main/resources/
│ ├── application.yml # 主配置文件
│ └── mapper/ # MyBatis XML映射
└── sql/
└── init.sql # 数据库初始化脚本
```
### 开发环境运行
```bash
# 进入后端目录
cd study-record-backend
# 使用Maven运行(开发模式)
mvn spring-boot:run
# 或者打包后运行
mvn clean package
java -jar target/study-record-backend-1.0.0.jar
```
### 打包部署
#### Maven打包
```bash
# 打包为JAR文件
mvn clean package -DskipTests
# 生成的JAR文件位于
ls target/*.jar
```
#### Docker部署(可选)
```bash
# 构建Docker镜像
docker build -t study-record-backend:1.0.0 .
# 运行容器
docker run -d \
-p 8080:8080 \
-e SPRING_PROFILES_ACTIVE=prod \
-e MYSQL_HOST=mysql-host \
study-record-backend:1.0.0
```
### 后端配置
主要配置文件: `src/main/resources/application.yml`
```yaml
server:
port: 8080
spring:
datasource:
url: jdbc:mysql://localhost:3306/study_record
username: root
password: your-password
data:
redis:
host: localhost
port: 6379
jwt:
secret: your-secret-key
access-token-expiration: 7200000
refresh-token-expiration: 604800000
```
### 环境配置
后端支持多环境配置:
```bash
# 开发环境
mvn spring-boot:run -Dspring-boot.run.profiles=dev
# 生产环境
mvn spring-boot:run -Dspring-boot.run.profiles=prod
```
配置文件命名规范:
- `application-dev.yml` - 开发环境
- `application-prod.yml` - 生产环境
- `application-test.yml` - 测试环境
---
## 🎨 前端开发
### 项目结构
```
study-record-frontend/
├── src/
│ ├── api/ # API接口定义
│ ├── assets/ # 静态资源
│ ├── components/ # 公共组件
│ ├── layouts/ # 布局组件
│ ├── router/ # 路由配置
│ ├── stores/ # Pinia状态管理
│ ├── types/ # TypeScript类型
│ ├── utils/ # 工具函数
│ ├── views/ # 页面视图
│ ├── App.vue # 根组件
│ └── main.ts # 入口文件
├── public/ # 公共资源
├── package.json # 依赖配置
├── vite.config.ts # Vite配置
└── tsconfig.json # TypeScript配置
```
### 开发环境运行
```bash
# 进入前端目录
cd study-record-frontend
# 安装依赖
npm install
# 启动开发服务器
npm run dev
```
前端服务将在 `http://localhost:3000` 启动,并自动代理API请求到后端。
### 构建生产版本
```bash
# 构建生产版本
npm run build
# 预览生产构建
npm run preview
```
构建产物位于 `dist/` 目录
### 前端配置
环境变量配置(可选):
```bash
# .env.development - 开发环境
VITE_API_BASE_URL=http://localhost:8080/api/v1
# .env.production - 生产环境
VITE_API_BASE_URL=https://your-domain.com/api/v1
```
### 代码规范
项目使用 ESLint 和 Prettier 进行代码检查和格式化:
```bash
# 检查代码规范
npm run lint
# 自动修复
npm run lint -- --fix
```
---
## 🗄 数据库配置
### MySQL安装与配置
#### Windows
1. 下载 MySQL 8.0: https://dev.mysql.com/downloads/mysql/
2. 安装并启动 MySQL 服务
3. 配置 root 密码
#### macOS
```bash
# 使用 Homebrew 安装
brew install mysql
brew services start mysql
```
#### Linux (Ubuntu)
```bash
# 安装 MySQL
sudo apt update
sudo apt install mysql-server
sudo systemctl start mysql
```
### 数据库初始化
#### 创建数据库
```bash
# 登录 MySQL
mysql -u root -p
# 创建数据库
CREATE DATABASE study_record CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
# 使用数据库
USE study_record;
# 执行初始化脚本
SOURCE sql/init.sql;
# 或者在命令行直接执行
mysql -u root -p study_record < sql/init.sql
```
#### 验证数据库
```sql
-- 查看所有表
SHOW TABLES;
-- 查看用户表结构
DESC users;
-- 查看默认成就数据
SELECT * FROM achievement_definitions;
```
### 数据库配置参数
修改 `application.yml` 中的数据库连接信息:
```yaml
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/study_record?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=false
username: root
password: your-password
hikari:
maximum-pool-size: 20
minimum-idle: 5
```
---
## 📚 API接口文档
### 基础信息
- **Base URL**: `http://localhost:8080/api/v1`
- **认证方式**: Bearer Token (JWT)
- **数据格式**: JSON
### 认证接口
#### 1. 用户注册
```http
POST /api/v1/auth/register
Content-Type: application/json
{
"email": "user@example.com",
"password": "password123",
"name": "用户名"
}
```
#### 2. 用户登录
```http
POST /api/v1/auth/login
Content-Type: application/json
{
"email": "user@example.com",
"password": "password123"
}
```
响应示例:
```json
{
"code": 200,
"message": "登录成功",
"data": {
"accessToken": "eyJhbGciOiJIUzI1NiIs...",
"refreshToken": "eyJhbGciOiJIUzI1NiIs...",
"userInfo": {
"id": 1,
"email": "user@example.com",
"name": "用户名",
"role": "user"
}
}
}
```
#### 3. 获取用户信息
```http
GET /api/v1/auth/userinfo
Authorization: Bearer
```
### 笔记接口
#### 1. 获取笔记列表
```http
GET /api/v1/notes?page=1&size=10&category=skill
Authorization: Bearer
```
#### 2. 获取笔记详情
```http
GET /api/v1/notes/{id}
Authorization: Bearer
```
#### 3. 创建笔记
```http
POST /api/v1/notes
Authorization: Bearer
Content-Type: application/json
{
"title": "笔记标题",
"content": "笔记内容(Markdown)",
"category": "skill",
"tags": ["Java", "Spring"],
"summary": "摘要描述"
}
```
#### 4. 更新笔记
```http
PUT /api/v1/notes/{id}
Authorization: Bearer
Content-Type: application/json
{
"title": "更新后的标题",
"content": "更新后的内容"
}
```
#### 5. 删除笔记
```http
DELETE /api/v1/notes/{id}
Authorization: Bearer
```
### 统一响应格式
```json
{
"code": 200,
"message": "操作成功",
"data": {},
"timestamp": 1699999999999
}
```
### 错误码说明
| 错误码 | 说明 | HTTP状态码 |
|--------|------|-----------|
| 200 | 成功 | 200 |
| 400 | 请求参数错误 | 400 |
| 401 | 未授权/Token过期 | 401 |
| 403 | 禁止访问 | 403 |
| 404 | 资源不存在 | 404 |
| 500 | 服务器内部错误 | 500 |
### API文档访问
启动后端服务后,可通过以下地址访问 Swagger API 文档:
```
http://localhost:8080/swagger-ui/index.html
```
---
## 📁 项目结构
```
study-record/
├── .trae/documents/ # 项目文档
│ ├── 产品需求文档.md # PRD文档
│ └── 技术架构文档.md # 技术架构
├── study-record-backend/ # 后端项目
│ ├── src/
│ │ ├── main/
│ │ │ ├── java/ # Java源代码
│ │ │ └── resources/ # 配置文件
│ │ └── test/ # 测试代码
│ ├── sql/
│ │ └── init.sql # 数据库初始化
│ ├── pom.xml # Maven配置
│ └── README.md # 后端说明
└── study-record-frontend/ # 前端项目
├── src/ # 源代码
├── public/ # 公共资源
├── package.json # 依赖配置
├── vite.config.ts # Vite配置
└── README.md # 前端说明
```
---
## ❓ 常见问题
### Q1: 启动后端报错"端口被占用"?
```bash
# Windows 查看端口占用
netstat -ano | findstr :8080
# 结束占用进程
taskkill /PID <进程ID> /F
# 或修改端口
# 编辑 application.yml
server:
port: 8081
```
### Q2: 数据库连接失败?
1. 检查 MySQL 服务是否启动
2. 确认用户名密码正确
3. 检查数据库是否存在
4. 确认时区设置正确
### Q3: 前端无法调用后端API?
1. 检查后端服务是否启动
2. 检查 Vite 代理配置
3. 确认 CORS 配置正确
### Q4: npm install 失败?
```bash
# 清理缓存
npm cache clean --force
# 删除 node_modules
rm -rf node_modules
# 重新安装
npm install
```
### Q5: 如何重置数据库?
```bash
# 删除数据库
mysql -u root -p -e "DROP DATABASE IF EXISTS study_record;"
# 重新创建
mysql -u root -p < sql/init.sql
```
### Q6: 如何查看后端日志?
日志配置在 `application.yml`:
```yaml
logging:
level:
com.studyrecord: debug
file:
name: logs/application.log
```
---
## 📄 许可证
本项目基于 MIT 许可证开源,你可以免费使用、修改和分发本项目。
---
## 🙏 致谢
感谢以下开源项目:
- [Spring Boot](https://spring.io/projects/spring-boot)
- [Vue.js](https://vuejs.org/)
- [Element Plus](https://element-plus.org/)
- [MyBatis-Plus](https://baomidou.com/)
---
Made with ❤️ by Your Name
如果对你有帮助,请给个 ⭐ Star!