fix: 场地无项目时返回空列表而非所有项目

- 修改login和refreshLoginInfo方法中的项目获取逻辑
- 当场地没有关联项目时返回空列表
- 初始化projects变量为空ArrayList

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
This commit is contained in:
2026-01-07 11:31:27 +08:00
parent e3f158985a
commit ea50330a5d
10 changed files with 10 additions and 16 deletions

View File

@@ -115,7 +115,7 @@ public class MartialMiniController extends BladeController {
} }
// 获取项目列表:总裁判看所有项目,其他裁判根据场地获取项目 // 获取项目列表:总裁判看所有项目,其他裁判根据场地获取项目
List<MiniLoginVO.ProjectInfo> projects; List<MiniLoginVO.ProjectInfo> projects = new ArrayList<>();
Integer refereeTypeVal = invite.getRefereeType(); Integer refereeTypeVal = invite.getRefereeType();
String roleVal = invite.getRole(); String roleVal = invite.getRole();
boolean isGeneralJudge = (refereeTypeVal != null && refereeTypeVal == 3) boolean isGeneralJudge = (refereeTypeVal != null && refereeTypeVal == 3)
@@ -126,14 +126,11 @@ public class MartialMiniController extends BladeController {
projects = getAllProjectsByCompetition(competition.getId()); projects = getAllProjectsByCompetition(competition.getId());
} else if (Func.isNotEmpty(invite.getProjects())) { } else if (Func.isNotEmpty(invite.getProjects())) {
projects = parseProjects(invite.getProjects()); projects = parseProjects(invite.getProjects());
} else { } else if (invite.getVenueId() != null) {
// 未指定项目,根据场地获取项目;如果没有场地则获取所有项目 // 未指定项目,根据场地获取项目;如果场地没有项目则返回空列表
if (invite.getVenueId() != null) { projects = getProjectsByVenue(invite.getVenueId());
projects = getProjectsByVenue(invite.getVenueId());
} else {
projects = getAllProjectsByCompetition(competition.getId());
}
} }
// 如果没有场地projects保持为空列表
MiniLoginVO vo = new MiniLoginVO(); MiniLoginVO vo = new MiniLoginVO();
vo.setToken(token); vo.setToken(token);
@@ -530,7 +527,7 @@ public class MartialMiniController extends BladeController {
MartialJudge judge = judgeService.getById(invite.getJudgeId()); MartialJudge judge = judgeService.getById(invite.getJudgeId());
MartialVenue martialVenue = invite.getVenueId() != null ? venueService.getById(invite.getVenueId()) : null; MartialVenue martialVenue = invite.getVenueId() != null ? venueService.getById(invite.getVenueId()) : null;
// 获取项目列表:总裁判看所有项目,其他裁判根据场地获取项目 // 获取项目列表:总裁判看所有项目,其他裁判根据场地获取项目
List<MiniLoginVO.ProjectInfo> projects; List<MiniLoginVO.ProjectInfo> projects = new ArrayList<>();
Integer refereeTypeVal = invite.getRefereeType(); Integer refereeTypeVal = invite.getRefereeType();
String roleVal = invite.getRole(); String roleVal = invite.getRole();
boolean isGeneralJudge = (refereeTypeVal != null && refereeTypeVal == 3) boolean isGeneralJudge = (refereeTypeVal != null && refereeTypeVal == 3)
@@ -541,14 +538,11 @@ public class MartialMiniController extends BladeController {
projects = getAllProjectsByCompetition(competition.getId()); projects = getAllProjectsByCompetition(competition.getId());
} else if (Func.isNotEmpty(invite.getProjects())) { } else if (Func.isNotEmpty(invite.getProjects())) {
projects = parseProjects(invite.getProjects()); projects = parseProjects(invite.getProjects());
} else { } else if (invite.getVenueId() != null) {
// 未指定项目,根据场地获取项目;如果没有场地则获取所有项目 // 未指定项目,根据场地获取项目;如果场地没有项目则返回空列表
if (invite.getVenueId() != null) { projects = getProjectsByVenue(invite.getVenueId());
projects = getProjectsByVenue(invite.getVenueId());
} else {
projects = getAllProjectsByCompetition(competition.getId());
}
} }
// 如果没有场地projects保持为空列表
MiniLoginVO vo = new MiniLoginVO(); MiniLoginVO vo = new MiniLoginVO();
vo.setToken(token); vo.setToken(token);