Преглед на файлове

feat : 游戏分类修改

bilingfeng преди 2 години
родител
ревизия
3c7c6b324f

+ 2 - 2
game-module/game-manage/src/main/java/com/zanxiang/manage/controller/ChoiceController.java

@@ -93,8 +93,8 @@ public class ChoiceController {
         return ResultVO.ok(gameCategoryService.getGameCategoryParent(GameCategoryEnum.GAME_TYPE.getCategoryType()));
     }
 
-    @ApiOperation(value = "游戏父标签选择列表")
-    @GetMapping(value = "/game/parent/tags/list")
+    @ApiOperation(value = "游戏选择列表")
+    @GetMapping(value = "/game/tags/list")
     @PreAuthorize(permissionKey = "sdk:gameTagsChoice:list")
     @ApiResponses(value = {@ApiResponse(code = 200, message = "成功", response = GameCategoryParentVO.class, responseContainer = "list")})
     public ResultVO<List<GameCategoryParentVO>> gameTagsChoiceList() {

+ 0 - 11
game-module/game-manage/src/main/java/com/zanxiang/manage/controller/GameCategoryController.java

@@ -5,7 +5,6 @@ import com.zanxiang.common.domain.ResultVO;
 import com.zanxiang.erp.security.annotation.PreAuthorize;
 import com.zanxiang.manage.domain.params.GameCategoryAddUpdateParam;
 import com.zanxiang.manage.domain.params.GameCategoryListParam;
-import com.zanxiang.manage.domain.vo.GameCategoryParentVO;
 import com.zanxiang.manage.domain.vo.GameCategoryVO;
 import com.zanxiang.manage.service.GameCategoryService;
 import io.swagger.annotations.Api;
@@ -17,8 +16,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.List;
-
 /**
  * @author : lingfeng
  * @time : 2022-06-23
@@ -33,14 +30,6 @@ public class GameCategoryController {
     @Autowired
     private GameCategoryService gameCategoryService;
 
-    @ApiOperation(value = "查询所游戏分类或父标签列表")
-    @GetMapping(value = "/parent/list")
-    @PreAuthorize(permissionKey = "sdk:gameCategory:parentList")
-    @ApiResponses(value = {@ApiResponse(code = 200, message = "成功", response = GameCategoryParentVO.class, responseContainer = "list")})
-    public ResultVO<List<GameCategoryParentVO>> getGameCategoryParent(@RequestParam Integer type) {
-        return ResultVO.ok(gameCategoryService.getGameCategoryParent(type));
-    }
-
     @ApiOperation(value = "查询游戏标签列表")
     @PostMapping(value = "/list")
     @PreAuthorize(permissionKey = "sdk:gameCategory:list")

+ 12 - 0
game-module/game-manage/src/main/java/com/zanxiang/manage/domain/vo/GameCategoryParentVO.java

@@ -22,4 +22,16 @@ public class GameCategoryParentVO {
      */
     @ApiModelProperty(notes = "名称")
     private String name;
+
+    /**
+     * 是否父标签
+     */
+    @ApiModelProperty(notes = "是否父标签")
+    private Boolean isParent;
+
+    /**
+     * 父分类id(顶层游戏分类为0)
+     */
+    @ApiModelProperty(notes = "是否父标签")
+    private Long parentId;
 }

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

@@ -73,8 +73,15 @@ public class GameCategoryServiceImpl extends ServiceImpl<GameCategoryMapper, Gam
     public List<GameCategoryParentVO> getGameCategoryParent(Integer type) {
         List<GameCategory> gameCategoryList = list(new LambdaQueryWrapper<GameCategory>()
                 .eq(GameCategory::getType, type)
-                .eq(GameCategory::getParentId, 0));
-        return BeanUtils.copyList(gameCategoryList, GameCategoryParentVO.class);
+                .eq(Objects.equals(type, GameCategoryEnum.GAME_TYPE.getCategoryType()), GameCategory::getParentId, 0));
+        List<GameCategoryParentVO> voList = BeanUtils.copyList(gameCategoryList, GameCategoryParentVO.class);
+        for (GameCategoryParentVO vo : voList) {
+            if (Objects.equals(vo.getParentId(), 0L)) {
+                vo.setIsParent(Boolean.TRUE);
+                vo.setParentId(vo.getParentId());
+            }
+        }
+        return voList;
     }
 
     /**