实现修改批次绑定的猪栏

This commit is contained in:
2025-10-04 00:47:27 +08:00
parent d03163a189
commit 8bb0a54f18
13 changed files with 498 additions and 27 deletions

View File

@@ -1085,6 +1085,71 @@ const docTemplate = `{
}
}
},
"/api/v1/pig-batches/{id}/pens": {
"put": {
"description": "更新指定猪批次当前关联的猪栏列表",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"猪批次管理"
],
"summary": "更新猪批次关联的猪栏",
"parameters": [
{
"type": "integer",
"description": "猪批次ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "猪批次关联的猪栏ID列表",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.PigBatchUpdatePensRequest"
}
}
],
"responses": {
"200": {
"description": "更新成功",
"schema": {
"$ref": "#/definitions/controller.Response"
}
},
"400": {
"description": "请求参数错误或无效的ID格式",
"schema": {
"$ref": "#/definitions/controller.Response"
}
},
"404": {
"description": "猪批次或猪栏不存在",
"schema": {
"$ref": "#/definitions/controller.Response"
}
},
"409": {
"description": "业务逻辑冲突 (如猪栏已被占用)",
"schema": {
"$ref": "#/definitions/controller.Response"
}
},
"500": {
"description": "内部服务器错误",
"schema": {
"$ref": "#/definitions/controller.Response"
}
}
}
}
},
"/api/v1/pig-houses": {
"get": {
"description": "获取所有猪舍的列表",
@@ -2280,6 +2345,9 @@ const docTemplate = `{
}
}
},
"dto.PigBatchUpdatePensRequest": {
"type": "object"
},
"dto.PigHouseResponse": {
"type": "object",
"properties": {

View File

@@ -1074,6 +1074,71 @@
}
}
},
"/api/v1/pig-batches/{id}/pens": {
"put": {
"description": "更新指定猪批次当前关联的猪栏列表",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"猪批次管理"
],
"summary": "更新猪批次关联的猪栏",
"parameters": [
{
"type": "integer",
"description": "猪批次ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "猪批次关联的猪栏ID列表",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.PigBatchUpdatePensRequest"
}
}
],
"responses": {
"200": {
"description": "更新成功",
"schema": {
"$ref": "#/definitions/controller.Response"
}
},
"400": {
"description": "请求参数错误或无效的ID格式",
"schema": {
"$ref": "#/definitions/controller.Response"
}
},
"404": {
"description": "猪批次或猪栏不存在",
"schema": {
"$ref": "#/definitions/controller.Response"
}
},
"409": {
"description": "业务逻辑冲突 (如猪栏已被占用)",
"schema": {
"$ref": "#/definitions/controller.Response"
}
},
"500": {
"description": "内部服务器错误",
"schema": {
"$ref": "#/definitions/controller.Response"
}
}
}
}
},
"/api/v1/pig-houses": {
"get": {
"description": "获取所有猪舍的列表",
@@ -2269,6 +2334,9 @@
}
}
},
"dto.PigBatchUpdatePensRequest": {
"type": "object"
},
"dto.PigHouseResponse": {
"type": "object",
"properties": {

View File

@@ -401,6 +401,8 @@ definitions:
- $ref: '#/definitions/models.PigBatchStatus'
description: 批次状态,可选
type: object
dto.PigBatchUpdatePensRequest:
type: object
dto.PigHouseResponse:
properties:
description:
@@ -1438,6 +1440,49 @@ paths:
summary: 更新猪批次
tags:
- 猪批次管理
/api/v1/pig-batches/{id}/pens:
put:
consumes:
- application/json
description: 更新指定猪批次当前关联的猪栏列表
parameters:
- description: 猪批次ID
in: path
name: id
required: true
type: integer
- description: 猪批次关联的猪栏ID列表
in: body
name: body
required: true
schema:
$ref: '#/definitions/dto.PigBatchUpdatePensRequest'
produces:
- application/json
responses:
"200":
description: 更新成功
schema:
$ref: '#/definitions/controller.Response'
"400":
description: 请求参数错误或无效的ID格式
schema:
$ref: '#/definitions/controller.Response'
"404":
description: 猪批次或猪栏不存在
schema:
$ref: '#/definitions/controller.Response'
"409":
description: 业务逻辑冲突 (如猪栏已被占用)
schema:
$ref: '#/definitions/controller.Response'
"500":
description: 内部服务器错误
schema:
$ref: '#/definitions/controller.Response'
summary: 更新猪批次关联的猪栏
tags:
- 猪批次管理
/api/v1/pig-houses:
get:
description: 获取所有猪舍的列表