update
This commit is contained in:
parent
0f250656e1
commit
3f1f0bd284
370
api.md
370
api.md
@ -5,11 +5,379 @@
|
||||
```json
|
||||
{
|
||||
"code": 200, // 状态码
|
||||
"msg": "", // 错误信息
|
||||
"msg": "", // 错误信息
|
||||
"data": {} // 具体响应数据
|
||||
}
|
||||
```
|
||||
|
||||
## 成员管理
|
||||
基础路径: `/api/members`
|
||||
|
||||
### 1. 创建成员
|
||||
- 请求方式: `POST`
|
||||
- 请求路径: `/api/members`
|
||||
- 请求体: `Member`对象
|
||||
```json
|
||||
{
|
||||
"userName": "用户名",
|
||||
"avatar": "头像URL",
|
||||
"password": "密码",
|
||||
"salt": "密码盐值",
|
||||
"name": "姓名",
|
||||
"address": "地址",
|
||||
"postcode": "邮编",
|
||||
"sruNumber": "SRU编号",
|
||||
"dateOfBirth": "1990-01-01",
|
||||
"telNumber": "固定电话",
|
||||
"mobileNumber": "手机号码",
|
||||
"email": "电子邮箱"
|
||||
}
|
||||
```
|
||||
- 响应: 成功返回空数据
|
||||
|
||||
### 2. 删除成员
|
||||
- 请求方式: `DELETE`
|
||||
- 请求路径: `/api/members/{id}`
|
||||
- 路径参数: `id` - 成员ID
|
||||
- 响应: 成功返回空数据
|
||||
|
||||
### 3. 更新成员
|
||||
- 请求方式: `PUT`
|
||||
- 请求路径: `/api/members`
|
||||
- 请求体: `Member`对象
|
||||
- 响应: 成功返回空数据
|
||||
|
||||
### 4. 获取单个成员
|
||||
- 请求方式: `GET`
|
||||
- 请求路径: `/api/members/{id}`
|
||||
- 路径参数: `id` - 成员ID
|
||||
- 响应: 返回成员详细信息
|
||||
|
||||
### 5. 分页获取成员列表
|
||||
- 请求方式: `GET`
|
||||
- 请求路径: `/api/members/page`
|
||||
- 请求参数:
|
||||
- `pageNum`: 页码(默认1)
|
||||
- `pageSize`: 每页大小(默认10)
|
||||
- 响应: 返回分页数据
|
||||
|
||||
### 6. 获取随机成员
|
||||
- 请求方式: `GET`
|
||||
- 请求路径: `/api/members/random`
|
||||
- 响应: 返回4个随机成员的详细信息
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"msg": "",
|
||||
"data": [
|
||||
{
|
||||
"avatar": "头像URL",
|
||||
"name": "成员姓名",
|
||||
"dateOfBirth": "1990-01-01",
|
||||
"role": "角色名称",
|
||||
"sruNumber": "SRU编号",
|
||||
"email": "电子邮箱"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## 球员管理
|
||||
基础路径: `/api/players`
|
||||
|
||||
### 1. 创建球员
|
||||
- 请求方式: `POST`
|
||||
- 请求路径: `/api/players`
|
||||
- 请求体: `Player`对象
|
||||
```json
|
||||
{
|
||||
"memberId": "成员ID",
|
||||
"teamId": "团队ID",
|
||||
"position": "位置",
|
||||
"teamNumber": "队内编号",
|
||||
"height": 180,
|
||||
"weight": 75,
|
||||
"guardian1Name": "监护人1姓名",
|
||||
"guardian1Relationship": "与监护人1关系",
|
||||
"guardian1Address": "监护人1地址",
|
||||
"guardian1Tel": "监护人1电话",
|
||||
"guardian2Name": "监护人2姓名",
|
||||
"guardian2Relationship": "与监护人2关系",
|
||||
"guardian2Address": "监护人2地址",
|
||||
"guardian2Tel": "监护人2电话",
|
||||
"doctorName": "医生姓名",
|
||||
"doctorTel": "医生电话",
|
||||
"doctorAddress": "医生地址",
|
||||
"knownHealthIssues": "已知健康问题"
|
||||
}
|
||||
```
|
||||
- 响应: 成功返回空数据
|
||||
|
||||
### 2. 删除球员
|
||||
- 请求方式: `DELETE`
|
||||
- 请求路径: `/api/players/{id}`
|
||||
- 路径参数: `id` - 球员ID
|
||||
- 响应: 成功返回空数据
|
||||
|
||||
### 3. 更新球员
|
||||
- 请求方式: `PUT`
|
||||
- 请求路径: `/api/players`
|
||||
- 请求体: `Player`对象
|
||||
- 响应: 成功返回空数据
|
||||
|
||||
### 4. 获取单个球员
|
||||
- 请求方式: `GET`
|
||||
- 请求路径: `/api/players/{id}`
|
||||
- 路径参数: `id` - 球员ID
|
||||
- 响应: 返回球员详细信息
|
||||
|
||||
### 5. 分页获取球员列表
|
||||
- 请求方式: `GET`
|
||||
- 请求路径: `/api/players/page`
|
||||
- 请求参数:
|
||||
- `pageNum`: 页码(默认1)
|
||||
- `pageSize`: 每页大小(默认10)
|
||||
- 响应: 返回分页数据,包含以下字段:
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"msg": "",
|
||||
"data": {
|
||||
"records": [
|
||||
{
|
||||
"id": "球员ID",
|
||||
"position": "位置",
|
||||
"teamNumber": "队内编号",
|
||||
"height": 180,
|
||||
"weight": 75,
|
||||
"createTime": "2024-04-10T16:30:00",
|
||||
"name": "姓名",
|
||||
"avatar": "头像URL",
|
||||
"sruNumber": "SRU编号",
|
||||
"dateOfBirth": "1990-01-01",
|
||||
"email": "电子邮箱",
|
||||
"telNumber": "固定电话",
|
||||
"mobileNumber": "手机号码",
|
||||
"guardian1Name": "监护人1姓名",
|
||||
"guardian1Tel": "监护人1电话",
|
||||
"guardian2Name": "监护人2姓名",
|
||||
"guardian2Tel": "监护人2电话",
|
||||
"doctorName": "医生姓名",
|
||||
"doctorTel": "医生电话",
|
||||
"knownHealthIssues": "已知健康问题",
|
||||
"teamName": "队伍名称"
|
||||
}
|
||||
],
|
||||
"total": 100,
|
||||
"size": 10,
|
||||
"current": 1
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 6. 按团队分页获取球员列表
|
||||
- 请求方式: `GET`
|
||||
- 请求路径: `/api/players/page/team/{teamId}`
|
||||
- 路径参数: `teamId` - 团队ID
|
||||
- 请求参数:
|
||||
- `pageNum`: 页码(默认1)
|
||||
- `pageSize`: 每页大小(默认10)
|
||||
- 响应: 返回分页数据
|
||||
|
||||
### 7. 获取随机球员
|
||||
- 请求方式: `GET`
|
||||
- 请求路径: `/api/players/random`
|
||||
- 响应: 返回3个随机球员的详细信息
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"msg": "",
|
||||
"data": [
|
||||
{
|
||||
"name": "球员姓名",
|
||||
"avatar": "头像URL",
|
||||
"teamName": "队伍名称",
|
||||
"position": "位置",
|
||||
"teamNumber": "队内编号",
|
||||
"height": 180,
|
||||
"weight": 75,
|
||||
"createTime": "2024-04-10T16:30:00",
|
||||
"passingStandard": 5,
|
||||
"passingSpin": 5,
|
||||
"passingPop": 5,
|
||||
"tacklingFront": 5,
|
||||
"tacklingRear": 5,
|
||||
"tacklingSide": 5,
|
||||
"tacklingScrabble": 5,
|
||||
"kickingDrop": 5,
|
||||
"kickingPunt": 5,
|
||||
"kickingGrubber": 5,
|
||||
"kickingGoal": 5
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## 球员技能档案管理
|
||||
基础路径: `/api/player-skills`
|
||||
|
||||
### 1. 创建技能档案
|
||||
- 请求方式: `POST`
|
||||
- 请求路径: `/api/player-skills`
|
||||
- 请求体: `PlayerSkillProfile`对象
|
||||
```json
|
||||
{
|
||||
"playerId": "球员ID",
|
||||
"passingStandard": 5,
|
||||
"passingStandardComment": "标准传球评价",
|
||||
"passingSpin": 5,
|
||||
"passingSpinComment": "旋转传球评价",
|
||||
"passingPop": 5,
|
||||
"passingPopComment": "快速传球评价",
|
||||
"tacklingFront": 5,
|
||||
"tacklingFrontComment": "正面铲球评价",
|
||||
"tacklingRear": 5,
|
||||
"tacklingRearComment": "背后铲球评价",
|
||||
"tacklingSide": 5,
|
||||
"tacklingSideComment": "侧面铲球评价",
|
||||
"tacklingScrabble": 5,
|
||||
"tacklingScrabbleComment": "争抢铲球评价",
|
||||
"kickingDrop": 5,
|
||||
"kickingDropComment": "落地踢球评价",
|
||||
"kickingPunt": 5,
|
||||
"kickingPuntComment": "踢远球评价",
|
||||
"kickingGrubber": 5,
|
||||
"kickingGrubberComment": "滚地踢球评价",
|
||||
"kickingGoal": 5,
|
||||
"kickingGoalComment": "射门评价"
|
||||
}
|
||||
```
|
||||
- 响应: 成功返回空数据
|
||||
|
||||
### 2. 删除技能档案
|
||||
- 请求方式: `DELETE`
|
||||
- 请求路径: `/api/player-skills/{id}`
|
||||
- 路径参数: `id` - 技能档案ID
|
||||
- 响应: 成功返回空数据
|
||||
|
||||
### 3. 更新技能档案
|
||||
- 请求方式: `PUT`
|
||||
- 请求路径: `/api/player-skills`
|
||||
- 请求体: `PlayerSkillProfile`对象
|
||||
- 响应: 成功返回空数据
|
||||
|
||||
### 4. 获取单个技能档案
|
||||
- 请求方式: `GET`
|
||||
- 请求路径: `/api/player-skills/{id}`
|
||||
- 路径参数: `id` - 技能档案ID
|
||||
- 响应: 返回技能档案详细信息
|
||||
|
||||
### 5. 获取球员的技能档案
|
||||
- 请求方式: `GET`
|
||||
- 请求路径: `/api/player-skills/player/{playerId}`
|
||||
- 路径参数: `playerId` - 球员ID
|
||||
- 响应: 返回技能档案详细信息
|
||||
|
||||
### 6. 分页获取技能档案列表
|
||||
- 请求方式: `GET`
|
||||
- 请求路径: `/api/player-skills/page`
|
||||
- 请求参数:
|
||||
- `pageNum`: 页码(默认1)
|
||||
- `pageSize`: 每页大小(默认10)
|
||||
- 响应: 返回分页数据
|
||||
|
||||
## 公告管理
|
||||
基础路径: `/api/announcements`
|
||||
|
||||
### 1. 创建公告
|
||||
- 请求方式: `POST`
|
||||
- 请求路径: `/api/announcements`
|
||||
- 请求体: `Announcement`对象
|
||||
```json
|
||||
{
|
||||
"title": "公告标题",
|
||||
"content": "公告内容",
|
||||
"time": "2024-03-21T10:00:00"
|
||||
}
|
||||
```
|
||||
- 响应:
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"msg": "",
|
||||
"data": null
|
||||
}
|
||||
```
|
||||
|
||||
### 2. 删除公告
|
||||
- 请求方式: `DELETE`
|
||||
- 请求路径: `/api/announcements/{id}`
|
||||
- 路径参数: `id` - 公告ID
|
||||
- 响应:
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"msg": "",
|
||||
"data": null
|
||||
}
|
||||
```
|
||||
|
||||
### 3. 更新公告
|
||||
- 请求方式: `PUT`
|
||||
- 请求路径: `/api/announcements`
|
||||
- 请求体: `Announcement`对象
|
||||
```json
|
||||
{
|
||||
"id": "公告ID",
|
||||
"title": "公告标题",
|
||||
"content": "公告内容",
|
||||
"time": "2024-03-21T10:00:00"
|
||||
}
|
||||
```
|
||||
- 响应:
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"msg": "",
|
||||
"data": null
|
||||
}
|
||||
```
|
||||
|
||||
### 4. 获取单个公告
|
||||
- 请求方式: `GET`
|
||||
- 请求路径: `/api/announcements/{id}`
|
||||
- 路径参数: `id` - 公告ID
|
||||
- 响应:
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"msg": "",
|
||||
"data": {
|
||||
"id": "公告ID",
|
||||
"title": "公告标题",
|
||||
"content": "公告内容",
|
||||
"time": "2024-03-21T10:00:00"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 5. 获取最新公告
|
||||
- 请求方式: `GET`
|
||||
- 请求路径: `/api/announcements/latest`
|
||||
- 响应:
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"msg": "",
|
||||
"data": {
|
||||
"id": "公告ID",
|
||||
"title": "公告标题",
|
||||
"content": "公告内容",
|
||||
"time": "2024-03-21T10:00:00"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 广告模块
|
||||
|
||||
### 1. 创建广告
|
||||
|
||||
@ -3,7 +3,7 @@ package org.sqa.simply_rugby;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
@SpringBootApplication(scanBasePackages = "org.sqa.simply_rugby")
|
||||
public class SimpleRugbyApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
@ -5,35 +5,33 @@ import lombok.Data;
|
||||
@Data
|
||||
public class Result<T> {
|
||||
private Integer code;
|
||||
private String message;
|
||||
private String msg;
|
||||
private T data;
|
||||
|
||||
public static <T> Result<T> success() {
|
||||
Result<T> result = new Result<>();
|
||||
result.setCode(ResultCode.SUCCESS.getCode());
|
||||
result.setMessage(ResultCode.SUCCESS.getMessage());
|
||||
result.setCode(200);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static <T> Result<T> success(T data) {
|
||||
Result<T> result = new Result<>();
|
||||
result.setCode(ResultCode.SUCCESS.getCode());
|
||||
result.setMessage(ResultCode.SUCCESS.getMessage());
|
||||
result.setCode(200);
|
||||
result.setData(data);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static <T> Result<T> error(String message) {
|
||||
public static <T> Result<T> error(String msg) {
|
||||
Result<T> result = new Result<>();
|
||||
result.setCode(ResultCode.INTERNAL_ERROR.getCode());
|
||||
result.setMessage(message);
|
||||
result.setCode(500);
|
||||
result.setMsg(msg);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static <T> Result<T> error(Integer code, String message) {
|
||||
public static <T> Result<T> error(Integer code, String msg) {
|
||||
Result<T> result = new Result<>();
|
||||
result.setCode(code);
|
||||
result.setMessage(message);
|
||||
result.setMsg(msg);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@ -3,10 +3,12 @@ package org.sqa.simply_rugby.config;
|
||||
import com.baomidou.mybatisplus.annotation.DbType;
|
||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@MapperScan("org.sqa.simply_rugby.mapper")
|
||||
public class MybatisPlusConfig {
|
||||
|
||||
/**
|
||||
|
||||
@ -8,6 +8,9 @@ import org.sqa.simply_rugby.service.AdService;
|
||||
import jakarta.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 广告管理控制器
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/ad")
|
||||
public class AdController {
|
||||
|
||||
@ -9,6 +9,9 @@ import org.sqa.simply_rugby.domain.entity.Match;
|
||||
import org.sqa.simply_rugby.service.TeamService;
|
||||
import org.sqa.simply_rugby.service.MatchService;
|
||||
|
||||
/**
|
||||
* 比赛管理控制器
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/matches")
|
||||
public class MatchController {
|
||||
@ -52,6 +55,9 @@ public class MatchController {
|
||||
.or()
|
||||
.eq(Match::getOpponentTeamId, teamId);
|
||||
}
|
||||
// 按比赛日期倒序排序
|
||||
wrapper.orderByDesc(Match::getDateOfMatch);
|
||||
|
||||
Page<Match> page = matchService.page(new Page<>(pageNum, pageSize), wrapper);
|
||||
// 为每个比赛添加队伍信息
|
||||
page.getRecords().forEach(match -> {
|
||||
|
||||
@ -8,6 +8,9 @@ import org.sqa.simply_rugby.common.Result;
|
||||
import org.sqa.simply_rugby.domain.entity.Team;
|
||||
import org.sqa.simply_rugby.service.TeamService;
|
||||
|
||||
/**
|
||||
* 队伍管理控制器
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/teams")
|
||||
public class TeamController {
|
||||
|
||||
@ -21,6 +21,8 @@ public class Match {
|
||||
|
||||
private String location;
|
||||
|
||||
private String venue;
|
||||
|
||||
private LocalDate dateOfMatch;
|
||||
|
||||
private LocalTime koTime;
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package org.sqa.simply_rugby.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
@ -8,12 +7,9 @@ import lombok.Data;
|
||||
@Data
|
||||
@TableName("team")
|
||||
public class Team {
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@TableId
|
||||
private String id;
|
||||
|
||||
private String coachId;
|
||||
|
||||
private String logo;
|
||||
|
||||
private String teamName;
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
package org.sqa.simply_rugby.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.sqa.simply_rugby.domain.entity.Team;
|
||||
|
||||
@ -10,4 +11,6 @@ public interface TeamService extends IService<Team> {
|
||||
* @return 球队信息
|
||||
*/
|
||||
Team getTeamById(String id);
|
||||
|
||||
Page<Team> page(Integer pageNum, Integer pageSize);
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
package org.sqa.simply_rugby.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.sqa.simply_rugby.domain.entity.Team;
|
||||
@ -13,4 +14,9 @@ public class TeamServiceImpl extends ServiceImpl<TeamMapper, Team> implements Te
|
||||
public Team getTeamById(String id) {
|
||||
return this.getById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<Team> page(Integer pageNum, Integer pageSize) {
|
||||
return page(new Page<>(pageNum, pageSize));
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user