Преглед на файлове

feat(business): 新增赛事管理功能

- 添加赛事管理相关的数据传输对象(DTO)和控制器方法
- 实现赛事管理的业务逻辑,包括赛事信息的增删改查
- 新增与赛事相关的数据库表和 mapper 文件
- 优化赛事信息的展示和处理,支持上传赛事图标
fugui001 преди 7 месеца
родител
ревизия
140d99be66
променени са 15 файла, в които са добавени 336 реда и са изтрити 55 реда
  1. 9 4
      ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/controller/TournamentsController.java
  2. 1 1
      ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/domain/Tournaments.java
  3. 27 0
      ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/domain/dto/ItemsPrizeDto.java
  4. 43 0
      ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/domain/dto/TournamentsDto.java
  5. 18 1
      ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/domain/vo/TournamentsVo.java
  6. 4 1
      ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/mapper/PrizeDistributionItemsMapper.java
  7. 1 1
      ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/mapper/PrizeDistributionsMapper.java
  8. 3 2
      ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/mapper/TournamentBlindStructuresMapper.java
  9. 5 2
      ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/mapper/TournamentEntryConditionsMapper.java
  10. 3 2
      ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/service/ITournamentsService.java
  11. 197 34
      ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/service/impl/TournamentsServiceImpl.java
  12. 9 0
      ruoyi-modules/ruoyi-system/src/main/resources/mapper/business/PrizeDistributionItemsMapper.xml
  13. 7 0
      ruoyi-modules/ruoyi-system/src/main/resources/mapper/business/TournamentBlindStructuresMapper.xml
  14. 7 5
      ruoyi-modules/ruoyi-system/src/main/resources/mapper/business/TournamentEntryConditionsMapper.xml
  15. 2 2
      ruoyi-modules/ruoyi-system/src/main/resources/mapper/business/TournamentsMapper.xml

+ 9 - 4
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/controller/TournamentsController.java

@@ -2,11 +2,14 @@ package org.dromara.business.controller;
 
 import java.util.List;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
 import lombok.RequiredArgsConstructor;
 import jakarta.servlet.http.HttpServletResponse;
 import jakarta.validation.constraints.*;
 import cn.dev33.satoken.annotation.SaCheckPermission;
 import org.dromara.business.domain.bo.TournamentBlindStructuresBo;
+import org.dromara.business.domain.dto.ItemsPrizeDto;
+import org.dromara.business.domain.dto.TournamentsDto;
 import org.dromara.business.domain.vo.TournamentBlindStructuresListVo;
 import org.dromara.common.satoken.utils.LoginHelper;
 import org.dromara.system.domain.vo.SysOssVo;
@@ -74,6 +77,8 @@ public class TournamentsController extends BaseController {
         return R.ok(tournamentsService.queryById(id));
     }
 
+
+
     /**
      * 新增【赛事管理】
      */
