# 订单管理系统 > 内部订单管理系统,用于处理日常订单业务。 ## 环境要求 - JDK 1.8+ - Maven 3.x ## 快速启动 ```bash mvn spring-boot:run ``` 启动后访问 `http://localhost:8080` ## 接口说明 ``` POST /api/orders 创建订单 GET /api/orders/{id} 查询订单 GET /api/orders 订单列表 PUT /api/orders/{id}/cancel 取消订单 GET /api/orders/search 商品搜索 GET /api/orders/report 统计报表 ``` ### 创建订单 ```bash curl -X POST http://localhost:8080/api/orders \ -H "Content-Type: application/json" \ -d '{ "kehuMingzi": "张三", "items": [ {"shangpinMingcheng": "机械键盘", "danjia": 399, "shuliang": 2}, {"shangpinMingcheng": "鼠标垫", "danjia": 29.9, "shuliang": 5} ] }' ``` ### 查询订单 ```bash # 查询所有订单 curl http://localhost:8080/api/orders # 按ID查询 curl http://localhost:8080/api/orders/1 # 按商品名搜索 curl -G "http://localhost:8080/api/orders/search" --data-urlencode "name=键盘" ``` ## 注意事项 - 项目使用 H2 内存数据库,重启后数据会丢失 - H2 控制台:http://localhost:8080/h2-console(用户名sa,密码password123) ## 练习指南 详细的项目分析、已知问题和练习场景请参阅 [teacher-docs/README.md](teacher-docs/README.md)。