|
@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-import com.zanxiang.game.module.base.utils.BeanUtils;
|
|
|
import com.zanxiang.game.module.manage.enums.GameStatusEnum;
|
|
|
import com.zanxiang.game.module.manage.pojo.dto.GameCategoryDTO;
|
|
|
import com.zanxiang.game.module.manage.pojo.dto.GameDTO;
|
|
@@ -55,7 +54,7 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements IG
|
|
|
@Override
|
|
|
public GameDockVO getGameDock(Long id) {
|
|
|
Game game = super.getById(id);
|
|
|
- GameDockVO gameDockVO = BeanUtils.copy(game, GameDockVO.class);
|
|
|
+ GameDockVO gameDockVO = BeanUtil.copy(game, GameDockVO.class);
|
|
|
if (gameDockVO == null) {
|
|
|
return null;
|
|
|
}
|
|
@@ -103,7 +102,7 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements IG
|
|
|
@Override
|
|
|
public GameRelationVO getGameRelation(Long id) {
|
|
|
Game game = super.getById(id);
|
|
|
- GameRelationVO gameRelationVO = BeanUtils.copy(game, GameRelationVO.class);
|
|
|
+ GameRelationVO gameRelationVO = BeanUtil.copy(game, GameRelationVO.class);
|
|
|
if (gameRelationVO == null) {
|
|
|
return null;
|
|
|
}
|
|
@@ -190,14 +189,14 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements IG
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<GameInfoVO> infoByIds(Collection<Long> gameIds) {
|
|
|
+ public List<GameInfoVO> infoByIds(Collection<Long> gameIds) {
|
|
|
return listByIds(gameIds).stream().map(game -> BeanUtil.copy(game, GameInfoVO.class)).collect(Collectors.toList());
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public GameInfoVO getGameInfo(Long gameId) {
|
|
|
Game game = super.getById(gameId);
|
|
|
- GameInfoVO gameInfoVO = BeanUtils.copy(game, GameInfoVO.class);
|
|
|
+ GameInfoVO gameInfoVO = BeanUtil.copy(game, GameInfoVO.class);
|
|
|
if (gameInfoVO == null) {
|
|
|
return null;
|
|
|
}
|
|
@@ -210,8 +209,10 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements IG
|
|
|
if (Strings.isNotBlank(game.getTags())) {
|
|
|
String[] split = game.getTags().split(",");
|
|
|
List<Long> idList = Arrays.stream(split).map(Long::valueOf).collect(Collectors.toList());
|
|
|
- List<GameTagVO> gameTagVOList = gameTagService.listByIds(idList);
|
|
|
- gameInfoVO.setClassifyList(BeanUtils.copyList(gameTagVOList, GameTagChoiceVO.class));
|
|
|
+ List<GameTagChoiceVO> gameTagChoiceVOList = gameTagService.listByIds(idList).stream()
|
|
|
+ .map(gameTagVO -> BeanUtil.copy(gameTagVO, GameTagChoiceVO.class))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ gameInfoVO.setClassifyList(gameTagChoiceVOList);
|
|
|
}
|
|
|
if (game.getCategory() != null) {
|
|
|
GameCategoryDTO gameCategoryDTO = gameCategoryService.getById(game.getCategory());
|
|
@@ -370,7 +371,7 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements IG
|
|
|
|
|
|
private GameListVO toVo(Game game, Map<Long, String> cpMap, Map<Long, GameCategoryDTO> gameCategoryMap,
|
|
|
Map<Long, String> gameMap, Map<Long, GameTagDTO> gameTagMap) {
|
|
|
- GameListVO gameListVO = BeanUtils.copy(game, GameListVO.class);
|
|
|
+ GameListVO gameListVO = BeanUtil.copy(game, GameListVO.class);
|
|
|
if (gameListVO == null) {
|
|
|
return null;
|
|
|
}
|
|
@@ -418,8 +419,11 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements IG
|
|
|
|
|
|
@Override
|
|
|
public List<GameChoiceVO> choiceList() {
|
|
|
- List<Game> gameList = super.list(new LambdaQueryWrapper<Game>().select(Game::getId, Game::getName, Game::getCategory));
|
|
|
- return BeanUtils.copyList(gameList, GameChoiceVO.class);
|
|
|
+ return super.list(new LambdaQueryWrapper<Game>()
|
|
|
+ .select(Game::getId, Game::getName, Game::getCategory))
|
|
|
+ .stream()
|
|
|
+ .map(game -> BeanUtil.copy(game, GameChoiceVO.class))
|
|
|
+ .collect(Collectors.toList());
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -427,7 +431,7 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements IG
|
|
|
if (id == null) {
|
|
|
return null;
|
|
|
}
|
|
|
- return BeanUtils.copy(super.getById(id), GameDTO.class);
|
|
|
+ return BeanUtil.copy(super.getById(id), GameDTO.class);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -447,13 +451,12 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements IG
|
|
|
if (cpId == null && gameId == null && gameCategoryId == null) {
|
|
|
return Collections.emptyList();
|
|
|
}
|
|
|
- List<Game> gameList = super.list(new LambdaQueryWrapper<Game>()
|
|
|
+ return super.list(new LambdaQueryWrapper<Game>()
|
|
|
.eq(cpId != null, Game::getCpId, cpId)
|
|
|
.eq(gameId != null, Game::getId, gameId)
|
|
|
.eq(gameCategoryId != null, Game::getCategory, gameCategoryId)
|
|
|
.select(Game::getId, Game::getCpId, Game::getName, Game::getCategory)
|
|
|
- );
|
|
|
- return BeanUtils.copyList(gameList, GameDTO.class);
|
|
|
+ ).stream().map(game -> BeanUtil.copy(game, GameDTO.class)).collect(Collectors.toList());
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -465,8 +468,8 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements IG
|
|
|
if (CollectionUtils.isEmpty(gameList)) {
|
|
|
return Collections.emptyMap();
|
|
|
}
|
|
|
- List<GameDTO> gameDTOList = BeanUtils.copyList(gameList, GameDTO.class);
|
|
|
- return gameDTOList.stream().collect(Collectors.toMap(GameDTO::getId, Function.identity()));
|
|
|
+ return gameList.stream().map(game -> BeanUtil.copy(game, GameDTO.class))
|
|
|
+ .collect(Collectors.toMap(GameDTO::getId, Function.identity()));
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -475,8 +478,9 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements IG
|
|
|
if (CollectionUtils.isEmpty(gameList)) {
|
|
|
return Collections.emptyMap();
|
|
|
}
|
|
|
- List<GameDTO> gameDTOList = BeanUtils.copyList(gameList, GameDTO.class);
|
|
|
- return gameDTOList.stream().collect(Collectors.toMap(GameDTO::getId, Function.identity()));
|
|
|
+ return gameList.stream()
|
|
|
+ .map(game -> BeanUtil.copy(game, GameDTO.class))
|
|
|
+ .collect(Collectors.toMap(GameDTO::getId, Function.identity()));
|
|
|
}
|
|
|
|
|
|
@Override
|