feat: add updateVenue API with score check
- 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 <noreply@anthropic.com>
This commit is contained in:
@@ -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.entity.MartialJudgeInvite;
|
||||||
import org.springblade.modules.martial.pojo.vo.MartialJudgeInviteVO;
|
import org.springblade.modules.martial.pojo.vo.MartialJudgeInviteVO;
|
||||||
import org.springblade.modules.martial.service.IMartialJudgeInviteService;
|
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 org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -31,6 +34,7 @@ import java.util.Map;
|
|||||||
public class MartialJudgeInviteController extends BladeController {
|
public class MartialJudgeInviteController extends BladeController {
|
||||||
|
|
||||||
private final IMartialJudgeInviteService judgeInviteService;
|
private final IMartialJudgeInviteService judgeInviteService;
|
||||||
|
private final IMartialScoreService scoreService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 详情
|
* 详情
|
||||||
@@ -224,4 +228,33 @@ public class MartialJudgeInviteController extends BladeController {
|
|||||||
// 使用EasyExcel或POI导出
|
// 使用EasyExcel或POI导出
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新裁判场地
|
||||||
|
*/
|
||||||
|
@PutMapping("/updateVenue/{inviteId}")
|
||||||
|
@Operation(summary = "更新裁判场地", description = "更新裁判分配的场地")
|
||||||
|
public R<MartialJudgeInvite> 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<MartialScore>()
|
||||||
|
.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("更新失败");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user