|
@@ -49,13 +49,15 @@ public class GameGiftServiceImpl extends ServiceImpl<GameGiftMapper, GameGift> i
|
|
|
LocalDateTime now = LocalDateTime.now();
|
|
|
if (null == param.getId()) {
|
|
|
int count = count(new LambdaQueryWrapper<GameGift>()
|
|
|
- .eq(GameGift::getGameId, param.getGameId())
|
|
|
+ .eq(GameGift::getParentGameId, param.getParentGameId())
|
|
|
+ .eq(GameGift::getSuperGameId, param.getSuperGameId())
|
|
|
.eq(GameGift::getGiftName, param.getGiftName()));
|
|
|
if (count > 1) {
|
|
|
throw new BaseException("此游戏礼包名称重复");
|
|
|
}
|
|
|
GameGift gameGift = GameGift.builder()
|
|
|
- .gameId(param.getGameId())
|
|
|
+ .parentGameId(param.getParentGameId())
|
|
|
+ .superGameId(param.getSuperGameId())
|
|
|
.giftName(param.getGiftName())
|
|
|
.createBy(sysUserId)
|
|
|
.createTime(now)
|
|
@@ -66,14 +68,16 @@ public class GameGiftServiceImpl extends ServiceImpl<GameGiftMapper, GameGift> i
|
|
|
} else {
|
|
|
int count = count(new LambdaQueryWrapper<GameGift>()
|
|
|
.ne(GameGift::getId, param.getId())
|
|
|
- .eq(GameGift::getGameId, param.getGameId())
|
|
|
+ .eq(GameGift::getParentGameId, param.getParentGameId())
|
|
|
+ .eq(GameGift::getSuperGameId, param.getSuperGameId())
|
|
|
.eq(GameGift::getGiftName, param.getGiftName()));
|
|
|
if (count > 1) {
|
|
|
throw new BaseException("此游戏礼包名称重复");
|
|
|
}
|
|
|
GameGift gameGift = GameGift.builder()
|
|
|
.id(param.getId())
|
|
|
- .gameId(param.getGameId())
|
|
|
+ .parentGameId(param.getParentGameId())
|
|
|
+ .superGameId(param.getSuperGameId())
|
|
|
.giftName(param.getGiftName())
|
|
|
.updateBy(sysUserId)
|
|
|
.updateTime(now)
|
|
@@ -85,16 +89,17 @@ public class GameGiftServiceImpl extends ServiceImpl<GameGiftMapper, GameGift> i
|
|
|
@Override
|
|
|
public List<GameGiftListVO> queryAll(GameGiftListParam param) {
|
|
|
return list(new LambdaQueryWrapper<GameGift>()
|
|
|
- .eq(null != param.getGameId(), GameGift::getGameId, param.getGameId())
|
|
|
+ .eq(null != param.getSuperGameId(), GameGift::getSuperGameId, param.getSuperGameId())
|
|
|
+ .eq(null != param.getParentGameId(), GameGift::getParentGameId, param.getParentGameId())
|
|
|
.like(StringUtils.isNotBlank(param.getGiftName()), GameGift::getGiftName, param.getGiftName())
|
|
|
.eq(GameGift::getIsDelete, 0))
|
|
|
.stream()
|
|
|
.map(item -> {
|
|
|
- GameDTO game = gameService.getById(item.getGameId());
|
|
|
+ GameDTO game = gameService.getById(item.getParentGameId());
|
|
|
return GameGiftListVO.builder()
|
|
|
.id(item.getId())
|
|
|
- .gameId(item.getGameId())
|
|
|
- .gameName(null == game ? null : game.getName())
|
|
|
+ .parentGameId(item.getParentGameId())
|
|
|
+ .parentGameName(null == game ? null : game.getName())
|
|
|
.giftName(item.getGiftName())
|
|
|
.createBy(item.getCreateBy())
|
|
|
.createName(sysUserRpc.getById(item.getCreateBy()).getData().getNickname())
|
|
@@ -120,15 +125,16 @@ public class GameGiftServiceImpl extends ServiceImpl<GameGiftMapper, GameGift> i
|
|
|
@Override
|
|
|
public IPage<GameGiftListVO> listOfPage(GameGiftListParam param) {
|
|
|
return page(param.toPage(), new LambdaQueryWrapper<GameGift>()
|
|
|
- .eq(null != param.getGameId(), GameGift::getGameId, param.getGameId())
|
|
|
+ .eq(null != param.getSuperGameId(), GameGift::getSuperGameId, param.getSuperGameId())
|
|
|
+ .eq(null != param.getParentGameId(), GameGift::getParentGameId, param.getParentGameId())
|
|
|
.like(StringUtils.isNotBlank(param.getGiftName()), GameGift::getGiftName, param.getGiftName())
|
|
|
.eq(GameGift::getIsDelete, 0))
|
|
|
.convert(item -> {
|
|
|
- GameDTO game = gameService.getById(item.getGameId());
|
|
|
+ GameDTO game = gameService.getById(item.getParentGameId());
|
|
|
return GameGiftListVO.builder()
|
|
|
.id(item.getId())
|
|
|
- .gameId(item.getGameId())
|
|
|
- .gameName(null == game ? null : game.getName())
|
|
|
+ .parentGameId(item.getParentGameId())
|
|
|
+ .parentGameName(null == game ? null : game.getName())
|
|
|
.giftName(item.getGiftName())
|
|
|
.createBy(item.getCreateBy())
|
|
|
.createName(sysUserRpc.getById(item.getCreateBy()).getData().getNickname())
|