组件管理加排序

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

View File

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