2813 lines
96 KiB
JSON
2813 lines
96 KiB
JSON
{
|
||
"swagger": "2.0",
|
||
"info": {
|
||
"contact": {}
|
||
},
|
||
"paths": {
|
||
"/api/v1/area-controllers": {
|
||
"get": {
|
||
"description": "获取系统中所有区域主控的列表",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"区域主控管理"
|
||
],
|
||
"summary": "获取所有区域主控列表",
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/controller.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/definitions/dto.AreaControllerResponse"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"post": {
|
||
"description": "根据提供的信息创建一个新区域主控",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"区域主控管理"
|
||
],
|
||
"summary": "创建新区域主控",
|
||
"parameters": [
|
||
{
|
||
"description": "区域主控信息",
|
||
"name": "areaController",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/dto.CreateAreaControllerRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/controller.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/dto.AreaControllerResponse"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/area-controllers/{id}": {
|
||
"get": {
|
||
"description": "根据ID获取单个区域主控的详细信息",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"区域主控管理"
|
||
],
|
||
"summary": "获取区域主控信息",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "区域主控ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/controller.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/dto.AreaControllerResponse"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"put": {
|
||
"description": "根据ID更新一个已存在的区域主控信息",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"区域主控管理"
|
||
],
|
||
"summary": "更新区域主控信息",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "区域主控ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
},
|
||
{
|
||
"description": "要更新的区域主控信息",
|
||
"name": "areaController",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/dto.UpdateAreaControllerRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/controller.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/dto.AreaControllerResponse"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"delete": {
|
||
"description": "根据ID删除一个区域主控(软删除)",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"区域主控管理"
|
||
],
|
||
"summary": "删除区域主控",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "区域主控ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"$ref": "#/definitions/controller.Response"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/device-templates": {
|
||
"get": {
|
||
"description": "获取系统中所有设备模板的列表",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"设备模板管理"
|
||
],
|
||
"summary": "获取设备模板列表",
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/controller.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/definitions/dto.DeviceTemplateResponse"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"post": {
|
||
"description": "根据提供的信息创建一个新设备模板",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"设备模板管理"
|
||
],
|
||
"summary": "创建新设备模板",
|
||
"parameters": [
|
||
{
|
||
"description": "设备模板信息",
|
||
"name": "deviceTemplate",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/dto.CreateDeviceTemplateRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/controller.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/dto.DeviceTemplateResponse"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/device-templates/{id}": {
|
||
"get": {
|
||
"description": "根据设备模板ID获取单个设备模板的详细信息",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"设备模板管理"
|
||
],
|
||
"summary": "获取设备模板信息",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "设备模板ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/controller.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/dto.DeviceTemplateResponse"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"put": {
|
||
"description": "根据设备模板ID更新一个已存在的设备模板信息",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"设备模板管理"
|
||
],
|
||
"summary": "更新设备模板信息",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "设备模板ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
},
|
||
{
|
||
"description": "要更新的设备模板信息",
|
||
"name": "deviceTemplate",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/dto.UpdateDeviceTemplateRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/controller.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/dto.DeviceTemplateResponse"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"delete": {
|
||
"description": "根据设备模板ID删除一个设备模板(软删除)",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"设备模板管理"
|
||
],
|
||
"summary": "删除设备模板",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "设备模板ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"$ref": "#/definitions/controller.Response"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/devices": {
|
||
"get": {
|
||
"description": "获取系统中所有设备的列表",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"设备管理"
|
||
],
|
||
"summary": "获取设备列表",
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/controller.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/definitions/dto.DeviceResponse"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"post": {
|
||
"description": "根据提供的信息创建一个新设备",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"设备管理"
|
||
],
|
||
"summary": "创建新设备",
|
||
"parameters": [
|
||
{
|
||
"description": "设备信息",
|
||
"name": "device",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/dto.CreateDeviceRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/controller.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/dto.DeviceResponse"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/devices/{id}": {
|
||
"get": {
|
||
"description": "根据设备ID获取单个设备的详细信息",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"设备管理"
|
||
],
|
||
"summary": "获取设备信息",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "设备ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/controller.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/dto.DeviceResponse"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"put": {
|
||
"description": "根据设备ID更新一个已存在的设备信息",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"设备管理"
|
||
],
|
||
"summary": "更新设备信息",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "设备ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
},
|
||
{
|
||
"description": "要更新的设备信息",
|
||
"name": "device",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/dto.UpdateDeviceRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/controller.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/dto.DeviceResponse"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"delete": {
|
||
"description": "根据设备ID删除一个设备(软删除)",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"设备管理"
|
||
],
|
||
"summary": "删除设备",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "设备ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"$ref": "#/definitions/controller.Response"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/pens": {
|
||
"get": {
|
||
"description": "获取所有猪栏的列表",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"猪场管理"
|
||
],
|
||
"summary": "获取猪栏列表",
|
||
"responses": {
|
||
"200": {
|
||
"description": "获取成功",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/controller.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/definitions/dto.PenResponse"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"post": {
|
||
"description": "创建一个新的猪栏",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"猪场管理"
|
||
],
|
||
"summary": "创建猪栏",
|
||
"parameters": [
|
||
{
|
||
"description": "猪栏信息",
|
||
"name": "body",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/dto.CreatePenRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"201": {
|
||
"description": "创建成功",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/controller.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/dto.PenResponse"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/pens/{id}": {
|
||
"get": {
|
||
"description": "根据ID获取单个猪栏信息",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"猪场管理"
|
||
],
|
||
"summary": "获取单个猪栏",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"description": "猪栏ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "获取成功",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/controller.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/dto.PenResponse"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"put": {
|
||
"description": "更新一个已存在的猪栏信息",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"猪场管理"
|
||
],
|
||
"summary": "更新猪栏",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"description": "猪栏ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
},
|
||
{
|
||
"description": "猪栏信息",
|
||
"name": "body",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/dto.UpdatePenRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "更新成功",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/controller.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/dto.PenResponse"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"delete": {
|
||
"description": "根据ID删除一个猪栏",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"猪场管理"
|
||
],
|
||
"summary": "删除猪栏",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"description": "猪栏ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "删除成功",
|
||
"schema": {
|
||
"$ref": "#/definitions/controller.Response"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/pig-batches": {
|
||
"get": {
|
||
"description": "获取所有猪批次的列表,支持按活跃状态筛选",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"猪批次管理"
|
||
],
|
||
"summary": "获取猪批次列表",
|
||
"parameters": [
|
||
{
|
||
"type": "boolean",
|
||
"description": "是否活跃 (true/false)",
|
||
"name": "is_active",
|
||
"in": "query"
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "获取成功",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/controller.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/definitions/dto.PigBatchResponseDTO"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "内部服务器错误",
|
||
"schema": {
|
||
"$ref": "#/definitions/controller.Response"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"post": {
|
||
"description": "创建一个新的猪批次",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"猪批次管理"
|
||
],
|
||
"summary": "创建猪批次",
|
||
"parameters": [
|
||
{
|
||
"description": "猪批次信息",
|
||
"name": "body",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/dto.PigBatchCreateDTO"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"201": {
|
||
"description": "创建成功",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/controller.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/dto.PigBatchResponseDTO"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "请求参数错误",
|
||
"schema": {
|
||
"$ref": "#/definitions/controller.Response"
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "内部服务器错误",
|
||
"schema": {
|
||
"$ref": "#/definitions/controller.Response"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/pig-batches/{id}": {
|
||
"get": {
|
||
"description": "根据ID获取单个猪批次信息",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"猪批次管理"
|
||
],
|
||
"summary": "获取单个猪批次",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"description": "猪批次ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "获取成功",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/controller.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/dto.PigBatchResponseDTO"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "无效的ID格式",
|
||
"schema": {
|
||
"$ref": "#/definitions/controller.Response"
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "猪批次不存在",
|
||
"schema": {
|
||
"$ref": "#/definitions/controller.Response"
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "内部服务器错误",
|
||
"schema": {
|
||
"$ref": "#/definitions/controller.Response"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"put": {
|
||
"description": "更新一个已存在的猪批次信息",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"猪批次管理"
|
||
],
|
||
"summary": "更新猪批次",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"description": "猪批次ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
},
|
||
{
|
||
"description": "猪批次信息",
|
||
"name": "body",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/dto.PigBatchUpdateDTO"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "更新成功",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/controller.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/dto.PigBatchResponseDTO"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "请求参数错误或无效的ID格式",
|
||
"schema": {
|
||
"$ref": "#/definitions/controller.Response"
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "猪批次不存在",
|
||
"schema": {
|
||
"$ref": "#/definitions/controller.Response"
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "内部服务器错误",
|
||
"schema": {
|
||
"$ref": "#/definitions/controller.Response"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"delete": {
|
||
"description": "根据ID删除一个猪批次",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"猪批次管理"
|
||
],
|
||
"summary": "删除猪批次",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"description": "猪批次ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "删除成功",
|
||
"schema": {
|
||
"$ref": "#/definitions/controller.Response"
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "无效的ID格式",
|
||
"schema": {
|
||
"$ref": "#/definitions/controller.Response"
|
||
}
|
||
},
|
||
"404": {
|
||
"description": "猪批次不存在",
|
||
"schema": {
|
||
"$ref": "#/definitions/controller.Response"
|
||
}
|
||
},
|
||
"500": {
|
||
"description": "内部服务器错误",
|
||
"schema": {
|
||
"$ref": "#/definitions/controller.Response"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/pig-houses": {
|
||
"get": {
|
||
"description": "获取所有猪舍的列表",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"猪场管理"
|
||
],
|
||
"summary": "获取猪舍列表",
|
||
"responses": {
|
||
"200": {
|
||
"description": "获取成功",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/controller.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/definitions/dto.PigHouseResponse"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"post": {
|
||
"description": "创建一个新的猪舍",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"猪场管理"
|
||
],
|
||
"summary": "创建猪舍",
|
||
"parameters": [
|
||
{
|
||
"description": "猪舍信息",
|
||
"name": "body",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/dto.CreatePigHouseRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"201": {
|
||
"description": "创建成功",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/controller.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/dto.PigHouseResponse"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/pig-houses/{id}": {
|
||
"get": {
|
||
"description": "根据ID获取单个猪舍信息",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"猪场管理"
|
||
],
|
||
"summary": "获取单个猪舍",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"description": "猪舍ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "获取成功",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/controller.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/dto.PigHouseResponse"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"put": {
|
||
"description": "更新一个已存在的猪舍信息",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"猪场管理"
|
||
],
|
||
"summary": "更新猪舍",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"description": "猪舍ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
},
|
||
{
|
||
"description": "猪舍信息",
|
||
"name": "body",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/dto.UpdatePigHouseRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "更新成功",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/controller.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/dto.PigHouseResponse"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"delete": {
|
||
"description": "根据ID删除一个猪舍",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"猪场管理"
|
||
],
|
||
"summary": "删除猪舍",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"description": "猪舍ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "删除成功",
|
||
"schema": {
|
||
"$ref": "#/definitions/controller.Response"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/plans": {
|
||
"get": {
|
||
"description": "获取所有计划的列表",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"计划管理"
|
||
],
|
||
"summary": "获取计划列表",
|
||
"responses": {
|
||
"200": {
|
||
"description": "业务码为200代表成功获取列表",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/controller.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/definitions/dto.PlanResponse"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"post": {
|
||
"description": "创建一个新的计划,包括其基本信息和所有关联的子计划/任务。",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"计划管理"
|
||
],
|
||
"summary": "创建计划",
|
||
"parameters": [
|
||
{
|
||
"description": "计划信息",
|
||
"name": "plan",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/dto.CreatePlanRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "业务码为201代表创建成功",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/controller.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/dto.PlanResponse"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/plans/{id}": {
|
||
"get": {
|
||
"description": "根据计划ID获取单个计划的详细信息。",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"计划管理"
|
||
],
|
||
"summary": "获取计划详情",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"description": "计划ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "业务码为200代表成功获取",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/controller.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/dto.PlanResponse"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"put": {
|
||
"description": "根据计划ID更新计划的详细信息。",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"计划管理"
|
||
],
|
||
"summary": "更新计划",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"description": "计划ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
},
|
||
{
|
||
"description": "更新后的计划信息",
|
||
"name": "plan",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/dto.UpdatePlanRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "业务码为200代表更新成功",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/controller.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/dto.PlanResponse"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"delete": {
|
||
"description": "根据计划ID删除计划。(软删除)",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"计划管理"
|
||
],
|
||
"summary": "删除计划",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"description": "计划ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "业务码为200代表删除成功",
|
||
"schema": {
|
||
"$ref": "#/definitions/controller.Response"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/plans/{id}/start": {
|
||
"post": {
|
||
"description": "根据计划ID启动一个计划的执行。",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"计划管理"
|
||
],
|
||
"summary": "启动计划",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"description": "计划ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "业务码为200代表成功启动计划",
|
||
"schema": {
|
||
"$ref": "#/definitions/controller.Response"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/plans/{id}/stop": {
|
||
"post": {
|
||
"description": "根据计划ID停止一个正在执行的计划。",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"计划管理"
|
||
],
|
||
"summary": "停止计划",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"description": "计划ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "业务码为200代表成功停止计划",
|
||
"schema": {
|
||
"$ref": "#/definitions/controller.Response"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/users": {
|
||
"post": {
|
||
"description": "根据用户名和密码创建一个新的系统用户。",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"用户管理"
|
||
],
|
||
"summary": "创建新用户",
|
||
"parameters": [
|
||
{
|
||
"description": "用户信息",
|
||
"name": "user",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/dto.CreateUserRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "业务码为201代表创建成功",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/controller.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/dto.CreateUserResponse"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/users/login": {
|
||
"post": {
|
||
"description": "用户可以使用用户名、邮箱、手机号、微信号或飞书账号进行登录,成功后返回 JWT 令牌。",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"用户管理"
|
||
],
|
||
"summary": "用户登录",
|
||
"parameters": [
|
||
{
|
||
"description": "登录凭证",
|
||
"name": "credentials",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/dto.LoginRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "业务码为200代表登录成功",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/controller.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/dto.LoginResponse"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/users/{id}/history": {
|
||
"get": {
|
||
"description": "根据用户ID,分页获取该用户的操作审计日志。",
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"用户管理"
|
||
],
|
||
"summary": "获取指定用户的操作历史",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"description": "用户ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
},
|
||
{
|
||
"type": "integer",
|
||
"default": 1,
|
||
"description": "页码",
|
||
"name": "page",
|
||
"in": "query"
|
||
},
|
||
{
|
||
"type": "integer",
|
||
"default": 10,
|
||
"description": "每页大小",
|
||
"name": "page_size",
|
||
"in": "query"
|
||
},
|
||
{
|
||
"type": "string",
|
||
"description": "按操作类型过滤",
|
||
"name": "action_type",
|
||
"in": "query"
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "业务码为200代表成功获取",
|
||
"schema": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/controller.Response"
|
||
},
|
||
{
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/definitions/dto.ListHistoryResponse"
|
||
}
|
||
}
|
||
}
|
||
]
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"definitions": {
|
||
"controller.Response": {
|
||
"type": "object",
|
||
"properties": {
|
||
"code": {
|
||
"description": "业务状态码",
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/controller.ResponseCode"
|
||
}
|
||
]
|
||
},
|
||
"data": {
|
||
"description": "业务数据"
|
||
},
|
||
"message": {
|
||
"description": "提示信息",
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"controller.ResponseCode": {
|
||
"type": "integer",
|
||
"enum": [
|
||
2000,
|
||
2001,
|
||
4000,
|
||
4001,
|
||
4004,
|
||
4009,
|
||
5000,
|
||
5003
|
||
],
|
||
"x-enum-comments": {
|
||
"CodeBadRequest": "请求参数错误",
|
||
"CodeConflict": "资源冲突",
|
||
"CodeCreated": "创建成功",
|
||
"CodeInternalError": "服务器内部错误",
|
||
"CodeNotFound": "资源未找到",
|
||
"CodeServiceUnavailable": "服务不可用",
|
||
"CodeSuccess": "操作成功",
|
||
"CodeUnauthorized": "未授权"
|
||
},
|
||
"x-enum-descriptions": [
|
||
"操作成功",
|
||
"创建成功",
|
||
"请求参数错误",
|
||
"未授权",
|
||
"资源未找到",
|
||
"资源冲突",
|
||
"服务器内部错误",
|
||
"服务不可用"
|
||
],
|
||
"x-enum-varnames": [
|
||
"CodeSuccess",
|
||
"CodeCreated",
|
||
"CodeBadRequest",
|
||
"CodeUnauthorized",
|
||
"CodeNotFound",
|
||
"CodeConflict",
|
||
"CodeInternalError",
|
||
"CodeServiceUnavailable"
|
||
]
|
||
},
|
||
"dto.AreaControllerResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"created_at": {
|
||
"type": "string"
|
||
},
|
||
"id": {
|
||
"type": "integer"
|
||
},
|
||
"location": {
|
||
"type": "string"
|
||
},
|
||
"name": {
|
||
"type": "string"
|
||
},
|
||
"network_id": {
|
||
"type": "string"
|
||
},
|
||
"properties": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
},
|
||
"status": {
|
||
"type": "string"
|
||
},
|
||
"updated_at": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"dto.CreateAreaControllerRequest": {
|
||
"type": "object",
|
||
"required": [
|
||
"name",
|
||
"network_id"
|
||
],
|
||
"properties": {
|
||
"location": {
|
||
"type": "string"
|
||
},
|
||
"name": {
|
||
"type": "string"
|
||
},
|
||
"network_id": {
|
||
"type": "string"
|
||
},
|
||
"properties": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
}
|
||
},
|
||
"dto.CreateDeviceRequest": {
|
||
"type": "object",
|
||
"required": [
|
||
"area_controller_id",
|
||
"device_template_id",
|
||
"name"
|
||
],
|
||
"properties": {
|
||
"area_controller_id": {
|
||
"type": "integer"
|
||
},
|
||
"device_template_id": {
|
||
"type": "integer"
|
||
},
|
||
"location": {
|
||
"type": "string"
|
||
},
|
||
"name": {
|
||
"type": "string"
|
||
},
|
||
"properties": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
}
|
||
},
|
||
"dto.CreateDeviceTemplateRequest": {
|
||
"type": "object",
|
||
"required": [
|
||
"category",
|
||
"commands",
|
||
"name"
|
||
],
|
||
"properties": {
|
||
"category": {
|
||
"$ref": "#/definitions/models.DeviceCategory"
|
||
},
|
||
"commands": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
},
|
||
"description": {
|
||
"type": "string"
|
||
},
|
||
"manufacturer": {
|
||
"type": "string"
|
||
},
|
||
"name": {
|
||
"type": "string"
|
||
},
|
||
"values": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/definitions/models.ValueDescriptor"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"dto.CreatePenRequest": {
|
||
"type": "object",
|
||
"required": [
|
||
"capacity",
|
||
"house_id",
|
||
"pen_number",
|
||
"status"
|
||
],
|
||
"properties": {
|
||
"capacity": {
|
||
"type": "integer"
|
||
},
|
||
"house_id": {
|
||
"type": "integer"
|
||
},
|
||
"pen_number": {
|
||
"type": "string"
|
||
},
|
||
"status": {
|
||
"$ref": "#/definitions/models.PenStatus"
|
||
}
|
||
}
|
||
},
|
||
"dto.CreatePigHouseRequest": {
|
||
"type": "object",
|
||
"required": [
|
||
"name"
|
||
],
|
||
"properties": {
|
||
"description": {
|
||
"type": "string"
|
||
},
|
||
"name": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"dto.CreatePlanRequest": {
|
||
"type": "object",
|
||
"required": [
|
||
"execution_type",
|
||
"name"
|
||
],
|
||
"properties": {
|
||
"cron_expression": {
|
||
"type": "string",
|
||
"example": "0 0 6 * * *"
|
||
},
|
||
"description": {
|
||
"type": "string",
|
||
"example": "根据温度自动调节风扇和加热器"
|
||
},
|
||
"execute_num": {
|
||
"type": "integer",
|
||
"example": 10
|
||
},
|
||
"execution_type": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/models.PlanExecutionType"
|
||
}
|
||
],
|
||
"example": "自动"
|
||
},
|
||
"name": {
|
||
"type": "string",
|
||
"example": "猪舍温度控制计划"
|
||
},
|
||
"sub_plan_ids": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "integer"
|
||
}
|
||
},
|
||
"tasks": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/definitions/dto.TaskRequest"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"dto.CreateUserRequest": {
|
||
"type": "object",
|
||
"required": [
|
||
"password",
|
||
"username"
|
||
],
|
||
"properties": {
|
||
"password": {
|
||
"type": "string",
|
||
"example": "password123"
|
||
},
|
||
"username": {
|
||
"type": "string",
|
||
"example": "newuser"
|
||
}
|
||
}
|
||
},
|
||
"dto.CreateUserResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "integer",
|
||
"example": 1
|
||
},
|
||
"username": {
|
||
"type": "string",
|
||
"example": "newuser"
|
||
}
|
||
}
|
||
},
|
||
"dto.DeviceResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"area_controller_id": {
|
||
"type": "integer"
|
||
},
|
||
"area_controller_name": {
|
||
"type": "string"
|
||
},
|
||
"created_at": {
|
||
"type": "string"
|
||
},
|
||
"device_template_id": {
|
||
"type": "integer"
|
||
},
|
||
"device_template_name": {
|
||
"type": "string"
|
||
},
|
||
"id": {
|
||
"type": "integer"
|
||
},
|
||
"location": {
|
||
"type": "string"
|
||
},
|
||
"name": {
|
||
"type": "string"
|
||
},
|
||
"properties": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
},
|
||
"updated_at": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"dto.DeviceTemplateResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"category": {
|
||
"$ref": "#/definitions/models.DeviceCategory"
|
||
},
|
||
"commands": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
},
|
||
"created_at": {
|
||
"type": "string"
|
||
},
|
||
"description": {
|
||
"type": "string"
|
||
},
|
||
"id": {
|
||
"type": "integer"
|
||
},
|
||
"manufacturer": {
|
||
"type": "string"
|
||
},
|
||
"name": {
|
||
"type": "string"
|
||
},
|
||
"updated_at": {
|
||
"type": "string"
|
||
},
|
||
"values": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/definitions/models.ValueDescriptor"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"dto.HistoryResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"action_type": {
|
||
"type": "string",
|
||
"example": "更新设备"
|
||
},
|
||
"description": {
|
||
"type": "string",
|
||
"example": "设备更新成功"
|
||
},
|
||
"target_resource": {},
|
||
"time": {
|
||
"type": "string"
|
||
},
|
||
"user_id": {
|
||
"type": "integer",
|
||
"example": 101
|
||
},
|
||
"username": {
|
||
"type": "string",
|
||
"example": "testuser"
|
||
}
|
||
}
|
||
},
|
||
"dto.ListHistoryResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"history": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/definitions/dto.HistoryResponse"
|
||
}
|
||
},
|
||
"total": {
|
||
"type": "integer",
|
||
"example": 100
|
||
}
|
||
}
|
||
},
|
||
"dto.LoginRequest": {
|
||
"type": "object",
|
||
"required": [
|
||
"identifier",
|
||
"password"
|
||
],
|
||
"properties": {
|
||
"identifier": {
|
||
"description": "Identifier 可以是用户名、邮箱、手机号、微信号或飞书账号",
|
||
"type": "string",
|
||
"example": "testuser"
|
||
},
|
||
"password": {
|
||
"type": "string",
|
||
"example": "password123"
|
||
}
|
||
}
|
||
},
|
||
"dto.LoginResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": {
|
||
"type": "integer",
|
||
"example": 1
|
||
},
|
||
"token": {
|
||
"type": "string",
|
||
"example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
|
||
},
|
||
"username": {
|
||
"type": "string",
|
||
"example": "testuser"
|
||
}
|
||
}
|
||
},
|
||
"dto.PenResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"capacity": {
|
||
"type": "integer"
|
||
},
|
||
"house_id": {
|
||
"type": "integer"
|
||
},
|
||
"id": {
|
||
"type": "integer"
|
||
},
|
||
"pen_number": {
|
||
"type": "string"
|
||
},
|
||
"pig_batch_id": {
|
||
"type": "integer"
|
||
},
|
||
"status": {
|
||
"$ref": "#/definitions/models.PenStatus"
|
||
}
|
||
}
|
||
},
|
||
"dto.PigBatchCreateDTO": {
|
||
"type": "object",
|
||
"required": [
|
||
"batch_number",
|
||
"initial_count",
|
||
"origin_type",
|
||
"start_date",
|
||
"status"
|
||
],
|
||
"properties": {
|
||
"batch_number": {
|
||
"description": "批次编号,必填",
|
||
"type": "string"
|
||
},
|
||
"initial_count": {
|
||
"description": "初始数量,必填,最小为1",
|
||
"type": "integer",
|
||
"minimum": 1
|
||
},
|
||
"origin_type": {
|
||
"description": "批次来源,必填",
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/models.PigBatchOriginType"
|
||
}
|
||
]
|
||
},
|
||
"start_date": {
|
||
"description": "批次开始日期,必填",
|
||
"type": "string"
|
||
},
|
||
"status": {
|
||
"description": "批次状态,必填",
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/models.PigBatchStatus"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
},
|
||
"dto.PigBatchResponseDTO": {
|
||
"type": "object",
|
||
"properties": {
|
||
"batch_number": {
|
||
"description": "批次编号",
|
||
"type": "string"
|
||
},
|
||
"create_time": {
|
||
"description": "创建时间",
|
||
"type": "string"
|
||
},
|
||
"end_date": {
|
||
"description": "批次结束日期",
|
||
"type": "string"
|
||
},
|
||
"id": {
|
||
"description": "批次ID",
|
||
"type": "integer"
|
||
},
|
||
"initial_count": {
|
||
"description": "初始数量",
|
||
"type": "integer"
|
||
},
|
||
"is_active": {
|
||
"description": "是否活跃",
|
||
"type": "boolean"
|
||
},
|
||
"origin_type": {
|
||
"description": "批次来源",
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/models.PigBatchOriginType"
|
||
}
|
||
]
|
||
},
|
||
"start_date": {
|
||
"description": "批次开始日期",
|
||
"type": "string"
|
||
},
|
||
"status": {
|
||
"description": "批次状态",
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/models.PigBatchStatus"
|
||
}
|
||
]
|
||
},
|
||
"update_time": {
|
||
"description": "更新时间",
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"dto.PigBatchUpdateDTO": {
|
||
"type": "object",
|
||
"properties": {
|
||
"batch_number": {
|
||
"description": "批次编号,可选",
|
||
"type": "string"
|
||
},
|
||
"end_date": {
|
||
"description": "批次结束日期,可选",
|
||
"type": "string"
|
||
},
|
||
"initial_count": {
|
||
"description": "初始数量,可选",
|
||
"type": "integer"
|
||
},
|
||
"origin_type": {
|
||
"description": "批次来源,可选",
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/models.PigBatchOriginType"
|
||
}
|
||
]
|
||
},
|
||
"start_date": {
|
||
"description": "批次开始日期,可选",
|
||
"type": "string"
|
||
},
|
||
"status": {
|
||
"description": "批次状态,可选",
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/models.PigBatchStatus"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
},
|
||
"dto.PigHouseResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"description": {
|
||
"type": "string"
|
||
},
|
||
"id": {
|
||
"type": "integer"
|
||
},
|
||
"name": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"dto.PlanResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"content_type": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/models.PlanContentType"
|
||
}
|
||
],
|
||
"example": "任务"
|
||
},
|
||
"cron_expression": {
|
||
"type": "string",
|
||
"example": "0 0 6 * * *"
|
||
},
|
||
"description": {
|
||
"type": "string",
|
||
"example": "根据温度自动调节风扇和加热器"
|
||
},
|
||
"execute_count": {
|
||
"type": "integer",
|
||
"example": 0
|
||
},
|
||
"execute_num": {
|
||
"type": "integer",
|
||
"example": 10
|
||
},
|
||
"execution_type": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/models.PlanExecutionType"
|
||
}
|
||
],
|
||
"example": "自动"
|
||
},
|
||
"id": {
|
||
"type": "integer",
|
||
"example": 1
|
||
},
|
||
"name": {
|
||
"type": "string",
|
||
"example": "猪舍温度控制计划"
|
||
},
|
||
"status": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/models.PlanStatus"
|
||
}
|
||
],
|
||
"example": "已启用"
|
||
},
|
||
"sub_plans": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/definitions/dto.SubPlanResponse"
|
||
}
|
||
},
|
||
"tasks": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/definitions/dto.TaskResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"dto.SubPlanResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"child_plan": {
|
||
"$ref": "#/definitions/dto.PlanResponse"
|
||
},
|
||
"child_plan_id": {
|
||
"type": "integer",
|
||
"example": 2
|
||
},
|
||
"execution_order": {
|
||
"type": "integer",
|
||
"example": 1
|
||
},
|
||
"id": {
|
||
"type": "integer",
|
||
"example": 1
|
||
},
|
||
"parent_plan_id": {
|
||
"type": "integer",
|
||
"example": 1
|
||
}
|
||
}
|
||
},
|
||
"dto.TaskRequest": {
|
||
"type": "object",
|
||
"properties": {
|
||
"description": {
|
||
"type": "string",
|
||
"example": "打开1号风扇"
|
||
},
|
||
"execution_order": {
|
||
"type": "integer",
|
||
"example": 1
|
||
},
|
||
"name": {
|
||
"type": "string",
|
||
"example": "打开风扇"
|
||
},
|
||
"parameters": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
},
|
||
"type": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/models.TaskType"
|
||
}
|
||
],
|
||
"example": "等待"
|
||
}
|
||
}
|
||
},
|
||
"dto.TaskResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"description": {
|
||
"type": "string",
|
||
"example": "打开1号风扇"
|
||
},
|
||
"execution_order": {
|
||
"type": "integer",
|
||
"example": 1
|
||
},
|
||
"id": {
|
||
"type": "integer",
|
||
"example": 1
|
||
},
|
||
"name": {
|
||
"type": "string",
|
||
"example": "打开风扇"
|
||
},
|
||
"parameters": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
},
|
||
"plan_id": {
|
||
"type": "integer",
|
||
"example": 1
|
||
},
|
||
"type": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/models.TaskType"
|
||
}
|
||
],
|
||
"example": "等待"
|
||
}
|
||
}
|
||
},
|
||
"dto.UpdateAreaControllerRequest": {
|
||
"type": "object",
|
||
"required": [
|
||
"name",
|
||
"network_id"
|
||
],
|
||
"properties": {
|
||
"location": {
|
||
"type": "string"
|
||
},
|
||
"name": {
|
||
"type": "string"
|
||
},
|
||
"network_id": {
|
||
"type": "string"
|
||
},
|
||
"properties": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
}
|
||
},
|
||
"dto.UpdateDeviceRequest": {
|
||
"type": "object",
|
||
"required": [
|
||
"area_controller_id",
|
||
"device_template_id",
|
||
"name"
|
||
],
|
||
"properties": {
|
||
"area_controller_id": {
|
||
"type": "integer"
|
||
},
|
||
"device_template_id": {
|
||
"type": "integer"
|
||
},
|
||
"location": {
|
||
"type": "string"
|
||
},
|
||
"name": {
|
||
"type": "string"
|
||
},
|
||
"properties": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
}
|
||
},
|
||
"dto.UpdateDeviceTemplateRequest": {
|
||
"type": "object",
|
||
"required": [
|
||
"category",
|
||
"commands",
|
||
"name"
|
||
],
|
||
"properties": {
|
||
"category": {
|
||
"$ref": "#/definitions/models.DeviceCategory"
|
||
},
|
||
"commands": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
},
|
||
"description": {
|
||
"type": "string"
|
||
},
|
||
"manufacturer": {
|
||
"type": "string"
|
||
},
|
||
"name": {
|
||
"type": "string"
|
||
},
|
||
"values": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/definitions/models.ValueDescriptor"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"dto.UpdatePenRequest": {
|
||
"type": "object",
|
||
"required": [
|
||
"capacity",
|
||
"house_id",
|
||
"pen_number",
|
||
"status"
|
||
],
|
||
"properties": {
|
||
"capacity": {
|
||
"type": "integer"
|
||
},
|
||
"house_id": {
|
||
"type": "integer"
|
||
},
|
||
"pen_number": {
|
||
"type": "string"
|
||
},
|
||
"status": {
|
||
"$ref": "#/definitions/models.PenStatus"
|
||
}
|
||
}
|
||
},
|
||
"dto.UpdatePigHouseRequest": {
|
||
"type": "object",
|
||
"required": [
|
||
"name"
|
||
],
|
||
"properties": {
|
||
"description": {
|
||
"type": "string"
|
||
},
|
||
"name": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"dto.UpdatePlanRequest": {
|
||
"type": "object",
|
||
"required": [
|
||
"execution_type"
|
||
],
|
||
"properties": {
|
||
"cron_expression": {
|
||
"type": "string",
|
||
"example": "0 0 6 * * *"
|
||
},
|
||
"description": {
|
||
"type": "string",
|
||
"example": "更新后的描述"
|
||
},
|
||
"execute_num": {
|
||
"type": "integer",
|
||
"example": 10
|
||
},
|
||
"execution_type": {
|
||
"allOf": [
|
||
{
|
||
"$ref": "#/definitions/models.PlanExecutionType"
|
||
}
|
||
],
|
||
"example": "自动"
|
||
},
|
||
"name": {
|
||
"type": "string",
|
||
"example": "猪舍温度控制计划V2"
|
||
},
|
||
"sub_plan_ids": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "integer"
|
||
}
|
||
},
|
||
"tasks": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/definitions/dto.TaskRequest"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"models.DeviceCategory": {
|
||
"type": "string",
|
||
"enum": [
|
||
"执行器",
|
||
"传感器"
|
||
],
|
||
"x-enum-varnames": [
|
||
"CategoryActuator",
|
||
"CategorySensor"
|
||
]
|
||
},
|
||
"models.PenStatus": {
|
||
"type": "string",
|
||
"enum": [
|
||
"空闲",
|
||
"占用",
|
||
"病猪栏",
|
||
"康复栏",
|
||
"清洗消毒",
|
||
"维修中"
|
||
],
|
||
"x-enum-varnames": [
|
||
"PenStatusEmpty",
|
||
"PenStatusOccupied",
|
||
"PenStatusSickPen",
|
||
"PenStatusRecovering",
|
||
"PenStatusCleaning",
|
||
"PenStatusUnderMaint"
|
||
]
|
||
},
|
||
"models.PigBatchOriginType": {
|
||
"type": "string",
|
||
"enum": [
|
||
"自繁",
|
||
"外购"
|
||
],
|
||
"x-enum-varnames": [
|
||
"OriginTypeSelfFarrowed",
|
||
"OriginTypePurchased"
|
||
]
|
||
},
|
||
"models.PigBatchStatus": {
|
||
"type": "string",
|
||
"enum": [
|
||
"保育",
|
||
"生长",
|
||
"育肥",
|
||
"待售",
|
||
"已出售",
|
||
"已归档"
|
||
],
|
||
"x-enum-comments": {
|
||
"BatchStatusArchived": "批次结束(如全群淘汰等)",
|
||
"BatchStatusFinishing": "最后的育肥阶段",
|
||
"BatchStatusForSale": "达到出栏标准",
|
||
"BatchStatusGrowing": "生长育肥阶段",
|
||
"BatchStatusWeaning": "从断奶到保育结束"
|
||
},
|
||
"x-enum-descriptions": [
|
||
"从断奶到保育结束",
|
||
"生长育肥阶段",
|
||
"最后的育肥阶段",
|
||
"达到出栏标准",
|
||
"",
|
||
"批次结束(如全群淘汰等)"
|
||
],
|
||
"x-enum-varnames": [
|
||
"BatchStatusWeaning",
|
||
"BatchStatusGrowing",
|
||
"BatchStatusFinishing",
|
||
"BatchStatusForSale",
|
||
"BatchStatusSold",
|
||
"BatchStatusArchived"
|
||
]
|
||
},
|
||
"models.PlanContentType": {
|
||
"type": "string",
|
||
"enum": [
|
||
"子计划",
|
||
"任务"
|
||
],
|
||
"x-enum-comments": {
|
||
"PlanContentTypeSubPlans": "计划包含子计划",
|
||
"PlanContentTypeTasks": "计划包含任务"
|
||
},
|
||
"x-enum-descriptions": [
|
||
"计划包含子计划",
|
||
"计划包含任务"
|
||
],
|
||
"x-enum-varnames": [
|
||
"PlanContentTypeSubPlans",
|
||
"PlanContentTypeTasks"
|
||
]
|
||
},
|
||
"models.PlanExecutionType": {
|
||
"type": "string",
|
||
"enum": [
|
||
"自动",
|
||
"手动"
|
||
],
|
||
"x-enum-comments": {
|
||
"PlanExecutionTypeAutomatic": "自动执行 (包含定时和循环)",
|
||
"PlanExecutionTypeManual": "手动执行"
|
||
},
|
||
"x-enum-descriptions": [
|
||
"自动执行 (包含定时和循环)",
|
||
"手动执行"
|
||
],
|
||
"x-enum-varnames": [
|
||
"PlanExecutionTypeAutomatic",
|
||
"PlanExecutionTypeManual"
|
||
]
|
||
},
|
||
"models.PlanStatus": {
|
||
"type": "string",
|
||
"enum": [
|
||
"已禁用",
|
||
"已启用",
|
||
"执行完毕",
|
||
"执行失败"
|
||
],
|
||
"x-enum-comments": {
|
||
"PlanStatusDisabled": "禁用计划",
|
||
"PlanStatusEnabled": "启用计划",
|
||
"PlanStatusFailed": "执行失败",
|
||
"PlanStatusStopped": "执行完毕"
|
||
},
|
||
"x-enum-descriptions": [
|
||
"禁用计划",
|
||
"启用计划",
|
||
"执行完毕",
|
||
"执行失败"
|
||
],
|
||
"x-enum-varnames": [
|
||
"PlanStatusDisabled",
|
||
"PlanStatusEnabled",
|
||
"PlanStatusStopped",
|
||
"PlanStatusFailed"
|
||
]
|
||
},
|
||
"models.SensorType": {
|
||
"type": "string",
|
||
"enum": [
|
||
"信号强度",
|
||
"电池电量",
|
||
"温度",
|
||
"湿度",
|
||
"重量"
|
||
],
|
||
"x-enum-comments": {
|
||
"SensorTypeBatteryLevel": "电池电量",
|
||
"SensorTypeHumidity": "湿度",
|
||
"SensorTypeSignalMetrics": "信号强度",
|
||
"SensorTypeTemperature": "温度",
|
||
"SensorTypeWeight": "重量"
|
||
},
|
||
"x-enum-descriptions": [
|
||
"信号强度",
|
||
"电池电量",
|
||
"温度",
|
||
"湿度",
|
||
"重量"
|
||
],
|
||
"x-enum-varnames": [
|
||
"SensorTypeSignalMetrics",
|
||
"SensorTypeBatteryLevel",
|
||
"SensorTypeTemperature",
|
||
"SensorTypeHumidity",
|
||
"SensorTypeWeight"
|
||
]
|
||
},
|
||
"models.TaskType": {
|
||
"type": "string",
|
||
"enum": [
|
||
"计划分析",
|
||
"等待",
|
||
"下料"
|
||
],
|
||
"x-enum-comments": {
|
||
"TaskPlanAnalysis": "解析Plan的Task列表并添加到待执行队列的特殊任务",
|
||
"TaskTypeReleaseFeedWeight": "下料口释放指定重量任务",
|
||
"TaskTypeWaiting": "等待任务"
|
||
},
|
||
"x-enum-descriptions": [
|
||
"解析Plan的Task列表并添加到待执行队列的特殊任务",
|
||
"等待任务",
|
||
"下料口释放指定重量任务"
|
||
],
|
||
"x-enum-varnames": [
|
||
"TaskPlanAnalysis",
|
||
"TaskTypeWaiting",
|
||
"TaskTypeReleaseFeedWeight"
|
||
]
|
||
},
|
||
"models.ValueDescriptor": {
|
||
"type": "object",
|
||
"properties": {
|
||
"multiplier": {
|
||
"description": "乘数,用于原始数据转换",
|
||
"type": "number"
|
||
},
|
||
"offset": {
|
||
"description": "偏移量,用于原始数据转换",
|
||
"type": "number"
|
||
},
|
||
"type": {
|
||
"$ref": "#/definitions/models.SensorType"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
} |