fix(mini): 根据场地获取项目列表,解决同一项目显示在多个场地的问题

- 在MartialProject实体添加venueId字段
- 数据库martial_project表添加venue_id列
- 修改MartialMiniController:当裁判未指定项目时,根据venue_id获取该场地的项目
- 新增getProjectsByVenue方法

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
This commit is contained in:
2026-01-05 15:51:38 +08:00
parent 29e9fb4e0a
commit 55ccf08246
11 changed files with 46 additions and 6 deletions

View File

@@ -114,13 +114,18 @@ public class MartialMiniController extends BladeController {
martialVenue = venueService.getById(invite.getVenueId());
}
// 获取项目列表:如果邀请记录中有指定项目则使用,否则获取该比赛的所有项目
// 获取项目列表:如果邀请记录中有指定项目则使用,否则根据场地获取项目
List<MiniLoginVO.ProjectInfo> projects;
if (Func.isNotEmpty(invite.getProjects())) {
projects = parseProjects(invite.getProjects());
} else {
// 未指定项目,获取该比赛的所有项目(裁判负责整个场地)
projects = getAllProjectsByCompetition(competition.getId());
// 未指定项目,根据场地获取项目;如果没有场地则获取所有项目
if (invite.getVenueId() != null) {
projects = getProjectsByVenue(invite.getVenueId());
} else {
// 总裁或未分配场地的裁判,获取所有项目
projects = getAllProjectsByCompetition(competition.getId());
}
}
MiniLoginVO vo = new MiniLoginVO();
@@ -517,13 +522,18 @@ 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;
if (Func.isNotEmpty(invite.getProjects())) {
projects = parseProjects(invite.getProjects());
} else {
// 未指定项目,获取该比赛的所有项目(裁判负责整个场地)
projects = getAllProjectsByCompetition(competition.getId());
// 未指定项目,根据场地获取项目;如果没有场地则获取所有项目
if (invite.getVenueId() != null) {
projects = getProjectsByVenue(invite.getVenueId());
} else {
// 总裁或未分配场地的裁判,获取所有项目
projects = getAllProjectsByCompetition(competition.getId());
}
}
MiniLoginVO vo = new MiniLoginVO();
@@ -698,6 +708,30 @@ public class MartialMiniController extends BladeController {
return projects;
}
/**
* 根据场地获取项目列表
*/
private List<MiniLoginVO.ProjectInfo> getProjectsByVenue(Long venueId) {
List<MiniLoginVO.ProjectInfo> projects = new ArrayList<>();
LambdaQueryWrapper<MartialProject> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(MartialProject::getVenueId, venueId);
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;
}
// ========== 三级裁判评分流程 API ==========

View File

@@ -45,6 +45,12 @@ public class MartialProject extends TenantEntity {
@Schema(description = "赛事ID")
private Long competitionId;
/**
* 所属场地ID
*/
@Schema(description = "所属场地ID")
private Long venueId;
/**
* 项目名称
*/