# sanyexam **Repository Path**: JituiTech/sanyexam ## Basic Information - **Project Name**: sanyexam - **Description**: SanyExam 是一个基于 Spring Boot 3.2 + MyBatis Plus 的在线考试系统,支持题库管理、在线考试、成绩统计、权限管理等功能。系统采用前后端分离架构,提供完善的 RESTful API 接口。 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 0 - **Created**: 2026-01-10 - **Last Updated**: 2026-01-16 ## Categories & Tags **Categories**: Uncategorized **Tags**: 三元智考, 考试系统 ## README # 📝 SanyExam - 在线考试系统 [![Spring Boot](https://img.shields.io/badge/Spring%20Boot-3.2.0-brightgreen.svg)](https://spring.io/projects/spring-boot) [![Java](https://img.shields.io/badge/Java-17-orange.svg)](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html) [![MyBatis Plus](https://img.shields.io/badge/MyBatis%20Plus-3.5.5-blue.svg)](https://baomidou.com/) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) ## 📖 项目简介 [官网地址](https://sanyexam.com/) SanyExam 是一个基于 Spring Boot 3.2 + MyBatis Plus 的在线考试系统,支持题库管理、在线考试、成绩统计、权限管理等功能。系统采用前后端分离架构,提供完善的 RESTful API 接口。 ### ✨ 主要特性 - 🎯 **题库管理**:支持多种题型(单选、多选、判断、填空、简答等) - 📊 **考试管理**:在线组卷、考试监控、成绩统计 - 👥 **用户管理**:基于 Shiro 的权限控制,支持多角色管理 - 🔐 **安全认证**:JWT Token 认证,滑块验证码防刷 - 📈 **数据分析**:Elasticsearch 全文检索,Redis 缓存加速 - 🎨 **API 文档**:集成 Knife4j,提供美观的接口文档 - 📱 **消息通知**:支持短信、邮件通知(阿里云短信、SendCloud 邮件) - 🌐 **分布式支持**:Redisson 分布式锁,支持集群部署 ## 🚀 快速开始 ### 环境要求 - **JDK**: 17+ - **Maven**: 3.9+ - **MySQL**: 8.0+ - **Redis**: 7.0+ - **Elasticsearch**: 8.x(可选) - **node**: v20.19+ ### 安装步骤 #### 1. 克隆项目 ```bash git clone https://gitee.com/JituiTech/sanyexam.git ``` #### 2. 创建数据库 ```bash # 登录 MySQL mysql -u root -p # 创建数据库 create database sy_exam DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; # 导入数据库脚本 USE sy_exam; SOURCE db/exam.sql; ``` #### 3. 修改配置文件 编辑 `ex-service/src/main/resources/application-dev.yml`: ```yaml spring: datasource: url: jdbc:mysql://localhost:3306/dw_exam?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai username: root password: your_password data: redis: host: localhost port: 6379 password: your_redis_password database: 0 # Elasticsearch 配置(如果使用) elasticsearch: hosts: localhost:9200 username: elastic passwd: your_es_password ``` #### 4. 编译项目 ```bash # 清理并编译 mvn clean install -DskipTests # 或者只编译不打包 mvn clean compile ``` #### 5. 启动项目 ```bash # 方式一:使用 Maven 启动 cd ex-service mvn spring-boot:run # 方式二:使用 JAR 包启动 java -jar ex-service/target/ex-service-1.0-SNAPSHOT.jar # 方式三:使用 IDE 启动 # 直接运行 net.diaowen.ExamSystemApplication 主类 ``` #### 6. 访问系统 启动成功后,控制台会显示 API 文档地址: ``` ╔══════════════════════════════════════════════════════════════╗ ║ API 文档地址 ║ ╠══════════════════════════════════════════════════════════════╣ ║ Knife4j 文档: http://localhost:8080/api/doc.html ║ ║ Swagger UI: http://localhost:8080/api/swagger-ui.html ║ ║ API JSON: http://localhost:8080/api/v3/api-docs ║ ╚══════════════════════════════════════════════════════════════╝ ``` - **API 文档**: http://localhost:8080/api/doc.html - **Swagger UI**: http://localhost:8080/api/swagger-ui.html - **健康检查**: http://localhost:8080/api/actuator/health #### 7. 启动前端 ```shell cd exam-frontend 安装依赖 npm install 启动开发服务器 npm run dev 生产环境构建 npm run build ``` ### 默认账号 系统初始化后会创建默认管理员账号: - **管理员账号**: service@sanyexam.com - **默认密码**: 123456 ## 🔧 配置说明 ### 文件存储配置 支持本地存储和阿里云 OSS 存储: ```yaml dwsurvey: file-storage: type: local # local=本地存储 | yun=云存储 aliyun: endpoint: https://oss-cn-beijing.aliyuncs.com access-keyid: your_access_key secret-accesskey: your_secret_key bucket: prefix: dwsurvey ``` ### Redis 配置 ```yaml spring: data: redis: host: localhost port: 6379 password: your_password database: 0 timeout: 10000ms lettuce: pool: max-active: 8 max-wait: -1ms max-idle: 8 min-idle: 0 ``` ### Redisson 配置 Redisson 用于实现分布式锁、分布式限流等功能: ```yaml redisson: # 单机模式 single-server-config: address: redis://localhost:6379 password: your_password database: 0 connection-pool-size: 64 connection-minimum-idle-size: 10 idle-connection-timeout: 10000 timeout: 3000 ``` ### Elasticsearch 配置 ```yaml elasticsearch: username: elastic passwd: your_password apikey: == # API Key 认证(可选) hosts: localhost:9200 # 多个IP逗号隔开,如:192.168.1.1:9200,192.168.1.2:9200 cert-name: http_ca.crt # 证书文件名(使用证书认证时需要) # 协议方式,使用证书时改成 https scheme: http # http 或 https # 索引统一前缀,默认为空不加前缀,如果加建议格式如:dw_ index-prev: oss_ # 认证方式:noPwd-无密码 | pwd-密码认证 | cert-证书认证 security: pwd ``` **注意事项**: - `security: noPwd` - 无密码模式,适用于开发环境 - `security: pwd` - 密码认证模式(推荐) - `security: cert` - 证书认证模式,需配置 `cert-name` 并将证书放在 resources 目录 - 多节点配置示例:`hosts: 192.168.1.1:9200,192.168.1.2:9200,192.168.1.3:9200` ## 🔐 安全配置 ### JWT Token 系统使用 JWT 进行身份认证,Token 有效期可在配置文件中设置。 ### 验证码 集成天爱验证码,支持滑块验证、文字点选等多种验证方式: ```yaml captcha: expire: default: 10000 WORD_IMAGE_CLICK: 60000 secondary: enabled: true ``` ## 📊 日志 ### 日志配置 日志文件按日期分类存储在 `logs/` 目录: ``` logs/ ├── 2026-01-08/ │ ├── error/ # 错误日志 │ ├── warn/ # 警告日志 │ └── info/ # 信息日志 ``` ## 📄 开源协议 本项目采用 [Apache License 2.0](https://opensource.org/licenses/Apache-2.0) 开源协议。 ## 🙏 致谢 感谢以下开源项目: - [Spring Boot](https://spring.io/projects/spring-boot) - [MyBatis Plus](https://baomidou.com/) - [Knife4j](https://doc.xiaominfo.com/) - [Hutool](https://hutool.cn/) - [Redisson](https://redisson.org/) - [tianai-captcha](https://gitee.com/dromara/tianai-captcha/) ## 📝 更新日志 ### v1.0.0 (2025-12-06) - 🎉 项目初始化 - ✨ 完成基础功能开发 - 📚 集成 API 文档 - 🔐 实现权限控制 --- **⭐ 如果这个项目对你有帮助,请给个 Star 支持一下!**