标准分类模块开发

This commit is contained in:
lhx
2025-12-05 15:03:29 +08:00
parent 254add04be
commit 81cf1ed080

View File

@@ -14,6 +14,7 @@ import com.dc.dc_project.utils.TreeUtil;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -117,7 +118,10 @@ public class StandardCategoryServiceImpl extends ServiceImpl<StandardCategoryMap
.eq(standardCategoryDto.getId() != null, StandardCategory::getId, standardCategoryDto.getId()) .eq(standardCategoryDto.getId() != null, StandardCategory::getId, standardCategoryDto.getId())
.like(standardCategoryDto.getName() != null, StandardCategory::getName, standardCategoryDto.getName()); .like(standardCategoryDto.getName() != null, StandardCategory::getName, standardCategoryDto.getName());
List<StandardCategory> list = this.list(queryWrapper); List<StandardCategory> list = this.list(queryWrapper);
List<StandardCategoryVo> tree = TreeUtil.buildTree(list.stream().map(StandardCategoryVo::poToVo).collect(Collectors.toList())); List<StandardCategoryVo> tree = TreeUtil.buildTreeWithSort(
list.stream().map(StandardCategoryVo::poToVo).collect(Collectors.toList()),
Comparator.comparing(StandardCategoryVo::getSortOrder)
);
return ResponseResult.success(tree); return ResponseResult.success(tree);
} }
} }