开发监控看板组管理CRUD
设计告警阈值配置功能
This commit is contained in:
+92
@@ -0,0 +1,92 @@
|
||||
package com.tongran.rocketmq.controller;
|
||||
|
||||
import com.tongran.common.core.web.controller.BaseController;
|
||||
import com.tongran.common.core.web.domain.AjaxResult;
|
||||
import com.tongran.common.log.annotation.Log;
|
||||
import com.tongran.common.log.enums.BusinessType;
|
||||
import com.tongran.common.security.annotation.RequiresPermissions;
|
||||
import com.tongran.rocketmq.domain.RmAlarmThreshold;
|
||||
import com.tongran.rocketmq.service.IRmAlarmThresholdService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 告警阈值配置Controller
|
||||
*
|
||||
* @author tongran
|
||||
* @date 2026-01-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/rmAlarmThreshold")
|
||||
@RequiresPermissions("rocketmq:alarmLog")
|
||||
public class RmAlarmThresholdController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IRmAlarmThresholdService rmAlarmThresholdService;
|
||||
|
||||
/**
|
||||
* 查询告警阈值配置列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list()
|
||||
{
|
||||
List<RmAlarmThreshold> list = rmAlarmThresholdService.selectRmAlarmThresholdList(new RmAlarmThreshold());
|
||||
return success(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取告警阈值配置详细信息
|
||||
*/
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(rmAlarmThresholdService.selectRmAlarmThresholdById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增告警阈值配置
|
||||
*/
|
||||
@Log(title = "告警阈值配置", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody RmAlarmThreshold rmAlarmThreshold)
|
||||
{
|
||||
int rows = rmAlarmThresholdService.insertRmAlarmThreshold(rmAlarmThreshold);
|
||||
if(rows == -1){
|
||||
AjaxResult ajaxResult = new AjaxResult();
|
||||
ajaxResult.put(AjaxResult.CODE_TAG, 500);
|
||||
ajaxResult.put(AjaxResult.MSG_TAG, "【告警类别】和【条件项】合起来不能重复");
|
||||
return ajaxResult;
|
||||
}
|
||||
return toAjax(rows);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改告警阈值配置
|
||||
*/
|
||||
@Log(title = "告警阈值配置", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody RmAlarmThreshold rmAlarmThreshold)
|
||||
{
|
||||
int rows = rmAlarmThresholdService.updateRmAlarmThreshold(rmAlarmThreshold);
|
||||
if(rows == -1){
|
||||
AjaxResult ajaxResult = new AjaxResult();
|
||||
ajaxResult.put(AjaxResult.CODE_TAG, 500);
|
||||
ajaxResult.put(AjaxResult.MSG_TAG, "【告警类别】和【条件项】合起来不能重复");
|
||||
return ajaxResult;
|
||||
}
|
||||
return toAjax(rows);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除告警阈值配置
|
||||
*/
|
||||
@Log(title = "告警阈值配置", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(rmAlarmThresholdService.deleteRmAlarmThresholdByIds(ids));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user