标准分类模块开发
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user