lin
2024-02-28 b04d632b040e8b0426402794e6e71ee08e9f0379
标签统计
3 files modified
15 ■■■■■ changed files
src/main/java/org/springblade/common/node/TreeIntegerNode.java 6 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/category/mapper/CategoryMapper.xml 1 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/house/service/impl/HouseholdServiceImpl.java 8 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/common/node/TreeIntegerNode.java
@@ -26,6 +26,12 @@
    private Integer id;
    /**
     * 主键ID
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Integer ids;
    /**
     * 名称
     */
    private String name;
src/main/java/org/springblade/modules/category/mapper/CategoryMapper.xml
@@ -61,6 +61,7 @@
    <select id="getTreeList" resultType="org.springblade.common.node.TreeIntegerNode">
        SELECT
            jc.category_no AS id,
            jc.id AS ids,
            jc.category_no,
            jc.parent_no AS parentId,
            jc.category_name AS name,
src/main/java/org/springblade/modules/house/service/impl/HouseholdServiceImpl.java
@@ -515,6 +515,14 @@
    private void recursion(TreeIntegerNode node) {
        if (node.getChildren() != null && node.getChildren().size() > 0) {
            if(node.getId().equals(1030)){
                int sum = node.getChildren().stream().mapToInt(TreeIntegerNode::getCount).sum();
                node.setCount(sum);
            }
            if(node.getId().equals(1031)){
                int sum = node.getChildren().stream().mapToInt(TreeIntegerNode::getCount).sum();
                node.setCount(sum);
            }
            node.getChildren().forEach(node2 -> recursion(node2));
        } else {
            node.setChildren(null);