Bläddra i källkod

修改内容:角色操作

shishaosong 1 år sedan
förälder
incheckning
29adfc5a48

+ 9 - 2
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/params/GameGiftAddParam.java

@@ -20,8 +20,15 @@ public class GameGiftAddParam {
      * 游戏id
      */
     @NotNull
-    @ApiModelProperty("游戏id")
-    private Long gameId;
+    @ApiModelProperty("超父游戏id")
+    private Long superGameId;
+
+    /**
+     * 游戏id
+     */
+    @NotNull
+    @ApiModelProperty("父游戏id")
+    private Long parentGameId;
 
     /**
      * 礼包名称

+ 5 - 2
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/params/GameGiftListParam.java

@@ -13,6 +13,9 @@ public class GameGiftListParam extends BaseListDTO<GameGift> {
     @ApiModelProperty(notes = "礼包名称")
     private String giftName;
 
-    @ApiModelProperty(notes = "游戏id")
-    private Long gameId;
+    @ApiModelProperty(notes = "超父游戏id")
+    private Long superGameId;
+
+    @ApiModelProperty(notes = "父游戏id")
+    private Long parentGameId;
 }

+ 4 - 11
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/pojo/vo/GameGiftListVO.java

@@ -12,21 +12,14 @@ import java.time.LocalDateTime;
 @Builder
 @Data
 public class GameGiftListVO {
-
-    /**
-     * id
-     */
     @ApiModelProperty(notes = "id")
     private Long id;
 
-    /**
-     * 游戏id
-     */
-    @ApiModelProperty("游戏id")
-    private Long gameId;
+    @ApiModelProperty("父游戏id")
+    private Long parentGameId;
 
-    @ApiModelProperty("游戏名称")
-    private String gameName;
+    @ApiModelProperty("父游戏名称")
+    private String parentGameName;
 
     /**
      * 礼包名称

+ 18 - 12
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/GameGiftServiceImpl.java

@@ -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())

+ 2 - 2
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/RoleAssignRecordServiceImpl.java

@@ -157,11 +157,11 @@ public class RoleAssignRecordServiceImpl extends ServiceImpl<RoleAssignRecordMap
     public IPage<RoleAssignRecordListVO> listOfPage(RoleAssignRecordListParam param) {
         Agent agent = agentService.getById(param.getRegAgentId());
         GameDTO game = gameService.getById(param.getGameId());
+        Long superGameId = null == game.getSuperGameId() ? param.getGameId() : game.getSuperGameId();
         GameServer gameServer = gameServerService.getOne(new LambdaQueryWrapper<GameServer>()
-                .eq(GameServer::getGameId, param.getGameId())
+                .eq(GameServer::getGameId, superGameId)
                 .eq(GameServer::getServerId, param.getServerId()));
         GameUserRole role = gameUserRoleService.getOne(new LambdaQueryWrapper<GameUserRole>()
-                .eq(GameUserRole::getGameId, param.getGameId())
                 .eq(GameUserRole::getServerId, param.getServerId())
                 .eq(GameUserRole::getUserId, param.getUserId())
                 .eq(GameUserRole::getRoleId, param.getRoleId()));

+ 8 - 2
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/RoleGiftRecordServiceImpl.java

@@ -9,11 +9,13 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.zanxiang.erp.base.ErpServer;
 import com.zanxiang.erp.base.rpc.ISysUserRpc;
 import com.zanxiang.erp.security.util.SecurityUtil;
+import com.zanxiang.game.module.manage.pojo.dto.GameDTO;
 import com.zanxiang.game.module.manage.pojo.params.RoleGiftRecordAddParam;
 import com.zanxiang.game.module.manage.pojo.params.RoleGiftRecordListParam;
 import com.zanxiang.game.module.manage.pojo.vo.RoleGiftRecordListVO;
 import com.zanxiang.game.module.manage.pojo.vo.RoleMailRecordListVO;
 import com.zanxiang.game.module.manage.service.IGameGiftService;
+import com.zanxiang.game.module.manage.service.IGameService;
 import com.zanxiang.game.module.manage.service.IRoleOperateService;
 import com.zanxiang.game.module.mybatis.entity.*;
 import com.zanxiang.game.module.mybatis.entity.RoleGiftRecord;
@@ -45,6 +47,8 @@ public class RoleGiftRecordServiceImpl extends ServiceImpl<RoleGiftRecordMapper,
     private IRoleOperateService roleOperateService;
     @Autowired
     private IGameGiftService gameGiftService;
+    @Autowired
+    private IGameService gameService;
 
     @Override
     @Transactional(rollbackFor = Exception.class)
@@ -108,13 +112,15 @@ public class RoleGiftRecordServiceImpl extends ServiceImpl<RoleGiftRecordMapper,
 
     @Override
     public IPage<RoleGiftRecordListVO> listOfPage(RoleGiftRecordListParam param) {
+        GameDTO gameDTO = gameService.getById(param.getGameId());
+        Long parentGameId = null == gameDTO.getParentId() ? param.getGameId():gameDTO.getParentId();
         List<Long> gameGiftIdList = gameGiftService.list(new LambdaQueryWrapper<GameGift>()
-                        .eq(GameGift::getGameId, param.getGameId())
+                        .eq(GameGift::getParentGameId, parentGameId)
                         .like(StringUtils.isNotBlank(param.getGiftName()), GameGift::getGiftName, param.getGiftName()))
                 .stream()
                 .map(GameGift::getId)
                 .collect(Collectors.toList());
-        if (CollectionUtils.isEmpty(gameGiftIdList)){
+        if (CollectionUtils.isEmpty(gameGiftIdList)) {
             return new Page<>();
         }
         return page(param.toPage(), new LambdaQueryWrapper<RoleGiftRecord>()

+ 3 - 4
game-module/game-module-mybatis/src/main/java/com/zanxiang/game/module/mybatis/entity/GameGift.java

@@ -30,10 +30,9 @@ public class GameGift implements Serializable {
     @TableId(value = "id", type = IdType.AUTO)
     private Long id;
 
-    /**
-     * 游戏id
-     */
-    private Long gameId;
+    private Long superGameId;
+
+    private Long parentGameId;
 
     /**
      * 礼包名称