diff --git a/src/main/java/org/springblade/modules/martial/controller/MartialAthleteController.java b/src/main/java/org/springblade/modules/martial/controller/MartialAthleteController.java index 2fc794d..29da70a 100644 --- a/src/main/java/org/springblade/modules/martial/controller/MartialAthleteController.java +++ b/src/main/java/org/springblade/modules/martial/controller/MartialAthleteController.java @@ -5,6 +5,7 @@ import com.qiniu.util.Auth; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; @@ -22,6 +23,7 @@ import org.springframework.web.bind.annotation.*; * @author BladeX */ @RestController +@Slf4j @AllArgsConstructor @RequestMapping("/martial/athlete") @Tag(name = "参赛选手管理", description = "参赛选手接口") @@ -55,8 +57,13 @@ public class MartialAthleteController extends BladeController { @PostMapping("/submit") @Operation(summary = "新增或修改", description = "传入实体") public R submit(@RequestBody MartialAthlete athlete) { - athlete.setCreateUser(AuthUtil.getUserId()); - athlete.setUpdateUser(AuthUtil.getUserId()); + Long userId = AuthUtil.getUserId(); + log.info("=== 提交选手 === userId: {}, playerName: {}", userId, athlete.getPlayerName()); + // Only set createUser for new records (when id is null) + if (athlete.getId() == null) { + athlete.setCreateUser(userId); + } + athlete.setUpdateUser(userId); return R.status(athleteService.saveOrUpdate(athlete)); }