Просмотр исходного кода

feat : sdk后台测试bug修改

bilingfeng 2 лет назад
Родитель
Сommit
8d6b8d21a8

+ 14 - 0
game-module/game-manage/src/main/java/com/zanxiang/manage/controller/GameController.java

@@ -99,4 +99,18 @@ public class GameController {
     public ResultVo<List<GameChoiceVO>> choiceList() {
         return new ResultVo<>(gameService.choiceList());
     }
+
+    @ApiOperation(value = "删除游戏")
+    @DeleteMapping(value = "/delete")
+    @ApiResponses(value = {@ApiResponse(code = 200, message = "成功", response = GameListVO.class)})
+    public ResultVo<Boolean> deleteById(@RequestParam Long id) {
+        return new ResultVo<>(gameService.deleteById(id));
+    }
+
+    @ApiOperation(value = "游戏状态变更")
+    @PatchMapping(value = "/status/update")
+    @ApiResponses(value = {@ApiResponse(code = 200, message = "成功", response = GameListVO.class)})
+    public ResultVo<Boolean> statusUpdate(@RequestParam Long id, @RequestParam Integer status) {
+        return new ResultVo<>(gameService.statusUpdate(id, status));
+    }
 }

+ 16 - 0
game-module/game-manage/src/main/java/com/zanxiang/manage/service/GameService.java

@@ -113,4 +113,20 @@ public interface GameService extends IService<Game> {
      * @return : 返回游戏信息列表
      */
     Map<Long, GameDTO> gameCondition(Long cpId, Long gameId, Long gameCategoryId);
+
+    /**
+     * 根据主键id删除
+     *
+     * @param id : 主键id
+     * @return : 返回删除结果
+     */
+    Boolean deleteById(Long id);
+
+    /**
+     * 根据主键id删除
+     *
+     * @param id : 主键id
+     * @return : 返回删除结果
+     */
+    Boolean statusUpdate(Long id, Integer status);
 }

+ 7 - 2
game-module/game-manage/src/main/java/com/zanxiang/manage/service/Impl/GameCategoryServiceImpl.java

@@ -3,6 +3,7 @@ package com.zanxiang.manage.service.Impl;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.zanxiang.common.enums.GameCategoryEnum;
 import com.zanxiang.common.exception.BaseException;
@@ -91,6 +92,10 @@ public class GameCategoryServiceImpl extends ServiceImpl<GameCategoryMapper, Gam
                     .eq(GameCategory::getType, GameCategoryEnum.GAME_LABEL.getCategoryType()));
         }
         List<Long> parentIdList = categoryList.stream().map(GameCategory::getId).collect(Collectors.toList());
+        //查询父标签, 但是却查不到, 直接返回空
+        if (parentIdList.isEmpty()) {
+            return new Page<>(param.getPageNum(), param.getPageSize());
+        }
         return page(param.toPage(), new QueryWrapper<GameCategory>().lambda()
                 //条件不为空没勾选父标签
                 .like(StringUtils.isNotBlank(param.getLabelName()) && !Objects.equals(param.getIsParent(), Boolean.TRUE),
@@ -99,8 +104,8 @@ public class GameCategoryServiceImpl extends ServiceImpl<GameCategoryMapper, Gam
                 .eq(StringUtils.isBlank(param.getLabelName()) && Objects.equals(param.getIsParent(), Boolean.TRUE),
                         GameCategory::getParentId, 0)
                 //条件不为空查询父标签
-                .in(StringUtils.isNotBlank(param.getLabelName()) && Objects.equals(param.getIsParent(), Boolean.TRUE)
-                        && !parentIdList.isEmpty(), GameCategory::getParentId, parentIdList)
+                .and(StringUtils.isNotBlank(param.getLabelName()) && Objects.equals(param.getIsParent(), Boolean.TRUE),
+                        qw -> qw.in(GameCategory::getParentId, parentIdList).or().like(GameCategory::getName, param.getLabelName()))
                 .eq(GameCategory::getType, GameCategoryEnum.GAME_LABEL.getCategoryType())
                 .orderByDesc(GameCategory::getCreateTime))
                 .convert(this::toVo);

+ 25 - 1
game-module/game-manage/src/main/java/com/zanxiang/manage/service/Impl/GameServiceImpl.java

@@ -408,7 +408,7 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements Ga
             gameListVO.setIsParentGame(Boolean.TRUE);
             gameListVO.setParentId(game.getId());
             gameListVO.setParentName(game.getName());
-        }else {
+        } else {
 
         }
         //查询支付方式列表
@@ -487,4 +487,28 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements Ga
         return BeanUtils.copyList(gameList, GameDTO.class);
     }
 
+    /**
+     * 根据主键id删除
+     *
+     * @param id : 主键id
+     * @return : 返回删除结果
+     */
+    @Override
+    public Boolean deleteById(Long id) {
+        return super.removeById(id);
+    }
+
+    /**
+     * 根据主键id删除
+     *
+     * @param id : 主键id
+     * @return : 返回删除结果
+     */
+    @Override
+    public Boolean statusUpdate(Long id, Integer status) {
+        return super.update(new LambdaUpdateWrapper<Game>()
+                .set(Game::getStatus, status)
+                .set(Game::getUpdateTime, LocalDateTime.now()));
+    }
+
 }