feat(mini): 裁判未指定项目时自动获取比赛所有项目

- login和refreshToken接口:如果invite.projects为空,自动获取该比赛的所有项目
- 新增getAllProjectsByCompetition方法查询比赛所有项目
- 支持裁判负责整个场地所有项目的需求

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-27 11:11:29 +08:00
parent 35a5369e81
commit 559e97b672

View File

@@ -110,7 +110,14 @@ public class MartialMiniController extends BladeController {
martialVenue = venueService.getById(invite.getVenueId());
}
List<MiniLoginVO.ProjectInfo> projects = parseProjects(invite.getProjects());
// 获取项目列表:如果邀请记录中有指定项目则使用,否则获取该比赛的所有项目
List<MiniLoginVO.ProjectInfo> projects;
if (Func.isNotEmpty(invite.getProjects())) {
projects = parseProjects(invite.getProjects());
} else {
// 未指定项目,获取该比赛的所有项目(裁判负责整个场地)
projects = getAllProjectsByCompetition(competition.getId());
}
MiniLoginVO vo = new MiniLoginVO();
vo.setToken(token);
@@ -499,7 +506,14 @@ public class MartialMiniController extends BladeController {
MartialCompetition competition = competitionService.getById(invite.getCompetitionId());
MartialJudge judge = judgeService.getById(invite.getJudgeId());
MartialVenue martialVenue = invite.getVenueId() != null ? venueService.getById(invite.getVenueId()) : null;
List<MiniLoginVO.ProjectInfo> projects = parseProjects(invite.getProjects());
// 获取项目列表:如果邀请记录中有指定项目则使用,否则获取该比赛的所有项目
List<MiniLoginVO.ProjectInfo> projects;
if (Func.isNotEmpty(invite.getProjects())) {
projects = parseProjects(invite.getProjects());
} else {
// 未指定项目,获取该比赛的所有项目(裁判负责整个场地)
projects = getAllProjectsByCompetition(competition.getId());
}
MiniLoginVO vo = new MiniLoginVO();
vo.setToken(token);
@@ -640,4 +654,29 @@ public class MartialMiniController extends BladeController {
return projects;
}
}
/**
* 获取比赛的所有项目
*/
private List<MiniLoginVO.ProjectInfo> getAllProjectsByCompetition(Long competitionId) {
List<MiniLoginVO.ProjectInfo> projects = new ArrayList<>();
LambdaQueryWrapper<MartialProject> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(MartialProject::getCompetitionId, competitionId);
wrapper.eq(MartialProject::getIsDeleted, 0);
List<MartialProject> projectList = projectService.list(wrapper);
if (Func.isNotEmpty(projectList)) {
projects = projectList.stream().map(project -> {
MiniLoginVO.ProjectInfo info = new MiniLoginVO.ProjectInfo();
info.setProjectId(project.getId());
info.setProjectName(project.getProjectName());
return info;
}).collect(Collectors.toList());
}
return projects;
}
}