|
@@ -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;
|