|
@@ -160,12 +160,19 @@ public class MonitorTargetServiceImpl extends ServiceImpl<MonitorTargetMapper, M
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public TargetStatus getTargetCount() {
|
|
|
- long count = this.count();
|
|
|
+ public TargetStatus getTargetCount(String name) {
|
|
|
+ LambdaQueryWrapper<MonitorTarget> countQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
LambdaQueryWrapper<MonitorTarget> onlineQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ LambdaQueryWrapper<MonitorTarget> offlineQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ if (ObjectUtil.isNotNull(name)) {
|
|
|
+ countQueryWrapper.eq(MonitorTarget::getName, name);
|
|
|
+ onlineQueryWrapper.eq(MonitorTarget::getName, name);
|
|
|
+ offlineQueryWrapper.eq(MonitorTarget::getName, name);
|
|
|
+ }
|
|
|
+
|
|
|
+ long count = this.count(countQueryWrapper);
|
|
|
onlineQueryWrapper.eq(MonitorTarget::getStatus, MonitorStatusEnum.ONLINE.getCode());
|
|
|
long monitorTargetListOnline = count(onlineQueryWrapper);
|
|
|
- LambdaQueryWrapper<MonitorTarget> offlineQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
offlineQueryWrapper.eq(MonitorTarget::getStatus, MonitorStatusEnum.OFF.getCode());
|
|
|
long monitorTargetListOffline = count(offlineQueryWrapper);
|
|
|
return new TargetStatus(count, monitorTargetListOnline, monitorTargetListOffline);
|