@@ -81,8 +86,8 @@ public class TournamentsController extends BaseController {
     @Log(title = "【赛事管理-新增】", businessType = BusinessType.INSERT)
     @RepeatSubmit()
     @PostMapping()
-    public R<Void> add(@Validated(AddGroup.class) @RequestBody TournamentsBo bo) {
-        return toAjax(tournamentsService.insertByBo(bo));
+    public R<Void> add(  @Validated(AddGroup.class) @ModelAttribute TournamentsDto dto,  @RequestParam("competitionIcon") MultipartFile competitionIcon) {
+        return toAjax(tournamentsService.insertByBo(dto,competitionIcon));
     }
 
     /**
@@ -92,8 +97,8 @@ public class TournamentsController extends BaseController {
     @Log(title = "【赛事管理-修改】", businessType = BusinessType.UPDATE)
     @RepeatSubmit()
     @PutMapping()
-    public R<Void> edit(@Validated(EditGroup.class) @RequestBody TournamentsBo bo) {
-        return toAjax(tournamentsService.updateByBo(bo));
+    public R<Void> edit(@Validated(EditGroup.class) @ModelAttribute TournamentsDto bo,  @RequestParam("competitionIcon") MultipartFile competitionIcon) {
+        return toAjax(tournamentsService.updateByBo(bo,competitionIcon));
     }
 
     /**

+ 1 - 1
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/domain/Tournaments.java

@@ -87,5 +87,5 @@ public class Tournaments extends BaseEntity {
     /**
      * 比赛图标
      */
-    private Long competitionIcon;
+    private String competitionIcon;
 }

+ 27 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/domain/dto/ItemsPrizeDto.java

@@ -0,0 +1,27 @@
+package org.dromara.business.domain.dto;
+
+import lombok.Data;
+
+@Data
+public class ItemsPrizeDto {
+
+
+    /**
+     * 排名
+     */
+    private Long ranking;
+
+
+    /**
+     * 道具
+     */
+    private Long itemId;
+
+
+    /**
+     * 数量
+     */
+    private Long quantity;
+
+
+}

+ 43 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/domain/dto/TournamentsDto.java

@@ -0,0 +1,43 @@
+package org.dromara.business.domain.dto;
+
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotNull;
+import lombok.Data;
+
+@Data
+public class TournamentsDto {
+
+
+    private Long id;
+
+    @NotBlank(message = "赛事名称不能为空")
+    private String name;
+
+    @NotNull(message = "比赛开始时间不能为空")
+    private String startTime;
+
+    private Long gameType;
+    private Long startingChips;
+    private Long levelDuration;
+
+    @NotNull(message = "报名截止等级不能为空")
+    private Long lateRegistrationLevel;
+
+    private Long maxPlayers;
+    private Long status;
+
+    @NotNull(message = "报名时间不能为空")
+    private Long signTime;
+
+    private Long itemsId;
+
+    @NotNull(message = "报名条件数量不能为空")
+    private Long itemsNum;
+
+    @NotNull(message = "盲注表不能为空")
+    private Long blindStructureId;
+
+    private String itemsPrizeList;
+
+
+}

+ 18 - 1
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/domain/vo/TournamentsVo.java

@@ -2,9 +2,13 @@ package org.dromara.business.domain.vo;
 
 import java.util.Date;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import jakarta.validation.constraints.NotNull;
 import org.dromara.business.domain.Tournaments;
 import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
 import cn.idev.excel.annotation.ExcelProperty;
+import org.dromara.business.domain.dto.ItemsPrizeDto;
+import org.dromara.common.core.validate.AddGroup;
+import org.dromara.common.core.validate.EditGroup;
 import org.dromara.common.excel.annotation.ExcelDictFormat;
 import org.dromara.common.excel.convert.ExcelDictConvert;
 import io.github.linpeilie.annotations.AutoMapper;
@@ -13,7 +17,7 @@ import lombok.Data;
 import java.io.Serial;
 import java.io.Serializable;
 import java.util.Date;
-
+import java.util.List;
 
 
 /**
@@ -98,4 +102,17 @@ public class TournamentsVo implements Serializable {
     private Date updatedAt;
 
 
+    private Long signTime;
+
+    private String competitionIcon;
+
+    private Long itemsId;
+
+    @NotNull(message = "报名条件数量不能为空")
+    private Long itemsNum;
+
+    @NotNull(message = "盲注表不能为空")
+    private Long blindStructureId;
+
+    private List<ItemsPrizeDto> itemsPrizeList;
 }

+ 4 - 1
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/mapper/PrizeDistributionItemsMapper.java

@@ -30,6 +30,9 @@ public interface PrizeDistributionItemsMapper extends BaseMapperPlus<PrizeDistri
     PrizeDistributionItemsVo selectById(Integer id);
 
     @InterceptorIgnore(tenantLine = "true")
-    List<PrizeDistributionItemsVo> selectByPrizeDistributionId(Integer prizeDistributionId);
+    PrizeDistributionItemsVo selectByPrizeDistributionId(Long prizeDistributionId);
+
+    @InterceptorIgnore(tenantLine = "true")
+    List<PrizeDistributionItemsVo> selectByPrizeDistributionIdList(List<Long> prizeDistributionId);
 
 }

+ 1 - 1
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/mapper/PrizeDistributionsMapper.java

@@ -30,7 +30,7 @@ public interface PrizeDistributionsMapper extends BaseMapperPlus<PrizeDistributi
     PrizeDistributionsVo selectById(Integer id);
 
     @InterceptorIgnore(tenantLine = "true")
-    List<PrizeDistributionsVo> selectByTournamentId(Integer tournamentId);
+    List<PrizeDistributionsVo> selectByTournamentId(Long tournamentId);
 
 
 

+ 3 - 2
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/mapper/TournamentBlindStructuresMapper.java

@@ -19,8 +19,9 @@ public interface TournamentBlindStructuresMapper extends BaseMapperPlus<Tourname
     int insertTournamentBlindStructure(TournamentBlindStructure tournamentBlindStructure);
 
     @InterceptorIgnore(tenantLine = "true")
-    int deleteTournamentBlindStructureByTournamentId(int tournamentId);
-
+    int deleteTournamentBlindStructureByTournamentId(Long tournamentId);
 
+    @InterceptorIgnore(tenantLine = "true")
+    TournamentBlindStructuresVo selectTournamentBlindStructureByTournamentId(Long tournamentId);
 
 }

+ 5 - 2
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/mapper/TournamentEntryConditionsMapper.java

@@ -22,7 +22,7 @@ public interface TournamentEntryConditionsMapper extends BaseMapperPlus<Tourname
     int insert(TournamentEntryConditions condition);
 
     @InterceptorIgnore(tenantLine = "true")
-    int updateById(TournamentEntryConditions condition);
+    int updateByTournamentId(TournamentEntryConditions condition);
 
     @InterceptorIgnore(tenantLine = "true")
     int deleteById(Long id);
@@ -31,6 +31,9 @@ public interface TournamentEntryConditionsMapper extends BaseMapperPlus<Tourname
     TournamentEntryConditionsVo selectById(Long id);
 
     @InterceptorIgnore(tenantLine = "true")
-    List<TournamentEntryConditionsVo> selectByTournamentId(Integer tournamentId);
+    List<TournamentEntryConditionsVo> selectByTournamentId(Long tournamentId);
+
+    @InterceptorIgnore(tenantLine = "true")
+    TournamentEntryConditionsVo selectByTournamentInfo(Long tournamentId);
 
 }

+ 3 - 2
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/service/ITournamentsService.java

@@ -1,6 +1,7 @@
 package org.dromara.business.service;
 
 import org.dromara.business.domain.bo.TournamentBlindStructuresBo;
+import org.dromara.business.domain.dto.TournamentsDto;
 import org.dromara.business.domain.vo.TournamentBlindStructuresListVo;
 import org.dromara.business.domain.vo.TournamentsVo;
 import org.dromara.business.domain.bo.TournamentsBo;
@@ -51,7 +52,7 @@ public interface ITournamentsService {
      * @param bo 【请填写功能名称】
      * @return 是否新增成功
      */
-    Boolean insertByBo(TournamentsBo bo);
+    Boolean insertByBo(TournamentsDto bo,MultipartFile competitionIcon);
 
     /**
      * 修改【请填写功能名称】
@@ -59,7 +60,7 @@ public interface ITournamentsService {
      * @param bo 【请填写功能名称】
      * @return 是否修改成功
      */
-    Boolean updateByBo(TournamentsBo bo);
+    Boolean updateByBo(TournamentsDto bo, MultipartFile competitionIcon);
 
     /**
      * 校验并批量删除【请填写功能名称】信息

+ 197 - 34
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/service/impl/TournamentsServiceImpl.java

@@ -2,10 +2,13 @@ package org.dromara.business.service.impl;
 
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
 import org.dromara.business.domain.*;
 import org.dromara.business.domain.bo.ItemsPrizeBo;
 import org.dromara.business.domain.bo.TournamentBlindStructuresBo;
-import org.dromara.business.domain.vo.TournamentBlindStructuresListVo;
+import org.dromara.business.domain.dto.ItemsPrizeDto;
+import org.dromara.business.domain.dto.TournamentsDto;
+import org.dromara.business.domain.vo.*;
 import org.dromara.business.mapper.*;
 import org.dromara.business.service.IItemsService;
 import org.dromara.common.core.utils.MapstructUtils;
@@ -19,13 +22,19 @@ import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.dromara.system.domain.vo.SysOssVo;
 import org.dromara.system.service.ISysOssService;
+import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import org.dromara.business.domain.bo.TournamentsBo;
-import org.dromara.business.domain.vo.TournamentsVo;
 import org.dromara.business.service.ITournamentsService;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.time.LocalDateTime;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
 import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * 【请填写功能名称】Service业务层处理
@@ -64,7 +73,47 @@ public class TournamentsServiceImpl implements ITournamentsService {
      */
     @Override
     public TournamentsVo queryById(Long id){
-        return baseMapper.selectVoByIdInfo(id);
+        TournamentsVo tournamentsVo = baseMapper.selectVoByIdInfo(id);
+        Long tournamentId = tournamentsVo.getId();
+        //赛事报名条件
+        TournamentEntryConditionsVo tournamentEntryConditionsVo = tournamentEntryConditionsMapper.selectByTournamentInfo(tournamentId);
+        if(tournamentEntryConditionsVo!=null){
+            tournamentsVo.setItemsId(tournamentEntryConditionsVo.getItemId());
+            tournamentsVo.setItemsNum(tournamentEntryConditionsVo.getRequiredQuantity());
+        }
+
+        //绑定的盲注信息
+        TournamentBlindStructuresVo tournamentBlindStructuresVo = tournamentBlindStructuresMapper.selectTournamentBlindStructureByTournamentId(tournamentId);
+        if(tournamentBlindStructuresVo!=null){
+            tournamentsVo.setBlindStructureId(tournamentBlindStructuresVo.getBlindStructureId());
+        }
+
+        //排名
+        List<PrizeDistributionsVo> prizeDistributionsVos = prizeDistributionsMapper.selectByTournamentId(tournamentId);
+        if(prizeDistributionsVos!=null){
+            List<ItemsPrizeDto> itemsPrizeList=new ArrayList<>();
+
+            // 提取并按排名正序排序后,取出 id 列表
+            List<Long> ids = prizeDistributionsVos.stream()
+                .sorted(Comparator.comparing(PrizeDistributionsVo::getPaiming))
+                .map(PrizeDistributionsVo::getId)
+                .collect(Collectors.toList());
+            int i=0;
+            for (Long id2 : ids) {
+                i++;
+                //奖品
+                PrizeDistributionItemsVo prizeDistributionItemsVos = prizeDistributionItemsMapper.selectByPrizeDistributionId(id2);
+                ItemsPrizeDto itemsPrizeBo = new ItemsPrizeDto();
+                itemsPrizeBo.setRanking(Long.valueOf(i));
+                itemsPrizeBo.setItemId(prizeDistributionItemsVos.getItemId());
+                itemsPrizeBo.setQuantity(prizeDistributionItemsVos.getQuantity());
+                itemsPrizeList.add(itemsPrizeBo);
+
+            }
+            tournamentsVo.setItemsPrizeList(itemsPrizeList);
+        }
+
+        return tournamentsVo;
     }
 
     /**
@@ -117,35 +166,63 @@ public class TournamentsServiceImpl implements ITournamentsService {
      * @return 是否新增成功
      */
     @Override
-    public Boolean insertByBo(TournamentsBo bo) {
-        // 转换 BO -> Entity
-        Tournaments add = MapstructUtils.convert(bo, Tournaments.class);
-        validEntityBeforeSave(add);
-        List<ItemsPrizeBo> itemsPrizeList = bo.getItemsPrizeList();
-        if (CollectionUtils.isEmpty(itemsPrizeList)) {
-            return false;
-        }
+    public Boolean insertByBo(TournamentsDto bo, MultipartFile competitionIcon) {
+        try {
+            // 初始化 ObjectMapper
+            ObjectMapper mapper = new ObjectMapper();
 
-        // 插入赛事主表
-        boolean flag = baseMapper.insertTournament(add) > 0;
-        if (!flag) {
-            throw new RuntimeException("赛事插入失败");
-        }
+            // 转换 BO -> Entity
+            Tournaments add = new Tournaments();
+            BeanUtils.copyProperties(bo, add);
 
-        Long tournamentId = add.getId();
+            validEntityBeforeSave(add);
 
-        // 绑定盲注结构
-        bindBlindStructure(tournamentId, bo.getBlindStructureId());
+            // 解析 itemsPrizeList JSON 字符串
+            List<ItemsPrizeDto> prizeList = parsePrizeList(bo.getItemsPrizeList(), mapper);
 
-        // 添加报名条件
-        addEntryCondition(tournamentId, bo.getItemsId(), bo.getItemsNum());
+            if (CollectionUtils.isEmpty(prizeList)) {
+                log.error("奖励列表为空");
+                return false;
+            }
 
-        // 处理奖励分布
-        processPrizeDistributions(tournamentId, itemsPrizeList);
+            // 处理开始时间
+            add.setStartTime(parseDateTime(bo.getStartTime()));
 
-        return true;
+            // 上传赛事图标
+            if (competitionIcon != null && !competitionIcon.isEmpty()) {
+                SysOssVo sysOssVo = this.uploadTournament(competitionIcon);
+                if (sysOssVo != null) {
+                    add.setCompetitionIcon(sysOssVo.getUrl());
+                }
+            }
+
+            // 插入赛事主表
+            boolean flag = baseMapper.insertTournament(add) > 0;
+            if (!flag) {
+                throw new RuntimeException("赛事插入失败");
+            }
+
+            Long tournamentId = add.getId();
+
+            // 绑定盲注结构
+            bindBlindStructure(tournamentId, bo.getBlindStructureId());
+
+            // 添加报名条件
+            addEntryCondition(tournamentId, bo.getItemsId(), bo.getItemsNum());
+
+            // 处理奖励分布
+            processPrizeDistributions(tournamentId, prizeList);
+
+            return true;
+
+        } catch (Exception e) {
+            log.error("赛事插入过程中发生异常", e);
+            return false;
+        }
     }
 
+
+
     private void bindBlindStructure(Long tournamentId, Long blindStructureId) {
         TournamentBlindStructure structure = new TournamentBlindStructure();
         structure.setTournamentId(tournamentId);
@@ -161,20 +238,20 @@ public class TournamentsServiceImpl implements ITournamentsService {
         tournamentEntryConditionsMapper.insert(condition);
     }
 
-    private void processPrizeDistributions(Long tournamentId, List<ItemsPrizeBo> itemsPrizeList) {
+    private void processPrizeDistributions(Long tournamentId, List<ItemsPrizeDto> itemsPrizeList) {
         // 排序(按排名正序)
-        Collections.sort(itemsPrizeList, Comparator.comparing(ItemsPrizeBo::getRanking));
+        Collections.sort(itemsPrizeList, Comparator.comparing(ItemsPrizeDto::getRanking));
 
-        for (ItemsPrizeBo prizeBo : itemsPrizeList) {
+        for (ItemsPrizeDto prizeBo : itemsPrizeList) {
             PrizeDistributions prizeDistribution = new PrizeDistributions();
             prizeDistribution.setTournamentId(tournamentId);
-            prizeDistribution.setPaiming(prizeBo.getRanking());
+            prizeDistribution.setPaiming(Long.valueOf(prizeBo.getRanking()));
             prizeDistributionsMapper.insert(prizeDistribution);
 
             PrizeDistributionItems distributionItems = new PrizeDistributionItems();
             distributionItems.setPrizeDistributionId(prizeDistribution.getId());
-            distributionItems.setItemId(prizeBo.getItemId());
-            distributionItems.setQuantity(prizeBo.getQuantity());
+            distributionItems.setItemId(Long.valueOf(prizeBo.getItemId()));
+            distributionItems.setQuantity(Long.valueOf(prizeBo.getQuantity()));
             prizeDistributionItemsMapper.insert(distributionItems);
         }
     }
@@ -186,10 +263,68 @@ public class TournamentsServiceImpl implements ITournamentsService {
      * @return 是否修改成功
      */
     @Override
-    public Boolean updateByBo(TournamentsBo bo) {
-        Tournaments update = MapstructUtils.convert(bo, Tournaments.class);
-        validEntityBeforeSave(update);
-        return baseMapper.updateTournamentsById(update) > 0;
+    public Boolean updateByBo(TournamentsDto bo, MultipartFile competitionIcon) {
+        try {
+            // 初始化 ObjectMapper
+            ObjectMapper mapper = new ObjectMapper();
+
+            // 转换 BO -> Entity
+            Tournaments update = new Tournaments();
+            BeanUtils.copyProperties(bo, update);
+
+            validEntityBeforeSave(update);
+            // 解析 itemsPrizeList JSON 字符串
+            List<ItemsPrizeDto> prizeList = parsePrizeList(bo.getItemsPrizeList(), mapper);
+
+            if (CollectionUtils.isEmpty(prizeList)) {
+                log.error("奖励列表为空");
+                return false;
+            }
+
+            // 处理开始时间
+            update.setStartTime(parseDateTime(bo.getStartTime()));
+
+            // 上传赛事图标
+            if (competitionIcon != null && !competitionIcon.isEmpty()) {
+                SysOssVo sysOssVo = this.uploadTournament(competitionIcon);
+                if (sysOssVo != null) {
+                    update.setCompetitionIcon(sysOssVo.getUrl());
+                }
+            }
+
+            // 插入赛事主表
+            boolean flag = baseMapper.updateTournamentsById(update) > 0;
+            if (!flag) {
+                throw new RuntimeException("赛事修改失败");
+            }
+            Long tournamentId= update.getId();
+            //删除 旧盲注绑定信息
+            tournamentBlindStructuresMapper.deleteTournamentBlindStructureByTournamentId(tournamentId);
+
+            // 绑定盲注结构
+            bindBlindStructure(tournamentId, bo.getBlindStructureId());
+
+            // 修改报名条件
+            TournamentEntryConditions tournamentEntryConditions=new TournamentEntryConditions();
+            tournamentEntryConditions.setItemId(bo.getItemsId());
+            tournamentEntryConditions.setRequiredQuantity(bo.getItemsNum());
+            tournamentEntryConditionsMapper.updateByTournamentId(tournamentEntryConditions);
+
+            //删除奖励排名 同时删除奖励对应信息
+            List<PrizeDistributionsVo> prizeDistributionsVos = prizeDistributionsMapper.selectByTournamentId(tournamentId);
+            if(prizeDistributionsVos.size()>0){
+                for (PrizeDistributionsVo prizeDistributionsVo : prizeDistributionsVos) {
+                    prizeDistributionsMapper.deleteById(prizeDistributionsVo.getId());
+                }
+            }
+            //重新处理奖励分布
+            processPrizeDistributions(tournamentId, prizeList);
+             return true;
+        }catch (Exception e){
+            log.error("赛事修改过程中发生异常", e);
+            e.printStackTrace();
+            return false;
+        }
     }
 
     /**
@@ -238,4 +373,32 @@ public class TournamentsServiceImpl implements ITournamentsService {
         return sysOssVo;
     }
 
+
+    private List<ItemsPrizeDto> parsePrizeList(String itemsPrizeListJson, ObjectMapper mapper) throws Exception {
+        if (itemsPrizeListJson == null || itemsPrizeListJson.isBlank()) {
+            throw new IllegalArgumentException("itemsPrizeList 不能为空");
+        }
+
+        String cleanedJson = itemsPrizeListJson.trim();
+        if (cleanedJson.startsWith(",")) {
+            cleanedJson = cleanedJson.substring(1);
+        }
+
+        return mapper.readValue(
+            cleanedJson,
+            mapper.getTypeFactory().constructCollectionType(List.class, ItemsPrizeDto.class)
+        );
+    }
+
+    private Date parseDateTime(String dateTimeStr) throws ParseException {
+        if (dateTimeStr == null || dateTimeStr.isBlank()) {
+            throw new IllegalArgumentException("startTime 不能为空");
+        }
+
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+        LocalDateTime localDateTime = LocalDateTime.parse(dateTimeStr, formatter);
+        return Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
+    }
+
+
 }

+ 9 - 0
ruoyi-modules/ruoyi-system/src/main/resources/mapper/business/PrizeDistributionItemsMapper.xml

@@ -59,4 +59,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         WHERE prize_distribution_id = #{prizeDistributionId}
     </select>
 
+    <select id="selectByPrizeDistributionIdList" resultType="org.dromara.business.domain.vo.PrizeDistributionItemsVo">
+        SELECT *
+        FROM prize_distribution_items
+        WHERE prize_distribution_id IN
+        <foreach collection="prizeDistributionId" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </select>
+
 </mapper>

+ 7 - 0
ruoyi-modules/ruoyi-system/src/main/resources/mapper/business/TournamentBlindStructuresMapper.xml

@@ -16,4 +16,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
 
+
+    <select id="selectTournamentBlindStructureByTournamentId" resultType="org.dromara.business.domain.vo.TournamentBlindStructuresVo">
+        SELECT *
+        FROM tournament_blind_structures
+        WHERE tournament_id = #{tournamentId}
+    </select>
+
 </mapper>

+ 7 - 5
ruoyi-modules/ruoyi-system/src/main/resources/mapper/business/TournamentEntryConditionsMapper.xml

@@ -22,12 +22,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </insert>
 
     <!-- 动态更新记录 -->
-    <update id="updateById">
+    <update id="updateByTournamentId">
         UPDATE tournament_entry_conditions
         <set>
-            <if test="tournamentId != null and tournamentId.toString() != ''">
-                tournament_id = #{tournamentId},
-            </if>
             <if test="itemId != null and itemId.toString() != ''">
                 item_id = #{itemId},
             </if>
@@ -36,7 +33,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             </if>
             updated_at = CURRENT_TIMESTAMP
         </set>
-        WHERE id = #{id}
+        WHERE tournament_id = #{tournamentId}
     </update>
 
     <!-- 删除记录,只在id有效时删除 -->
@@ -60,5 +57,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         WHERE tournament_id = #{tournamentId}
     </select>
 
+    <select id="selectByTournamentInfo" resultType="org.dromara.business.domain.vo.TournamentEntryConditionsVo">
+        SELECT *
+        FROM tournament_entry_conditions
+        WHERE tournament_id = #{tournamentId}
+    </select>
 
 </mapper>

+ 2 - 2
ruoyi-modules/ruoyi-system/src/main/resources/mapper/business/TournamentsMapper.xml

@@ -10,11 +10,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
 
     <select id="selectTournamentsVoList" resultType="org.dromara.business.domain.vo.TournamentsVo">
-        SELECT id, name, start_time, game_type, starting_chips, level_duration, late_registration_level, max_players, status, created_at, updated_at FROM tournaments  ${ew.customSqlSegment}
+        SELECT id, name, start_time, game_type, starting_chips, level_duration, late_registration_level, max_players, status, created_at, updated_at,sign_time,competition_icon FROM tournaments  ${ew.customSqlSegment}
     </select>
 
     <select id="selectVoByIdInfo" resultType="org.dromara.business.domain.vo.TournamentsVo">
-       SELECT id, name, start_time, game_type, starting_chips, level_duration, late_registration_level, max_players, status, created_at, updated_at FROM tournaments WHERE id =  #{id}
+       SELECT id, name, start_time, game_type, starting_chips, level_duration, late_registration_level, max_players, status, created_at, updated_at,sign_time,competition_icon FROM tournaments WHERE id =  #{id}
     </select>