[alerter,manage] 告警相关接口调整
This commit is contained in:
@@ -14,6 +14,7 @@ import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@@ -82,6 +83,15 @@ public class MonitorsController {
|
||||
return ResponseEntity.ok(message);
|
||||
}
|
||||
|
||||
@GetMapping(path = "/{app}")
|
||||
@ApiOperation(value = "查询指定监控类型的监控列表", notes = "根据查询过滤指定监控类型的所有获取监控信息列表")
|
||||
public ResponseEntity<Message<List<Monitor>>> getAppMonitors(
|
||||
@ApiParam(value = "监控类型", example = "linux") @PathVariable(required = false) String app) {
|
||||
List<Monitor> monitors = monitorService.getAppMonitors(app);
|
||||
Message<List<Monitor>> message = new Message<>(monitors);
|
||||
return ResponseEntity.ok(message);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@ApiOperation(value = "批量删除监控", notes = "根据监控ID列表批量删除监控项")
|
||||
public ResponseEntity<Message<Void>> deleteMonitors(
|
||||
|
||||
@@ -25,12 +25,19 @@ public interface MonitorDao extends JpaRepository<Monitor, Long>, JpaSpecificati
|
||||
void deleteAllByIdIn(Set<Long> monitorIds);
|
||||
|
||||
/**
|
||||
* 根据监控ID列表查询监控
|
||||
* 根据监控ID列表查询监控
|
||||
* @param monitorIds 监控ID列表
|
||||
* @return 监控列表
|
||||
*/
|
||||
List<Monitor> findMonitorsByIdIn(Set<Long> monitorIds);
|
||||
|
||||
/**
|
||||
* 根据监控类型查询监控
|
||||
* @param app 监控类型
|
||||
* @return 监控列表
|
||||
*/
|
||||
List<Monitor> findMonitorsByAppEquals(String app);
|
||||
|
||||
/**
|
||||
* 查询监控类别及其对应的监控数量
|
||||
* @return 监控类别与监控数量映射
|
||||
|
||||
@@ -114,4 +114,11 @@ public interface MonitorService {
|
||||
* @param status 监控状态
|
||||
*/
|
||||
void updateMonitorStatus(Long monitorId, byte status);
|
||||
|
||||
/**
|
||||
* 查询指定监控类型下的所有监控信息列表
|
||||
* @param app 监控类型
|
||||
* @return 监控列表
|
||||
*/
|
||||
List<Monitor> getAppMonitors(String app);
|
||||
}
|
||||
|
||||
@@ -345,4 +345,9 @@ public class MonitorServiceImpl implements MonitorService {
|
||||
public void updateMonitorStatus(Long monitorId, byte status) {
|
||||
monitorDao.updateMonitorStatus(monitorId, status);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Monitor> getAppMonitors(String app) {
|
||||
return monitorDao.findMonitorsByAppEquals(app);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user