From 980646ba01a770fb953f64f502f19fc2ceefd93c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=85=E6=88=BF?= Date: Thu, 25 Dec 2025 14:31:23 +0800 Subject: [PATCH] feat: add updateVenue API with score check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add PUT /martial/judgeInvite/updateVenue/{inviteId} endpoint - Prevent venue change if judge has existing score records - Return error message when judge has scores 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .../MartialJudgeInviteController.java | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/springblade/modules/martial/controller/MartialJudgeInviteController.java b/src/main/java/org/springblade/modules/martial/controller/MartialJudgeInviteController.java index 58cae52..33c7df6 100644 --- a/src/main/java/org/springblade/modules/martial/controller/MartialJudgeInviteController.java +++ b/src/main/java/org/springblade/modules/martial/controller/MartialJudgeInviteController.java @@ -14,6 +14,9 @@ import org.springblade.modules.martial.pojo.dto.GenerateInviteDTO; import org.springblade.modules.martial.pojo.entity.MartialJudgeInvite; import org.springblade.modules.martial.pojo.vo.MartialJudgeInviteVO; import org.springblade.modules.martial.service.IMartialJudgeInviteService; +import org.springblade.modules.martial.service.IMartialScoreService; +import org.springblade.modules.martial.pojo.entity.MartialScore; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import org.springframework.web.bind.annotation.*; import java.util.List; @@ -31,6 +34,7 @@ import java.util.Map; public class MartialJudgeInviteController extends BladeController { private final IMartialJudgeInviteService judgeInviteService; + private final IMartialScoreService scoreService; /** * 详情 @@ -224,4 +228,33 @@ public class MartialJudgeInviteController extends BladeController { // 使用EasyExcel或POI导出 } -} + + /** + * 更新裁判场地 + */ + @PutMapping("/updateVenue/{inviteId}") + @Operation(summary = "更新裁判场地", description = "更新裁判分配的场地") + public R updateVenue(@PathVariable Long inviteId, @RequestParam Long venueId) { + MartialJudgeInvite invite = judgeInviteService.getById(inviteId); + if (invite == null) { + return R.fail("邀请记录不存在"); + } + // Check if judge has any score records + if (invite.getJudgeId() != null) { + long scoreCount = scoreService.count( + new LambdaQueryWrapper() + .eq(MartialScore::getJudgeId, invite.getJudgeId()) + ); + if (scoreCount > 0) { + return R.fail("该裁判已有评分记录,无法修改场地"); + } + } + invite.setVenueId(venueId); + boolean success = judgeInviteService.updateById(invite); + if (success) { + return R.data(invite); + } + return R.fail("更新失败"); + } + +} \ No newline at end of file