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