Explorar o código

赛事分组项目回显

wenkai hai 3 semanas
pai
achega
e26d0d024c

+ 5 - 0
pom.xml

@@ -415,6 +415,11 @@
                     <compilerArgs>
                         <arg>-parameters</arg>
                     </compilerArgs>
+                    <excludes>
+                        <exclude>ruoyi-game-event/**</exclude>
+                        <exclude>ruoyi-common-tenant/**</exclude>
+                        <exclude>ruoyi-common-mybatis/**</exclude>
+                    </excludes>
                 </configuration>
             </plugin>
             <!-- 单元测试使用 -->

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

@@ -65,4 +65,6 @@ public interface IGameEventProjectService {
      * @return 是否删除成功
      */
     Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
+
+    List<GameEventProjectVo> listProjectsByEventIdAndProjectIndex(Long eventId, String[] projectIds);
 }

+ 24 - 3
ruoyi-modules/ruoyi-game-event/src/main/java/org/dromara/system/service/impl/GameEventGroupServiceImpl.java

@@ -9,6 +9,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import org.dromara.system.domain.vo.GameEventProjectVo;
+import org.dromara.system.service.IGameEventProjectService;
 import org.springframework.stereotype.Service;
 import org.dromara.system.domain.bo.GameEventGroupBo;
 import org.dromara.system.domain.vo.GameEventGroupVo;
@@ -19,6 +21,7 @@ import org.dromara.system.service.IGameEventGroupService;
 import java.util.List;
 import java.util.Map;
 import java.util.Collection;
+import java.util.stream.Collectors;
 
 /**
  * 赛事分组Service业务层处理
@@ -33,6 +36,8 @@ public class GameEventGroupServiceImpl implements IGameEventGroupService {
 
     private final GameEventGroupMapper baseMapper;
 
+    private final IGameEventProjectService gameEventProjectService;
+
     /**
      * 查询赛事分组
      *
@@ -40,7 +45,7 @@ public class GameEventGroupServiceImpl implements IGameEventGroupService {
      * @return 赛事分组
      */
     @Override
-    public GameEventGroupVo queryById(Long groupId){
+    public GameEventGroupVo queryById(Long groupId) {
         return baseMapper.selectVoById(groupId);
     }
 
@@ -55,6 +60,22 @@ public class GameEventGroupServiceImpl implements IGameEventGroupService {
     public TableDataInfo<GameEventGroupVo> queryPageList(GameEventGroupBo bo, PageQuery pageQuery) {
         LambdaQueryWrapper<GameEventGroup> lqw = buildQueryWrapper(bo);
         Page<GameEventGroupVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
+        result.getRecords().stream()
+            .filter(vo -> StringUtils.isNotBlank(vo.getProjectList()))  // 过滤null和空字符串
+            .map(vo -> {
+                String[] projectIds = vo.getProjectList().split(",");
+                List<GameEventProjectVo> projects =
+                    gameEventProjectService.listProjectsByEventIdAndProjectIndex(
+                        vo.getEventId(),
+                        projectIds);
+                String projectNames = projects.stream()
+                    .map(GameEventProjectVo::getProjectName)
+                    .filter(StringUtils::isNotBlank)  // 过滤项目名为空的情况
+                    .collect(Collectors.joining(","));
+                vo.setProjectList(projectNames);
+                return vo;
+            })
+            .collect(Collectors.toList());  // 收集结果
         return TableDataInfo.build(result);
     }
 
@@ -117,7 +138,7 @@ public class GameEventGroupServiceImpl implements IGameEventGroupService {
     /**
      * 保存前的数据校验
      */
-    private void validEntityBeforeSave(GameEventGroup entity){
+    private void validEntityBeforeSave(GameEventGroup entity) {
         //TODO 做一些数据校验,如唯一约束
     }
 
@@ -130,7 +151,7 @@ public class GameEventGroupServiceImpl implements IGameEventGroupService {
      */
     @Override
     public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
-        if(isValid){
+        if (isValid) {
             //TODO 做一些业务上的校验,判断是否需要校验
         }
         return baseMapper.deleteByIds(ids) > 0;

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

@@ -40,7 +40,7 @@ public class GameEventProjectServiceImpl implements IGameEventProjectService {
      * @return 赛事项目
      */
     @Override
-    public GameEventProjectVo queryById(Long projectId){
+    public GameEventProjectVo queryById(Long projectId) {
         return baseMapper.selectVoById(projectId);
     }
 
@@ -117,7 +117,7 @@ public class GameEventProjectServiceImpl implements IGameEventProjectService {
     /**
      * 保存前的数据校验
      */
-    private void validEntityBeforeSave(GameEventProject entity){
+    private void validEntityBeforeSave(GameEventProject entity) {
         //TODO 做一些数据校验,如唯一约束
     }
 
@@ -130,9 +130,18 @@ public class GameEventProjectServiceImpl implements IGameEventProjectService {
      */
     @Override
     public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
-        if(isValid){
+        if (isValid) {
             //TODO 做一些业务上的校验,判断是否需要校验
         }
         return baseMapper.deleteByIds(ids) > 0;
     }
+
+    @Override
+    public List<GameEventProjectVo> listProjectsByEventIdAndProjectIndex(Long eventId, String[] projectIds) {
+        return this.baseMapper.selectVoList(
+            new LambdaQueryWrapper<GameEventProject>()
+                .eq(GameEventProject::getEventId, eventId)
+                .in(GameEventProject::getProjectId, projectIds)
+        );
+    }
 }