Commit a63c0d9d authored by shiyu's avatar shiyu

子类目查询

parent 47019fcc
......@@ -249,14 +249,17 @@ public class CategoryServiceImpl implements CategoryService {
public Result findChildCategory(CategoryRequestDto dto) {
try {
List<Category> categoryList = new ArrayList<>();
List<Category> childList = categoryDao.queryByPids(dto.getPidList());
if (!CollectionUtils.isEmpty(childList)) {
categoryList.addAll(childList);
}
List<Category> selfList = categoryDao.queryByIds(dto.getPidList());
for (Category category : selfList) {
if (category.getIsLeaf()) {
categoryList.add(category);
}
}
List<Category> childList = categoryDao.queryByPids(dto.getPidList());
categoryList.addAll(childList);
return Result.success(categoryList);
} catch (Exception e) {
logger.error("查询子类目失败", e);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment