|
@@ -17,8 +17,10 @@ import org.dromara.system.domain.GameEvent;
|
|
import org.dromara.system.domain.bo.GameEventBo;
|
|
import org.dromara.system.domain.bo.GameEventBo;
|
|
import org.dromara.system.domain.constant.GameEventConstant;
|
|
import org.dromara.system.domain.constant.GameEventConstant;
|
|
import org.dromara.system.domain.vo.GameEventVo;
|
|
import org.dromara.system.domain.vo.GameEventVo;
|
|
|
|
+import org.dromara.system.domain.vo.SysDictDataVo;
|
|
import org.dromara.system.mapper.GameEventMapper;
|
|
import org.dromara.system.mapper.GameEventMapper;
|
|
import org.dromara.system.service.IGameEventService;
|
|
import org.dromara.system.service.IGameEventService;
|
|
|
|
+import org.dromara.system.service.ISysDictTypeService;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.dromara.system.domain.bo.GameEventProjectBo;
|
|
import org.dromara.system.domain.bo.GameEventProjectBo;
|
|
import org.dromara.system.domain.vo.GameEventProjectVo;
|
|
import org.dromara.system.domain.vo.GameEventProjectVo;
|
|
@@ -26,10 +28,7 @@ import org.dromara.system.domain.GameEventProject;
|
|
import org.dromara.system.mapper.GameEventProjectMapper;
|
|
import org.dromara.system.mapper.GameEventProjectMapper;
|
|
import org.dromara.system.service.IGameEventProjectService;
|
|
import org.dromara.system.service.IGameEventProjectService;
|
|
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Map;
|
|
|
|
-import java.util.Collection;
|
|
|
|
-import java.util.Optional;
|
|
|
|
|
|
+import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -45,6 +44,7 @@ public class GameEventProjectServiceImpl implements IGameEventProjectService {
|
|
|
|
|
|
private final GameEventProjectMapper baseMapper;
|
|
private final GameEventProjectMapper baseMapper;
|
|
private final GameEventMapper gameEventMapper;
|
|
private final GameEventMapper gameEventMapper;
|
|
|
|
+ private final ISysDictTypeService sysDictTypeService;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 查询赛事项目
|
|
* 查询赛事项目
|
|
@@ -66,7 +66,7 @@ public class GameEventProjectServiceImpl implements IGameEventProjectService {
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public TableDataInfo<GameEventProjectVo> queryPageList(GameEventProjectBo bo, PageQuery pageQuery) {
|
|
public TableDataInfo<GameEventProjectVo> queryPageList(GameEventProjectBo bo, PageQuery pageQuery) {
|
|
- if (bo.getEventId() == null){
|
|
|
|
|
|
+ if (bo.getEventId() == null) {
|
|
bo.setEventId(RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID));
|
|
bo.setEventId(RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID));
|
|
}
|
|
}
|
|
LambdaQueryWrapper<GameEventProject> lqw = buildQueryWrapper(bo);
|
|
LambdaQueryWrapper<GameEventProject> lqw = buildQueryWrapper(bo);
|
|
@@ -93,7 +93,7 @@ public class GameEventProjectServiceImpl implements IGameEventProjectService {
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public List<GameEventProjectVo> queryList(GameEventProjectBo bo) {
|
|
public List<GameEventProjectVo> queryList(GameEventProjectBo bo) {
|
|
- if (bo.getEventId() == null){
|
|
|
|
|
|
+ if (bo.getEventId() == null) {
|
|
bo.setEventId(RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID));
|
|
bo.setEventId(RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID));
|
|
}
|
|
}
|
|
LambdaQueryWrapper<GameEventProject> lqw = buildQueryWrapper(bo);
|
|
LambdaQueryWrapper<GameEventProject> lqw = buildQueryWrapper(bo);
|
|
@@ -107,18 +107,18 @@ public class GameEventProjectServiceImpl implements IGameEventProjectService {
|
|
lqw.eq(bo.getEventId() != null, GameEventProject::getEventId, bo.getEventId());
|
|
lqw.eq(bo.getEventId() != null, GameEventProject::getEventId, bo.getEventId());
|
|
// 通过名称模糊查询
|
|
// 通过名称模糊查询
|
|
Optional.ofNullable(bo.getEventName())
|
|
Optional.ofNullable(bo.getEventName())
|
|
- .ifPresent(eventName->{
|
|
|
|
|
|
+ .ifPresent(eventName -> {
|
|
List<GameEvent> gameEvents = gameEventMapper.selectList(
|
|
List<GameEvent> gameEvents = gameEventMapper.selectList(
|
|
Wrappers.lambdaQuery(GameEvent.class)
|
|
Wrappers.lambdaQuery(GameEvent.class)
|
|
.like(GameEvent::getEventName, bo.getEventName())
|
|
.like(GameEvent::getEventName, bo.getEventName())
|
|
.select(GameEvent::getEventId)
|
|
.select(GameEvent::getEventId)
|
|
);
|
|
);
|
|
- if(CollectionUtils.isNotEmpty(gameEvents)){
|
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(gameEvents)) {
|
|
List<Long> ids = gameEvents.stream()
|
|
List<Long> ids = gameEvents.stream()
|
|
.map(GameEvent::getEventId)
|
|
.map(GameEvent::getEventId)
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
lqw.in(GameEventProject::getEventId, ids);
|
|
lqw.in(GameEventProject::getEventId, ids);
|
|
- }else{
|
|
|
|
|
|
+ } else {
|
|
lqw.apply("1=0");
|
|
lqw.apply("1=0");
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -139,7 +139,7 @@ public class GameEventProjectServiceImpl implements IGameEventProjectService {
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public Boolean insertByBo(GameEventProjectBo bo) {
|
|
public Boolean insertByBo(GameEventProjectBo bo) {
|
|
- if (bo.getEventId() == null){
|
|
|
|
|
|
+ if (bo.getEventId() == null) {
|
|
bo.setEventId(RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID));
|
|
bo.setEventId(RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID));
|
|
}
|
|
}
|
|
GameEventProject add = MapstructUtils.convert(bo, GameEventProject.class);
|
|
GameEventProject add = MapstructUtils.convert(bo, GameEventProject.class);
|
|
@@ -159,7 +159,7 @@ public class GameEventProjectServiceImpl implements IGameEventProjectService {
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public Boolean updateByBo(GameEventProjectBo bo) {
|
|
public Boolean updateByBo(GameEventProjectBo bo) {
|
|
- if (bo.getEventId() == null){
|
|
|
|
|
|
+ if (bo.getEventId() == null) {
|
|
bo.setEventId(RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID));
|
|
bo.setEventId(RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID));
|
|
}
|
|
}
|
|
GameEventProject update = MapstructUtils.convert(bo, GameEventProject.class);
|
|
GameEventProject update = MapstructUtils.convert(bo, GameEventProject.class);
|
|
@@ -204,4 +204,32 @@ public class GameEventProjectServiceImpl implements IGameEventProjectService {
|
|
Wrappers.lambdaQuery(GameEventProject.class)
|
|
Wrappers.lambdaQuery(GameEventProject.class)
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Map<String, List<String>> mapProjectTypeAndProject() {
|
|
|
|
+ Long defaultEventId = RedisUtils.getCacheObject(GameEventConstant.DEFAULT_EVENT_ID);
|
|
|
|
+ List<GameEventProject> list = baseMapper.selectList(
|
|
|
|
+ Wrappers.lambdaQuery(GameEventProject.class)
|
|
|
|
+ .eq(GameEventProject::getEventId, defaultEventId)
|
|
|
|
+ .select(GameEventProject::getProjectType, GameEventProject::getProjectName)
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ // 从字典中获取项目类型映射:projectType (dictValue) -> dictLabel
|
|
|
|
+ List<SysDictDataVo> projectTypeDictList = sysDictTypeService.selectDictDataByType("game_project_type");
|
|
|
|
+ Map<String, String> dictMap = projectTypeDictList.stream()
|
|
|
|
+ .collect(Collectors.toMap(SysDictDataVo::getDictValue, SysDictDataVo::getDictLabel));
|
|
|
|
+
|
|
|
|
+ // 按照项目类型(中文 label)分组,每个类型对应一个项目名称列表
|
|
|
|
+ Map<String, List<String>> result = new HashMap<>();
|
|
|
|
+ for (GameEventProject project : list) {
|
|
|
|
+ String projectType = project.getProjectType();
|
|
|
|
+ String projectName = project.getProjectName();
|
|
|
|
+ String label = dictMap.getOrDefault(projectType, projectType); // 使用中文标签作为 key
|
|
|
|
+
|
|
|
|
+ // 将项目名添加到对应类型的列表中
|
|
|
|
+ result.computeIfAbsent(label, k -> new ArrayList<>()).add(projectName);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
}
|
|
}
|