增加两个批量查询接口

This commit is contained in:
2025-11-16 16:30:26 +08:00
parent bf747e22ce
commit bf1600b385
10 changed files with 1041 additions and 11 deletions

View File

@@ -146,6 +146,126 @@ const docTemplate = `{
}
},
"/api/v1/alarm/threshold/area": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "根据过滤条件和分页参数查询区域阈值告警列表",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"告警管理"
],
"summary": "批量查询区域阈值告警",
"parameters": [
{
"type": "integer",
"description": "按区域主控ID过滤",
"name": "area_controller_id",
"in": "query"
},
{
"enum": [
"Debug",
"Info",
"Warn",
"Error",
"DPanic",
"Panic",
"Fatal"
],
"type": "string",
"x-enum-varnames": [
"DebugLevel",
"InfoLevel",
"WarnLevel",
"ErrorLevel",
"DPanicLevel",
"PanicLevel",
"FatalLevel"
],
"description": "按告警等级过滤",
"name": "level",
"in": "query"
},
{
"type": "string",
"description": "排序字段,例如 \"id DESC\"",
"name": "order_by",
"in": "query"
},
{
"type": "integer",
"name": "page",
"in": "query"
},
{
"type": "integer",
"name": "page_size",
"in": "query"
},
{
"enum": [
"信号强度",
"电池电量",
"温度",
"湿度",
"重量"
],
"type": "string",
"x-enum-comments": {
"SensorTypeBatteryLevel": "电池电量",
"SensorTypeHumidity": "湿度",
"SensorTypeSignalMetrics": "信号强度",
"SensorTypeTemperature": "温度",
"SensorTypeWeight": "重量"
},
"x-enum-descriptions": [
"信号强度",
"电池电量",
"温度",
"湿度",
"重量"
],
"x-enum-varnames": [
"SensorTypeSignalMetrics",
"SensorTypeBatteryLevel",
"SensorTypeTemperature",
"SensorTypeHumidity",
"SensorTypeWeight"
],
"description": "按传感器类型过滤",
"name": "sensor_type",
"in": "query"
}
],
"responses": {
"200": {
"description": "成功获取区域阈值告警列表",
"schema": {
"allOf": [
{
"$ref": "#/definitions/controller.Response"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/dto.ListAreaThresholdAlarmResponse"
}
}
}
]
}
}
}
},
"post": {
"security": [
{
@@ -307,6 +427,126 @@ const docTemplate = `{
}
},
"/api/v1/alarm/threshold/device": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "根据过滤条件和分页参数查询设备阈值告警列表",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"告警管理"
],
"summary": "批量查询设备阈值告警",
"parameters": [
{
"type": "integer",
"description": "按设备ID过滤",
"name": "device_id",
"in": "query"
},
{
"enum": [
"Debug",
"Info",
"Warn",
"Error",
"DPanic",
"Panic",
"Fatal"
],
"type": "string",
"x-enum-varnames": [
"DebugLevel",
"InfoLevel",
"WarnLevel",
"ErrorLevel",
"DPanicLevel",
"PanicLevel",
"FatalLevel"
],
"description": "按告警等级过滤",
"name": "level",
"in": "query"
},
{
"type": "string",
"description": "排序字段,例如 \"id DESC\"",
"name": "order_by",
"in": "query"
},
{
"type": "integer",
"name": "page",
"in": "query"
},
{
"type": "integer",
"name": "page_size",
"in": "query"
},
{
"enum": [
"信号强度",
"电池电量",
"温度",
"湿度",
"重量"
],
"type": "string",
"x-enum-comments": {
"SensorTypeBatteryLevel": "电池电量",
"SensorTypeHumidity": "湿度",
"SensorTypeSignalMetrics": "信号强度",
"SensorTypeTemperature": "温度",
"SensorTypeWeight": "重量"
},
"x-enum-descriptions": [
"信号强度",
"电池电量",
"温度",
"湿度",
"重量"
],
"x-enum-varnames": [
"SensorTypeSignalMetrics",
"SensorTypeBatteryLevel",
"SensorTypeTemperature",
"SensorTypeHumidity",
"SensorTypeWeight"
],
"description": "按传感器类型过滤",
"name": "sensor_type",
"in": "query"
}
],
"responses": {
"200": {
"description": "成功获取设备阈值告警列表",
"schema": {
"allOf": [
{
"$ref": "#/definitions/controller.Response"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/dto.ListDeviceThresholdAlarmResponse"
}
}
}
]
}
}
}
},
"post": {
"security": [
{
@@ -5454,15 +5694,15 @@ const docTemplate = `{
"alarm_code": {
"$ref": "#/definitions/models.AlarmCode"
},
"alarm_details": {
"type": "string"
},
"alarm_summary": {
"type": "string"
},
"id": {
"type": "integer"
},
"json_details": {
"type": "string"
},
"level": {
"$ref": "#/definitions/models.SeverityLevel"
},
@@ -5500,6 +5740,20 @@ const docTemplate = `{
}
}
},
"dto.ListAreaThresholdAlarmResponse": {
"type": "object",
"properties": {
"list": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.AreaThresholdAlarmDTO"
}
},
"pagination": {
"$ref": "#/definitions/dto.PaginationDTO"
}
}
},
"dto.ListDeviceCommandLogResponse": {
"type": "object",
"properties": {
@@ -5514,6 +5768,20 @@ const docTemplate = `{
}
}
},
"dto.ListDeviceThresholdAlarmResponse": {
"type": "object",
"properties": {
"list": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.DeviceThresholdAlarmDTO"
}
},
"pagination": {
"$ref": "#/definitions/dto.PaginationDTO"
}
}
},
"dto.ListFeedUsageRecordResponse": {
"type": "object",
"properties": {

View File

@@ -138,6 +138,126 @@
}
},
"/api/v1/alarm/threshold/area": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "根据过滤条件和分页参数查询区域阈值告警列表",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"告警管理"
],
"summary": "批量查询区域阈值告警",
"parameters": [
{
"type": "integer",
"description": "按区域主控ID过滤",
"name": "area_controller_id",
"in": "query"
},
{
"enum": [
"Debug",
"Info",
"Warn",
"Error",
"DPanic",
"Panic",
"Fatal"
],
"type": "string",
"x-enum-varnames": [
"DebugLevel",
"InfoLevel",
"WarnLevel",
"ErrorLevel",
"DPanicLevel",
"PanicLevel",
"FatalLevel"
],
"description": "按告警等级过滤",
"name": "level",
"in": "query"
},
{
"type": "string",
"description": "排序字段,例如 \"id DESC\"",
"name": "order_by",
"in": "query"
},
{
"type": "integer",
"name": "page",
"in": "query"
},
{
"type": "integer",
"name": "page_size",
"in": "query"
},
{
"enum": [
"信号强度",
"电池电量",
"温度",
"湿度",
"重量"
],
"type": "string",
"x-enum-comments": {
"SensorTypeBatteryLevel": "电池电量",
"SensorTypeHumidity": "湿度",
"SensorTypeSignalMetrics": "信号强度",
"SensorTypeTemperature": "温度",
"SensorTypeWeight": "重量"
},
"x-enum-descriptions": [
"信号强度",
"电池电量",
"温度",
"湿度",
"重量"
],
"x-enum-varnames": [
"SensorTypeSignalMetrics",
"SensorTypeBatteryLevel",
"SensorTypeTemperature",
"SensorTypeHumidity",
"SensorTypeWeight"
],
"description": "按传感器类型过滤",
"name": "sensor_type",
"in": "query"
}
],
"responses": {
"200": {
"description": "成功获取区域阈值告警列表",
"schema": {
"allOf": [
{
"$ref": "#/definitions/controller.Response"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/dto.ListAreaThresholdAlarmResponse"
}
}
}
]
}
}
}
},
"post": {
"security": [
{
@@ -299,6 +419,126 @@
}
},
"/api/v1/alarm/threshold/device": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "根据过滤条件和分页参数查询设备阈值告警列表",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"告警管理"
],
"summary": "批量查询设备阈值告警",
"parameters": [
{
"type": "integer",
"description": "按设备ID过滤",
"name": "device_id",
"in": "query"
},
{
"enum": [
"Debug",
"Info",
"Warn",
"Error",
"DPanic",
"Panic",
"Fatal"
],
"type": "string",
"x-enum-varnames": [
"DebugLevel",
"InfoLevel",
"WarnLevel",
"ErrorLevel",
"DPanicLevel",
"PanicLevel",
"FatalLevel"
],
"description": "按告警等级过滤",
"name": "level",
"in": "query"
},
{
"type": "string",
"description": "排序字段,例如 \"id DESC\"",
"name": "order_by",
"in": "query"
},
{
"type": "integer",
"name": "page",
"in": "query"
},
{
"type": "integer",
"name": "page_size",
"in": "query"
},
{
"enum": [
"信号强度",
"电池电量",
"温度",
"湿度",
"重量"
],
"type": "string",
"x-enum-comments": {
"SensorTypeBatteryLevel": "电池电量",
"SensorTypeHumidity": "湿度",
"SensorTypeSignalMetrics": "信号强度",
"SensorTypeTemperature": "温度",
"SensorTypeWeight": "重量"
},
"x-enum-descriptions": [
"信号强度",
"电池电量",
"温度",
"湿度",
"重量"
],
"x-enum-varnames": [
"SensorTypeSignalMetrics",
"SensorTypeBatteryLevel",
"SensorTypeTemperature",
"SensorTypeHumidity",
"SensorTypeWeight"
],
"description": "按传感器类型过滤",
"name": "sensor_type",
"in": "query"
}
],
"responses": {
"200": {
"description": "成功获取设备阈值告警列表",
"schema": {
"allOf": [
{
"$ref": "#/definitions/controller.Response"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/dto.ListDeviceThresholdAlarmResponse"
}
}
}
]
}
}
}
},
"post": {
"security": [
{
@@ -5446,15 +5686,15 @@
"alarm_code": {
"$ref": "#/definitions/models.AlarmCode"
},
"alarm_details": {
"type": "string"
},
"alarm_summary": {
"type": "string"
},
"id": {
"type": "integer"
},
"json_details": {
"type": "string"
},
"level": {
"$ref": "#/definitions/models.SeverityLevel"
},
@@ -5492,6 +5732,20 @@
}
}
},
"dto.ListAreaThresholdAlarmResponse": {
"type": "object",
"properties": {
"list": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.AreaThresholdAlarmDTO"
}
},
"pagination": {
"$ref": "#/definitions/dto.PaginationDTO"
}
}
},
"dto.ListDeviceCommandLogResponse": {
"type": "object",
"properties": {
@@ -5506,6 +5760,20 @@
}
}
},
"dto.ListDeviceThresholdAlarmResponse": {
"type": "object",
"properties": {
"list": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.DeviceThresholdAlarmDTO"
}
},
"pagination": {
"$ref": "#/definitions/dto.PaginationDTO"
}
}
},
"dto.ListFeedUsageRecordResponse": {
"type": "object",
"properties": {

View File

@@ -464,12 +464,12 @@ definitions:
properties:
alarm_code:
$ref: '#/definitions/models.AlarmCode'
alarm_details:
type: string
alarm_summary:
type: string
id:
type: integer
json_details:
type: string
level:
$ref: '#/definitions/models.SeverityLevel'
resolve_method:
@@ -494,6 +494,15 @@ definitions:
pagination:
$ref: '#/definitions/dto.PaginationDTO'
type: object
dto.ListAreaThresholdAlarmResponse:
properties:
list:
items:
$ref: '#/definitions/dto.AreaThresholdAlarmDTO'
type: array
pagination:
$ref: '#/definitions/dto.PaginationDTO'
type: object
dto.ListDeviceCommandLogResponse:
properties:
list:
@@ -503,6 +512,15 @@ definitions:
pagination:
$ref: '#/definitions/dto.PaginationDTO'
type: object
dto.ListDeviceThresholdAlarmResponse:
properties:
list:
items:
$ref: '#/definitions/dto.DeviceThresholdAlarmDTO'
type: array
pagination:
$ref: '#/definitions/dto.PaginationDTO'
type: object
dto.ListFeedUsageRecordResponse:
properties:
list:
@@ -2401,6 +2419,90 @@ paths:
tags:
- 告警管理
/api/v1/alarm/threshold/area:
get:
consumes:
- application/json
description: 根据过滤条件和分页参数查询区域阈值告警列表
parameters:
- description: 按区域主控ID过滤
in: query
name: area_controller_id
type: integer
- description: 按告警等级过滤
enum:
- Debug
- Info
- Warn
- Error
- DPanic
- Panic
- Fatal
in: query
name: level
type: string
x-enum-varnames:
- DebugLevel
- InfoLevel
- WarnLevel
- ErrorLevel
- DPanicLevel
- PanicLevel
- FatalLevel
- description: 排序字段,例如 "id DESC"
in: query
name: order_by
type: string
- in: query
name: page
type: integer
- in: query
name: page_size
type: integer
- description: 按传感器类型过滤
enum:
- 信号强度
- 电池电量
- 温度
- 湿度
- 重量
in: query
name: sensor_type
type: string
x-enum-comments:
SensorTypeBatteryLevel: 电池电量
SensorTypeHumidity: 湿度
SensorTypeSignalMetrics: 信号强度
SensorTypeTemperature: 温度
SensorTypeWeight: 重量
x-enum-descriptions:
- 信号强度
- 电池电量
- 温度
- 湿度
- 重量
x-enum-varnames:
- SensorTypeSignalMetrics
- SensorTypeBatteryLevel
- SensorTypeTemperature
- SensorTypeHumidity
- SensorTypeWeight
produces:
- application/json
responses:
"200":
description: 成功获取区域阈值告警列表
schema:
allOf:
- $ref: '#/definitions/controller.Response'
- properties:
data:
$ref: '#/definitions/dto.ListAreaThresholdAlarmResponse'
type: object
security:
- BearerAuth: []
summary: 批量查询区域阈值告警
tags:
- 告警管理
post:
consumes:
- application/json
@@ -2499,6 +2601,90 @@ paths:
tags:
- 告警管理
/api/v1/alarm/threshold/device:
get:
consumes:
- application/json
description: 根据过滤条件和分页参数查询设备阈值告警列表
parameters:
- description: 按设备ID过滤
in: query
name: device_id
type: integer
- description: 按告警等级过滤
enum:
- Debug
- Info
- Warn
- Error
- DPanic
- Panic
- Fatal
in: query
name: level
type: string
x-enum-varnames:
- DebugLevel
- InfoLevel
- WarnLevel
- ErrorLevel
- DPanicLevel
- PanicLevel
- FatalLevel
- description: 排序字段,例如 "id DESC"
in: query
name: order_by
type: string
- in: query
name: page
type: integer
- in: query
name: page_size
type: integer
- description: 按传感器类型过滤
enum:
- 信号强度
- 电池电量
- 温度
- 湿度
- 重量
in: query
name: sensor_type
type: string
x-enum-comments:
SensorTypeBatteryLevel: 电池电量
SensorTypeHumidity: 湿度
SensorTypeSignalMetrics: 信号强度
SensorTypeTemperature: 温度
SensorTypeWeight: 重量
x-enum-descriptions:
- 信号强度
- 电池电量
- 温度
- 湿度
- 重量
x-enum-varnames:
- SensorTypeSignalMetrics
- SensorTypeBatteryLevel
- SensorTypeTemperature
- SensorTypeHumidity
- SensorTypeWeight
produces:
- application/json
responses:
"200":
description: 成功获取设备阈值告警列表
schema:
allOf:
- $ref: '#/definitions/controller.Response'
- properties:
data:
$ref: '#/definitions/dto.ListDeviceThresholdAlarmResponse'
type: object
security:
- BearerAuth: []
summary: 批量查询设备阈值告警
tags:
- 告警管理
post:
consumes:
- application/json