组件管理加排序

This commit is contained in:
cdf
2025-12-22 19:59:25 +08:00
parent 277400670d
commit 2f2ed06a35
2 changed files with 7 additions and 8 deletions

View File

@@ -19,7 +19,7 @@
line_index id,
LEAST(ROUND(SUM(real_time) / SUM(due_time), 2) * 100,100) integrityData
FROM
`r_stat_integrity_d`
r_stat_integrity_d
WHERE time_id between #{startTime} and #{endTime}
GROUP BY line_index
</select>
@@ -35,9 +35,9 @@
100
) integrityData
FROM
`r_stat_onlinerate_d`
r_stat_onlinerate_d
WHERE time_id between #{startTime} and #{endTime}
GROUP BY dev_index
</select>
</mapper>
</mapper>

View File

@@ -26,10 +26,7 @@ import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;
/**
@@ -110,6 +107,7 @@ public class ComponentServiceImpl extends ServiceImpl<ComponentMapper, Component
ComponentVO componentVO = new ComponentVO();
componentVO.setId(dictData.getId());
componentVO.setName(dictData.getName());
componentVO.setSort(dictData.getSort());
componentVO.setChildren(
v.stream()
.filter(fun -> Objects.equals(ComponentState.FATHER_PID, fun.getPid()))
@@ -117,6 +115,7 @@ public class ComponentServiceImpl extends ServiceImpl<ComponentMapper, Component
.collect(Collectors.toList()));
result.add(componentVO);
});
result.sort(Comparator.comparing(ComponentVO::getSort));
}
return result;
}
@@ -182,7 +181,7 @@ public class ComponentServiceImpl extends ServiceImpl<ComponentMapper, Component
*/
private List<ComponentVO> getChildCategoryList(ComponentVO currMenu, List<ComponentVO> categories) {
return categories.stream().filter(o -> Objects.equals(o.getPid(), currMenu.getId()))
.peek(o -> o.setChildren(getChildCategoryList(o, categories)))
.peek(o -> o.setChildren(getChildCategoryList(o, categories))).sorted(Comparator.comparing(ComponentVO::getSort))
.collect(Collectors.toList());
}