# vueDemo **Repository Path**: peisuer/vueDemo ## Basic Information - **Project Name**: vueDemo - **Description**: 学生管理系统前台vue3.0项目 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-04-24 - **Last Updated**: 2026-04-24 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README <<<<<<< HEAD # vuedemo This template should help get you started developing with Vue 3 in Vite. ## Recommended IDE Setup [VS Code](https://code.visualstudio.com/) + [Vue (Official)](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur). ## Recommended Browser Setup - Chromium-based browsers (Chrome, Edge, Brave, etc.): - [Vue.js devtools](https://chromewebstore.google.com/detail/vuejs-devtools/nhdogjmejiglipccpnnnanhbledajbpd) - [Turn on Custom Object Formatter in Chrome DevTools](http://bit.ly/object-formatters) - Firefox: - [Vue.js devtools](https://addons.mozilla.org/en-US/firefox/addon/vue-js-devtools/) - [Turn on Custom Object Formatter in Firefox DevTools](https://fxdx.dev/firefox-devtools-custom-object-formatters/) ## Customize configuration See [Vite Configuration Reference](https://vite.dev/config/). ## Project Setup ```sh npm install ``` ### Compile and Hot-Reload for Development ```sh npm run dev ``` ### Compile and Minify for Production ```sh npm run build ``` ======= # 学生信息管理系统 基于Spring Boot的学生信息管理系统后端API。 ## 功能特性 - 学生信息的增删改查(CRUD) - 多种查询方式:按学号、姓名、班级、专业、性别、年龄范围等 - 学号唯一性验证 - 自动生成创建时间和更新时间 - RESTful API设计 - 跨域支持 ## 技术栈 - Java 21 - Spring Boot 3.2.5 - Spring Data JPA - MySQL 8.0+ - Maven ## 数据库设计 ### 学生表 (students) | 字段名 | 类型 | 说明 | |--------|------|------| | id | BIGINT | 主键,自增 | | student_number | VARCHAR(20) | 学号,唯一 | | name | VARCHAR(50) | 姓名 | | gender | ENUM('MALE','FEMALE','OTHER') | 性别 | | age | INT | 年龄 | | birth_date | DATE | 出生日期 | | email | VARCHAR(100) | 邮箱 | | phone | VARCHAR(20) | 手机号 | | class_name | VARCHAR(50) | 班级名称 | | major | VARCHAR(100) | 专业 | | enrollment_date | DATE | 入学日期 | | address | VARCHAR(255) | 地址 | | created_at | TIMESTAMP | 创建时间 | | updated_at | TIMESTAMP | 更新时间 | ## 快速开始 ### 1. 环境要求 - JDK 21+ - MySQL 8.0+ - Maven 3.6+ ### 2. 数据库配置 #### 方式一:使用SQL脚本(推荐) 1. 登录MySQL: ```bash mysql -u root -p ``` 2. 执行SQL脚本: ```sql source sql/student_management.sql ``` #### 方式二:自动创建(JPA) 修改 `src/main/resources/application.properties` 中的数据库连接信息: ```properties spring.datasource.url=jdbc:mysql://localhost:3306/student_management spring.datasource.username=your_username spring.datasource.password=your_password ``` JPA会自动创建表结构(`spring.jpa.hibernate.ddl-auto=update`)。 ### 3. 运行应用程序 #### 使用Maven: ```bash mvn spring-boot:run ``` #### 使用Maven Wrapper: ```bash ./mvnw spring-boot:run # Linux/Mac mvnw.cmd spring-boot:run # Windows ``` #### 打包后运行: ```bash mvn clean package java -jar target/demo-0.0.1-SNAPSHOT.jar ``` 应用程序将在 http://localhost:8080 启动。 ## API文档 ### 学生管理API #### 获取所有学生 ``` GET /api/students ``` #### 根据ID获取学生 ``` GET /api/students/{id} ``` #### 根据学号获取学生 ``` GET /api/students/student-number/{studentNumber} ``` #### 创建学生 ``` POST /api/students Content-Type: application/json { "studentNumber": "20230001", "name": "张三", "gender": "MALE", "age": 20, "birthDate": "2003-05-15", "email": "zhangsan@example.com", "phone": "13800138001", "className": "计算机科学与技术1班", "major": "计算机科学与技术", "enrollmentDate": "2023-09-01", "address": "北京市海淀区" } ``` #### 更新学生信息 ``` PUT /api/students/{id} Content-Type: application/json ``` #### 删除学生 ``` DELETE /api/students/{id} ``` #### 根据学号删除学生 ``` DELETE /api/students/student-number/{studentNumber} ``` #### 根据姓名搜索学生 ``` GET /api/students/search/name?name=张 ``` #### 根据班级查询学生 ``` GET /api/students/class/{className} ``` #### 根据专业查询学生 ``` GET /api/students/major/{major} ``` #### 根据性别查询学生 ``` GET /api/students/gender/{gender} ``` #### 根据年龄范围查询学生 ``` GET /api/students/age-range?minAge=18&maxAge=22 ``` #### 综合搜索(学号或姓名) ``` GET /api/students/search?keyword=2023 ``` #### 检查学号是否存在 ``` GET /api/students/exists/student-number/{studentNumber} ``` #### 统计学生总数 ``` GET /api/students/count ``` #### 获取班级人数统计 ``` GET /api/students/stats/class-count ``` #### 健康检查 ``` GET /api/students/health ``` ## 项目结构 ``` src/main/java/com/example/demo/ ├── DemoApplication.java # 主应用程序类 ├── controller/ │ └── StudentController.java # REST API控制器 ├── service/ │ ├── StudentService.java # 服务接口 │ └── impl/ │ └── StudentServiceImpl.java # 服务实现 ├── repository/ │ └── StudentRepository.java # 数据访问层 └── entity/ └── Student.java # 实体类 sql/ └── student_management.sql # 数据库SQL脚本 ``` ## 测试 运行单元测试: ```bash mvn test ``` ## 注意事项 1. 默认数据库用户名为`root`,密码为`root`,请根据实际情况修改`application.properties` 2. 学号具有唯一性约束,不能重复 3. 创建时间和更新时间由系统自动维护 4. 性别字段使用枚举:MALE(男)、FEMALE(女)、OTHER(其他) ## 故障排除 ### 数据库连接失败 - 检查MySQL服务是否运行 - 验证`application.properties`中的数据库连接信息 - 确认数据库用户有足够的权限 ### 端口被占用 - 修改`application.properties`中的`server.port`属性 - 检查是否有其他应用程序占用8080端口 ### 编译错误 - 确认JDK版本为21+ - 运行`mvn clean compile`重新编译 ## 许可证 MIT >>>>>>> 695c318c86ad0c49859dd88e1214638c12652106