diff --git a/src/main/java/org/springblade/modules/martial/service/impl/ScheduleStatusServiceImpl.java b/src/main/java/org/springblade/modules/martial/service/impl/ScheduleStatusServiceImpl.java new file mode 100644 index 0000000..19758d5 --- /dev/null +++ b/src/main/java/org/springblade/modules/martial/service/impl/ScheduleStatusServiceImpl.java @@ -0,0 +1,37 @@ +package org.springblade.modules.martial.service.impl; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.modules.martial.mapper.MartialScheduleParticipantMapper; +import org.springblade.modules.martial.pojo.entity.MartialScheduleParticipant; +import org.springblade.modules.martial.service.IScheduleStatusService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Slf4j +@Service +@RequiredArgsConstructor +public class ScheduleStatusServiceImpl implements IScheduleStatusService { + + private final MartialScheduleParticipantMapper scheduleParticipantMapper; + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean updateParticipantCheckInStatus(Long participantId, String status) { + if (participantId == null || status == null) { + return false; + } + + MartialScheduleParticipant participant = scheduleParticipantMapper.selectById(participantId); + if (participant == null) { + log.warn("参赛者不存在, participantId: {}", participantId); + return false; + } + + participant.setCheckInStatus(status); + int result = scheduleParticipantMapper.updateById(participant); + + log.info("更新参赛者签到状态: participantId={}, status={}, result={}", participantId, status, result); + return result > 0; + } +}