瀏覽代碼

Merge branch 'dev' into dev_zlt

# Conflicts:
#	ruoyi-modules/ruoyi-game-event/src/main/java/org/dromara/system/controller/GameAthleteController.java
zhou 2 周之前
父節點
當前提交
ee15443208

+ 4 - 0
ruoyi-modules/ruoyi-game-event/pom.xml

@@ -103,6 +103,10 @@
             <groupId>org.dromara</groupId>
             <artifactId>ruoyi-common-core</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.dromara</groupId>
+            <artifactId>ruoyi-system</artifactId>
+        </dependency>
 
     </dependencies>
 

+ 0 - 1
ruoyi-modules/ruoyi-game-event/src/main/java/org/dromara/system/controller/GameAthleteController.java

@@ -166,5 +166,4 @@ public class GameAthleteController extends BaseController {
                           @PathVariable Long[] athleteIds) {
         return toAjax(gameAthleteService.deleteWithValidByIds(List.of(athleteIds), true));
     }
-
 }

+ 1 - 1
ruoyi-modules/ruoyi-game-event/src/main/java/org/dromara/system/domain/GameEventProject.java

@@ -52,7 +52,7 @@ public class GameEventProject extends TenantEntity {
     /**
      * 裁判员ID
      */
-    private Long refereeId;
+    private String refereeId;
 
     /**
      * 比赛场地

+ 7 - 1
ruoyi-modules/ruoyi-game-event/src/main/java/org/dromara/system/domain/bo/GameEventProjectBo.java

@@ -11,6 +11,7 @@ import lombok.EqualsAndHashCode;
 import jakarta.validation.constraints.*;
 
 import java.util.Date;
+import java.util.List;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
 
@@ -63,7 +64,12 @@ public class GameEventProjectBo extends BaseEntity {
      * 裁判员ID
      */
 //    @NotNull(message = "裁判员ID不能为空", groups = { AddGroup.class, EditGroup.class })
-    private Long refereeId;
+    private String refereeId;
+
+    /**
+     * 裁判id集合
+     */
+    private List<String> refereeIds;
 
     /**
      * 比赛场地

+ 6 - 3
ruoyi-modules/ruoyi-game-event/src/main/java/org/dromara/system/domain/vo/GameEventProjectVo.java

@@ -13,7 +13,7 @@ import lombok.Data;
 import java.io.Serial;
 import java.io.Serializable;
 import java.util.Date;
-
+import java.util.List;
 
 
 /**
@@ -67,8 +67,11 @@ public class GameEventProjectVo implements Serializable {
     /**
      * 裁判员ID
      */
-    @ExcelProperty(value = "裁判员ID")
-    private Long refereeId;
+    // @ExcelProperty(value = "裁判员ID")
+    private String refereeId;
+
+    // @ExcelProperty(value = "裁判员ID")
+    private List<String> refereeIds;
 
     /**
      * 比赛场地

+ 2 - 0
ruoyi-modules/ruoyi-game-event/src/main/java/org/dromara/system/service/IGameEventProjectService.java

@@ -7,6 +7,7 @@ import org.dromara.common.mybatis.core.page.PageQuery;
 
 import java.util.Collection;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 赛事项目Service接口
@@ -69,4 +70,5 @@ public interface IGameEventProjectService {
     List<GameEventProjectVo> listProjectsByEventIdAndProjectIndex(Long eventId, String[] projectIds);
 
     Long countEventProject();
+
 }

+ 27 - 11
ruoyi-modules/ruoyi-game-event/src/main/java/org/dromara/system/service/impl/GameEventProjectServiceImpl.java

@@ -1,6 +1,8 @@
 package org.dromara.system.service.impl;
 
 import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.json.JSONUtil;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import org.dromara.common.core.utils.MapstructUtils;
 import org.dromara.common.core.utils.StringUtils;
@@ -54,7 +56,9 @@ public class GameEventProjectServiceImpl implements IGameEventProjectService {
      */
     @Override
     public GameEventProjectVo queryById(Long projectId) {
-        return baseMapper.selectVoById(projectId);
+        GameEventProjectVo vo = baseMapper.selectVoById(projectId);
+        vo.setRefereeIds(JSONUtil.toList(vo.getRefereeId(), String.class));
+        return vo;
     }
 
     /**
@@ -76,17 +80,26 @@ public class GameEventProjectServiceImpl implements IGameEventProjectService {
         }
         LambdaQueryWrapper<GameEventProject> lqw = buildQueryWrapper(bo);
         Page<GameEventProjectVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
-        result.getRecords().stream()
-            .map(vo -> {
-                Optional.ofNullable(vo.getEventId())
-                    .filter(ObjectUtil::isNotEmpty)
-                    .ifPresent(projectValue -> {
-                        GameEvent gameEvent = gameEventMapper.selectById(vo.getEventId());
+
+        // 使用 forEach 直接修改原对象
+        result.getRecords().forEach(vo -> {
+            Optional.ofNullable(vo.getEventId())
+                .filter(ObjectUtil::isNotEmpty)
+                .ifPresent(eventId -> {
+                    GameEvent gameEvent = gameEventMapper.selectById(eventId);
+                    if (gameEvent != null) {
                         vo.setEventName(gameEvent.getEventName());
-                    });
-                return vo;
-            })
-            .collect(Collectors.toList());  // 收集结果
+                    }
+                });
+
+            Optional.ofNullable(vo.getRefereeId())
+                .filter(ObjectUtil::isNotEmpty)
+                .ifPresent(refereeIdStr -> {
+                    List<String> refereeList = JSONUtil.toList(refereeIdStr.toString(), String.class);
+                    vo.setRefereeIds(refereeList);
+                });
+        });
+
         return TableDataInfo.build(result);
     }
 
@@ -149,6 +162,9 @@ public class GameEventProjectServiceImpl implements IGameEventProjectService {
         }
         GameEventProject add = MapstructUtils.convert(bo, GameEventProject.class);
         validEntityBeforeSave(add);
+        if (StrUtil.isNotEmpty(bo.getRefereeId())) {
+            add.setRefereeId(JSONUtil.toJsonStr(bo.getRefereeIds()));
+        }
         boolean flag = baseMapper.insert(add) > 0;
         if (flag) {
             bo.setProjectId(add.getProjectId());