definitions: controller.Response: properties: code: allOf: - $ref: '#/definitions/controller.ResponseCode' description: 业务状态码 data: description: 业务数据, omitempty表示如果为空则不序列化 message: description: 提示信息 type: string type: object controller.ResponseCode: enum: - 2000 - 2001 - 4000 - 4001 - 4003 - 4004 - 4009 - 5000 - 5003 type: integer x-enum-comments: CodeBadRequest: 请求参数错误 CodeConflict: 资源冲突 CodeCreated: 创建成功 CodeForbidden: 禁止访问 CodeInternalError: 服务器内部错误 CodeNotFound: 资源未找到 CodeServiceUnavailable: 服务不可用 CodeSuccess: 操作成功 CodeUnauthorized: 未授权 x-enum-descriptions: - 操作成功 - 创建成功 - 请求参数错误 - 未授权 - 禁止访问 - 资源未找到 - 资源冲突 - 服务器内部错误 - 服务不可用 x-enum-varnames: - CodeSuccess - CodeCreated - CodeBadRequest - CodeUnauthorized - CodeForbidden - CodeNotFound - CodeConflict - CodeInternalError - CodeServiceUnavailable dto.ActiveAlarmDTO: properties: alarm_code: $ref: '#/definitions/models.AlarmCode' alarm_details: type: string alarm_summary: type: string created_at: type: string id: type: integer ignored_until: type: string is_ignored: type: boolean last_notified_at: type: string level: $ref: '#/definitions/models.SeverityLevel' source_id: type: integer source_type: $ref: '#/definitions/models.AlarmSourceType' trigger_time: type: string updated_at: type: string type: object dto.AreaControllerResponse: properties: created_at: type: string id: type: integer location: type: string name: type: string network_id: type: string properties: additionalProperties: true type: object status: type: string updated_at: type: string type: object dto.AreaThresholdAlarmDTO: properties: area_controller_id: type: integer id: type: integer level: $ref: '#/definitions/models.SeverityLevel' operator: $ref: '#/definitions/models.Operator' sensor_type: $ref: '#/definitions/models.SensorType' thresholds: type: number type: object dto.AssignEmptyPensToBatchRequest: properties: pen_ids: description: 待分配的猪栏ID列表 example: - 1 - 2 - 3 items: type: integer minItems: 1 type: array required: - pen_ids type: object dto.BuyPigsRequest: properties: pen_id: description: 猪栏ID type: integer quantity: description: 买入猪只数量 minimum: 1 type: integer remarks: description: 备注 type: string total_price: description: 总价 minimum: 0 type: number trade_date: description: 交易日期 type: string trader_name: description: 交易方名称 type: string unit_price: description: 单价 minimum: 0 type: number required: - pen_id - quantity - total_price - trade_date - trader_name - unit_price type: object dto.CreateAreaControllerRequest: properties: location: type: string name: type: string network_id: type: string properties: additionalProperties: true type: object required: - name - network_id type: object dto.CreateAreaThresholdAlarmDTO: properties: area_controller_id: description: 区域主控ID type: integer level: allOf: - $ref: '#/definitions/models.SeverityLevel' description: 告警等级,可选 operator: allOf: - $ref: '#/definitions/models.Operator' description: 操作符 sensor_type: allOf: - $ref: '#/definitions/models.SensorType' description: 传感器类型 thresholds: description: 阈值 type: number required: - area_controller_id - operator - sensor_type - thresholds type: object dto.CreateDeviceRequest: properties: area_controller_id: type: integer device_template_id: type: integer location: type: string name: type: string properties: additionalProperties: true type: object required: - area_controller_id - device_template_id - name type: object dto.CreateDeviceTemplateRequest: properties: category: $ref: '#/definitions/models.DeviceCategory' commands: additionalProperties: true type: object description: type: string manufacturer: type: string name: type: string values: items: $ref: '#/definitions/models.ValueDescriptor' type: array required: - category - commands - name type: object dto.CreateDeviceThresholdAlarmDTO: properties: device_id: description: 设备ID type: integer level: allOf: - $ref: '#/definitions/models.SeverityLevel' description: 告警等级,可选,如果未提供则使用默认值 operator: allOf: - $ref: '#/definitions/models.Operator' description: 操作符 (使用string类型,与前端交互更通用) sensor_type: allOf: - $ref: '#/definitions/models.SensorType' description: 传感器类型 thresholds: description: 阈值 type: number required: - device_id - operator - sensor_type - thresholds type: object dto.CreateNutrientRequest: properties: description: description: 描述 maxLength: 255 type: string name: description: 营养素名称 maxLength: 100 type: string required: - name type: object dto.CreatePenRequest: properties: capacity: type: integer house_id: type: integer pen_number: type: string required: - capacity - house_id - pen_number type: object dto.CreatePigAgeStageRequest: properties: description: description: 阶段描述 maxLength: 255 type: string name: description: 年龄阶段名称 maxLength: 50 type: string required: - name type: object dto.CreatePigBreedRequest: properties: appearance_features: description: 外貌特征 type: string breed_advantages: description: 品种优点 type: string breed_disadvantages: description: 品种缺点 type: string description: description: 其他描述 type: string name: description: 品种名称 maxLength: 50 type: string parent_info: description: 父母信息 type: string required: - name type: object dto.CreatePigHouseRequest: properties: description: type: string name: type: string required: - name type: object dto.CreatePigTypeRequest: properties: age_stage_id: description: 关联的猪年龄阶段ID type: integer breed_id: description: 关联的猪品种ID type: integer daily_feed_intake: description: 理论日均食量 (g/天) type: number daily_gain_weight: description: 理论日增重 (g/天) type: number description: description: 该猪类型的描述或特点 maxLength: 255 type: string max_days: description: 该猪类型在该年龄阶段的最大日龄 type: integer max_weight: description: 该猪类型在该年龄阶段的最大体重 (g) type: number min_days: description: 该猪类型在该年龄阶段的最小日龄 type: integer min_weight: description: 该猪类型在该年龄阶段的最小体重 (g) type: number required: - age_stage_id - breed_id type: object dto.CreatePlanRequest: properties: cron_expression: example: 0 0 6 * * * type: string description: example: 根据温度自动调节风扇和加热器 type: string execute_num: example: 10 minimum: 0 type: integer execution_type: allOf: - $ref: '#/definitions/models.PlanExecutionType' example: 自动 name: example: 猪舍温度控制计划 type: string sub_plan_ids: items: type: integer type: array tasks: items: $ref: '#/definitions/dto.TaskRequest' type: array required: - execution_type - name type: object dto.CreateRawMaterialRequest: properties: description: description: 描述 maxLength: 255 type: string max_addition_ratio: description: 最大添加比例 type: number name: description: 原料名称 maxLength: 100 type: string reference_price: description: 参考价格(kg/元) type: number required: - name type: object dto.CreateRecipeRequest: properties: description: description: 配方描述 maxLength: 255 type: string name: description: 配方名称 maxLength: 100 type: string recipe_ingredients: description: 配方原料组成 items: $ref: '#/definitions/dto.RecipeIngredientDto' type: array required: - name type: object dto.CreateUserRequest: properties: password: example: password123 type: string username: example: newuser type: string required: - password - username type: object dto.CreateUserResponse: properties: id: example: 1 type: integer username: example: newuser type: string type: object dto.CurrentStockResponse: properties: last_operation_source_type: allOf: - $ref: '#/definitions/models.StockLogSourceType' description: 上次库存变动的来源类型 last_updated: description: 最后更新时间 type: string raw_material_id: description: 原料ID type: integer raw_material_name: description: 原料名称 type: string stock: description: '当前库存量, 单位: g' type: number type: object dto.DeleteDeviceThresholdAlarmDTO: properties: sensor_type: allOf: - $ref: '#/definitions/models.SensorType' description: 传感器类型 required: - sensor_type type: object dto.DeviceCommandLogDTO: properties: acknowledged_at: type: string device_id: type: integer message_id: type: string received_success: type: boolean sent_at: type: string type: object dto.DeviceResponse: 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: additionalProperties: true type: object updated_at: type: string type: object dto.DeviceTemplateResponse: properties: category: $ref: '#/definitions/models.DeviceCategory' commands: additionalProperties: true type: object created_at: type: string description: type: string id: type: integer manufacturer: type: string name: type: string updated_at: type: string values: items: $ref: '#/definitions/models.ValueDescriptor' type: array type: object dto.DeviceThresholdAlarmDTO: properties: device_id: type: integer id: type: integer level: $ref: '#/definitions/models.SeverityLevel' operator: $ref: '#/definitions/models.Operator' sensor_type: $ref: '#/definitions/models.SensorType' thresholds: type: number type: object dto.GenerateRecipeResponse: properties: description: description: 新生成的配方描述 type: string id: description: 新生成的配方ID type: integer name: description: 新生成的配方名称 type: string type: object dto.HistoricalAlarmDTO: properties: alarm_code: $ref: '#/definitions/models.AlarmCode' alarm_summary: type: string id: type: integer json_details: type: string level: $ref: '#/definitions/models.SeverityLevel' resolve_method: type: string resolve_time: type: string resolved_by: type: integer source_id: type: integer source_type: $ref: '#/definitions/models.AlarmSourceType' trigger_time: type: string type: object dto.ListActiveAlarmResponse: properties: list: items: $ref: '#/definitions/dto.ActiveAlarmDTO' type: array 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.ListCurrentStockResponse: properties: list: items: $ref: '#/definitions/dto.CurrentStockResponse' type: array pagination: $ref: '#/definitions/dto.PaginationDTO' type: object dto.ListDeviceCommandLogResponse: properties: list: items: $ref: '#/definitions/dto.DeviceCommandLogDTO' type: array 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.ListHistoricalAlarmResponse: properties: list: items: $ref: '#/definitions/dto.HistoricalAlarmDTO' type: array pagination: $ref: '#/definitions/dto.PaginationDTO' type: object dto.ListMedicationLogResponse: properties: list: items: $ref: '#/definitions/dto.MedicationLogDTO' type: array pagination: $ref: '#/definitions/dto.PaginationDTO' type: object dto.ListNotificationResponse: properties: list: items: $ref: '#/definitions/dto.NotificationDTO' type: array pagination: $ref: '#/definitions/dto.PaginationDTO' type: object dto.ListNutrientResponse: properties: list: items: $ref: '#/definitions/dto.NutrientResponse' type: array pagination: $ref: '#/definitions/dto.PaginationDTO' type: object dto.ListPendingCollectionResponse: properties: list: items: $ref: '#/definitions/dto.PendingCollectionDTO' type: array pagination: $ref: '#/definitions/dto.PaginationDTO' type: object dto.ListPigAgeStageResponse: properties: list: items: $ref: '#/definitions/dto.PigAgeStageResponse' type: array pagination: $ref: '#/definitions/dto.PaginationDTO' type: object dto.ListPigBatchLogResponse: properties: list: items: $ref: '#/definitions/dto.PigBatchLogDTO' type: array pagination: $ref: '#/definitions/dto.PaginationDTO' type: object dto.ListPigBreedResponse: properties: list: items: $ref: '#/definitions/dto.PigBreedResponse' type: array pagination: $ref: '#/definitions/dto.PaginationDTO' type: object dto.ListPigPurchaseResponse: properties: list: items: $ref: '#/definitions/dto.PigPurchaseDTO' type: array pagination: $ref: '#/definitions/dto.PaginationDTO' type: object dto.ListPigSaleResponse: properties: list: items: $ref: '#/definitions/dto.PigSaleDTO' type: array pagination: $ref: '#/definitions/dto.PaginationDTO' type: object dto.ListPigSickLogResponse: properties: list: items: $ref: '#/definitions/dto.PigSickLogDTO' type: array pagination: $ref: '#/definitions/dto.PaginationDTO' type: object dto.ListPigTransferLogResponse: properties: list: items: $ref: '#/definitions/dto.PigTransferLogDTO' type: array pagination: $ref: '#/definitions/dto.PaginationDTO' type: object dto.ListPigTypeResponse: properties: list: items: $ref: '#/definitions/dto.PigTypeResponse' type: array pagination: $ref: '#/definitions/dto.PaginationDTO' type: object dto.ListPlanExecutionLogResponse: properties: list: items: $ref: '#/definitions/dto.PlanExecutionLogDTO' type: array pagination: $ref: '#/definitions/dto.PaginationDTO' type: object dto.ListPlansResponse: properties: plans: items: $ref: '#/definitions/dto.PlanResponse' type: array total: example: 100 type: integer type: object dto.ListRawMaterialResponse: properties: list: items: $ref: '#/definitions/dto.RawMaterialResponse' type: array pagination: $ref: '#/definitions/dto.PaginationDTO' type: object dto.ListRecipeResponse: properties: list: items: $ref: '#/definitions/dto.RecipeResponse' type: array pagination: $ref: '#/definitions/dto.PaginationDTO' type: object dto.ListSensorDataResponse: properties: list: items: $ref: '#/definitions/dto.SensorDataDTO' type: array pagination: $ref: '#/definitions/dto.PaginationDTO' type: object dto.ListStockLogResponse: properties: list: items: $ref: '#/definitions/dto.StockLogResponse' type: array pagination: $ref: '#/definitions/dto.PaginationDTO' type: object dto.ListTaskExecutionLogResponse: properties: list: items: $ref: '#/definitions/dto.TaskExecutionLogDTO' type: array pagination: $ref: '#/definitions/dto.PaginationDTO' type: object dto.ListUserActionLogResponse: properties: list: items: $ref: '#/definitions/dto.UserActionLogDTO' type: array pagination: $ref: '#/definitions/dto.PaginationDTO' type: object dto.ListWeighingBatchResponse: properties: list: items: $ref: '#/definitions/dto.WeighingBatchDTO' type: array pagination: $ref: '#/definitions/dto.PaginationDTO' type: object dto.ListWeighingRecordResponse: properties: list: items: $ref: '#/definitions/dto.WeighingRecordDTO' type: array pagination: $ref: '#/definitions/dto.PaginationDTO' type: object dto.LoginRequest: properties: identifier: description: Identifier 可以是用户名、邮箱、手机号、微信号或飞书账号 example: testuser type: string password: example: password123 type: string required: - identifier - password type: object dto.LoginResponse: properties: id: example: 1 type: integer token: example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9... type: string username: example: testuser type: string type: object dto.ManualControlDeviceRequest: properties: action: description: Action 不传表示这是一个传感器, 会触发一次采集 type: string type: object dto.MedicationDTO: properties: id: type: integer name: type: string type: object dto.MedicationLogDTO: properties: description: type: string dosage_used: type: number happened_at: type: string id: type: integer medication: $ref: '#/definitions/dto.MedicationDTO' medication_id: type: integer operator_id: type: integer pig_batch_id: type: integer reason: $ref: '#/definitions/models.MedicationReasonType' target_count: type: integer type: object dto.MovePigsIntoPenRequest: properties: quantity: description: 移入猪只数量 minimum: 1 type: integer remarks: description: 备注 type: string to_pen_id: description: 目标猪栏ID type: integer required: - quantity - to_pen_id type: object dto.NotificationDTO: properties: alarm_timestamp: type: string created_at: type: string error_message: type: string id: type: integer level: $ref: '#/definitions/models.SeverityLevel' message: type: string notifier_type: $ref: '#/definitions/models.NotifierType' status: $ref: '#/definitions/models.NotificationStatus' title: type: string to_address: type: string updated_at: type: string user_id: type: integer type: object dto.NutrientRawMaterialDTO: properties: id: description: 原料ID type: integer name: description: 原料名称 type: string value: description: 该原料中此营养素的含量 type: number type: object dto.NutrientResponse: properties: description: type: string id: type: integer name: type: string raw_materials: description: 包含此营养的原料列表 items: $ref: '#/definitions/dto.NutrientRawMaterialDTO' type: array type: object dto.PaginationDTO: properties: page: type: integer page_size: type: integer total: type: integer type: object dto.PenResponse: properties: capacity: type: integer current_pig_count: type: integer house_id: type: integer id: type: integer pen_number: type: string pig_batch_id: type: integer status: $ref: '#/definitions/models.PenStatus' type: object dto.PendingCollectionDTO: properties: command_metadata: items: type: integer type: array correlation_id: type: string created_at: type: string device_id: type: integer fulfilled_at: type: string status: $ref: '#/definitions/models.PendingCollectionStatus' type: object dto.PigAgeStageResponse: properties: description: type: string id: type: integer name: type: string type: object dto.PigBatchCreateDTO: properties: batch_number: description: 批次编号,必填 type: string initial_count: description: 初始数量,必填,最小为1 minimum: 1 type: integer origin_type: allOf: - $ref: '#/definitions/models.PigBatchOriginType' description: 批次来源,必填 start_date: description: 批次开始日期,必填 type: string status: allOf: - $ref: '#/definitions/models.PigBatchStatus' description: 批次状态,必填 required: - batch_number - initial_count - origin_type - start_date - status type: object dto.PigBatchLogDTO: properties: after_count: type: integer before_count: type: integer change_count: type: integer change_type: $ref: '#/definitions/models.LogChangeType' created_at: type: string happened_at: type: string id: type: integer operator_id: type: integer pig_batch_id: type: integer reason: type: string updated_at: type: string type: object dto.PigBatchResponseDTO: properties: batch_number: description: 批次编号 type: string create_time: description: 创建时间 type: string current_total_pigs_in_pens: description: 当前存栏总数 type: integer current_total_quantity: description: 当前总数 type: integer end_date: description: 批次结束日期 type: string id: description: 批次ID type: integer initial_count: description: 初始数量 type: integer is_active: description: 是否活跃 type: boolean origin_type: allOf: - $ref: '#/definitions/models.PigBatchOriginType' description: 批次来源 start_date: description: 批次开始日期 type: string status: allOf: - $ref: '#/definitions/models.PigBatchStatus' description: 批次状态 update_time: description: 更新时间 type: string type: object dto.PigBatchUpdateDTO: properties: batch_number: description: 批次编号,可选 type: string end_date: description: 批次结束日期,可选 type: string initial_count: description: 初始数量,可选 type: integer origin_type: allOf: - $ref: '#/definitions/models.PigBatchOriginType' description: 批次来源,可选 start_date: description: 批次开始日期,可选 type: string status: allOf: - $ref: '#/definitions/models.PigBatchStatus' description: 批次状态,可选 type: object dto.PigBreedResponse: properties: appearance_features: type: string breed_advantages: type: string breed_disadvantages: type: string description: type: string id: type: integer name: type: string parent_info: type: string type: object dto.PigHouseResponse: properties: description: type: string id: type: integer name: type: string type: object dto.PigNutrientRequirementDTO: properties: id: type: integer max_requirement: description: 最高营养需求量 type: number min_requirement: description: 最低营养需求量 type: number nutrient_id: type: integer nutrient_name: description: 营养素名称 type: string type: object dto.PigNutrientRequirementItem: properties: max_requirement: description: 最高营养需求量 minimum: 0 type: number min_requirement: description: 最低营养需求量 minimum: 0 type: number nutrient_id: description: 营养素ID type: integer required: - nutrient_id type: object dto.PigPurchaseDTO: properties: created_at: type: string id: type: integer operator_id: type: integer pig_batch_id: type: integer purchase_date: type: string quantity: type: integer remarks: type: string supplier: type: string total_price: type: number unit_price: type: number updated_at: type: string type: object dto.PigSaleDTO: properties: buyer: type: string created_at: type: string id: type: integer operator_id: type: integer pig_batch_id: type: integer quantity: type: integer remarks: type: string sale_date: type: string total_price: type: number unit_price: type: number updated_at: type: string type: object dto.PigSickLogDTO: properties: after_count: type: integer before_count: type: integer change_count: type: integer created_at: type: string happened_at: type: string id: type: integer operator_id: type: integer pen_id: type: integer pig_batch_id: type: integer reason: $ref: '#/definitions/models.PigBatchSickPigReasonType' remarks: type: string treatment_location: $ref: '#/definitions/models.PigBatchSickPigTreatmentLocation' updated_at: type: string type: object dto.PigTransferLogDTO: properties: correlation_id: type: string created_at: type: string id: type: integer operator_id: type: integer pen_id: type: integer pig_batch_id: type: integer quantity: type: integer remarks: type: string transfer_time: type: string type: $ref: '#/definitions/models.PigTransferType' updated_at: type: string type: object dto.PigTypeResponse: properties: age_stage_id: type: integer age_stage_name: description: 猪年龄阶段名称 type: string breed_id: type: integer breed_name: description: 猪品种名称 type: string daily_feed_intake: type: number daily_gain_weight: type: number description: type: string id: type: integer max_days: type: integer max_weight: type: number min_days: type: integer min_weight: type: number pig_nutrient_requirements: description: 关联的营养需求 items: $ref: '#/definitions/dto.PigNutrientRequirementDTO' type: array type: object dto.PlanExecutionLogDTO: properties: created_at: type: string ended_at: type: string error: type: string id: type: integer plan_id: type: integer plan_name: type: string started_at: type: string status: $ref: '#/definitions/models.ExecutionStatus' updated_at: type: string type: object dto.PlanResponse: properties: content_type: allOf: - $ref: '#/definitions/models.PlanContentType' example: 任务 cron_expression: example: 0 0 6 * * * type: string description: example: 根据温度自动调节风扇和加热器 type: string execute_count: example: 0 type: integer execute_num: example: 10 type: integer execution_type: allOf: - $ref: '#/definitions/models.PlanExecutionType' example: 自动 id: example: 1 type: integer name: example: 猪舍温度控制计划 type: string plan_type: allOf: - $ref: '#/definitions/models.PlanType' example: 自定义任务 status: allOf: - $ref: '#/definitions/models.PlanStatus' example: 已启用 sub_plans: items: $ref: '#/definitions/dto.SubPlanResponse' type: array tasks: items: $ref: '#/definitions/dto.TaskResponse' type: array type: object dto.RawMaterialNutrientDTO: properties: id: type: integer nutrient_id: type: integer nutrient_name: description: 营养素名称 type: string value: description: 营养价值含量 type: number type: object dto.RawMaterialNutrientItem: properties: nutrient_id: description: 营养素ID type: integer value: description: 含量值,必须大于等于0 minimum: 0 type: number required: - nutrient_id type: object dto.RawMaterialResponse: properties: description: type: string id: type: integer max_addition_ratio: description: 最大添加比例 type: number name: type: string raw_material_nutrients: description: 关联的营养素信息 items: $ref: '#/definitions/dto.RawMaterialNutrientDTO' type: array reference_price: description: 参考价格(kg/元) type: number type: object dto.RecipeIngredientDto: properties: percentage: description: 原料在配方中的百分比 (0-1之间) maximum: 1 minimum: 0 type: number raw_material_id: description: 原料ID type: integer required: - raw_material_id type: object dto.RecipeResponse: properties: description: type: string id: type: integer name: type: string recipe_ingredients: items: $ref: '#/definitions/dto.RecipeIngredientDto' type: array type: object dto.ReclassifyPenToNewBatchRequest: properties: pen_id: description: 待划拨的猪栏ID type: integer remarks: description: 备注 type: string to_batch_id: description: 目标猪批次ID type: integer required: - pen_id - to_batch_id type: object dto.RecordCullRequest: properties: happened_at: description: 发生时间 type: string pen_id: description: 猪栏ID type: integer quantity: description: 淘汰猪数量 minimum: 1 type: integer remarks: description: 备注 type: string required: - happened_at - pen_id - quantity type: object dto.RecordDeathRequest: properties: happened_at: description: 发生时间 type: string pen_id: description: 猪栏ID type: integer quantity: description: 死亡猪数量 minimum: 1 type: integer remarks: description: 备注 type: string required: - happened_at - pen_id - quantity type: object dto.RecordSickPigCullRequest: properties: happened_at: description: 发生时间 type: string pen_id: description: 猪栏ID type: integer quantity: description: 淘汰猪数量 minimum: 1 type: integer remarks: description: 备注 type: string treatment_location: allOf: - $ref: '#/definitions/models.PigBatchSickPigTreatmentLocation' description: 治疗地点 required: - happened_at - pen_id - quantity - treatment_location type: object dto.RecordSickPigDeathRequest: properties: happened_at: description: 发生时间 type: string pen_id: description: 猪栏ID type: integer quantity: description: 死亡猪数量 minimum: 1 type: integer remarks: description: 备注 type: string treatment_location: allOf: - $ref: '#/definitions/models.PigBatchSickPigTreatmentLocation' description: 治疗地点 required: - happened_at - pen_id - quantity - treatment_location type: object dto.RecordSickPigRecoveryRequest: properties: happened_at: description: 发生时间 type: string pen_id: description: 猪栏ID type: integer quantity: description: 康复猪数量 minimum: 1 type: integer remarks: description: 备注 type: string treatment_location: allOf: - $ref: '#/definitions/models.PigBatchSickPigTreatmentLocation' description: 治疗地点 required: - happened_at - pen_id - quantity - treatment_location type: object dto.RecordSickPigsRequest: properties: happened_at: description: 发生时间 type: string pen_id: description: 猪栏ID type: integer quantity: description: 病猪数量 minimum: 1 type: integer remarks: description: 备注 type: string treatment_location: allOf: - $ref: '#/definitions/models.PigBatchSickPigTreatmentLocation' description: 治疗地点 required: - happened_at - pen_id - quantity - treatment_location type: object dto.SellPigsRequest: properties: pen_id: description: 猪栏ID type: integer quantity: description: 卖出猪只数量 minimum: 1 type: integer remarks: description: 备注 type: string total_price: description: 总价 minimum: 0 type: number trade_date: description: 交易日期 type: string trader_name: description: 交易方名称 type: string unit_price: description: 单价 minimum: 0 type: number required: - pen_id - quantity - total_price - trade_date - trader_name - unit_price type: object dto.SendTestNotificationRequest: properties: type: allOf: - $ref: '#/definitions/models.NotifierType' description: Type 指定要测试的通知渠道 required: - type type: object dto.SensorDataDTO: properties: area_controller_id: type: integer data: items: type: integer type: array device_id: type: integer sensor_type: $ref: '#/definitions/models.SensorType' time: type: string type: object dto.SnoozeAlarmRequest: properties: duration_minutes: description: 忽略时长,单位分钟 minimum: 1 type: integer required: - duration_minutes type: object dto.StockAdjustmentRequest: properties: change_amount: description: '变动数量, 正数为入库, 负数为出库, 单位: g' type: number raw_material_id: description: 要调整的原料ID type: integer remarks: description: 备注 maxLength: 255 type: string source_id: description: '来源ID, 例如: 配方ID, 采购单ID等' type: integer source_type: allOf: - $ref: '#/definitions/models.StockLogSourceType' description: 库存变动来源类型 required: - change_amount - raw_material_id - source_type type: object dto.StockLogResponse: properties: after_quantity: type: number before_quantity: type: number change_amount: type: number happened_at: type: string id: type: integer raw_material_id: type: integer raw_material_name: type: string remarks: type: string source_id: type: integer source_type: $ref: '#/definitions/models.StockLogSourceType' type: object dto.SubPlanResponse: properties: child_plan: $ref: '#/definitions/dto.PlanResponse' child_plan_id: example: 2 type: integer execution_order: example: 1 type: integer id: example: 1 type: integer parent_plan_id: example: 1 type: integer type: object dto.TaskDTO: properties: description: type: string id: type: integer name: type: string type: object dto.TaskExecutionLogDTO: properties: created_at: type: string ended_at: type: string id: type: integer output: type: string plan_execution_log_id: type: integer started_at: type: string status: $ref: '#/definitions/models.ExecutionStatus' task: allOf: - $ref: '#/definitions/dto.TaskDTO' description: 嵌套的任务信息 task_id: type: integer updated_at: type: string type: object dto.TaskRequest: properties: description: example: 打开1号风扇 type: string execution_order: example: 1 type: integer name: example: 打开风扇 type: string parameters: additionalProperties: true type: object type: allOf: - $ref: '#/definitions/models.TaskType' example: 等待 type: object dto.TaskResponse: properties: description: example: 打开1号风扇 type: string execution_order: example: 1 type: integer id: example: 1 type: integer name: example: 打开风扇 type: string parameters: additionalProperties: true type: object plan_id: example: 1 type: integer type: allOf: - $ref: '#/definitions/models.TaskType' example: 等待 type: object dto.TransferPigsAcrossBatchesRequest: properties: dest_batch_id: description: 目标猪批次ID type: integer from_pen_id: description: 源猪栏ID type: integer quantity: description: 调栏猪只数量 minimum: 1 type: integer remarks: description: 备注 type: string to_pen_id: description: 目标猪栏ID type: integer required: - dest_batch_id - from_pen_id - quantity - to_pen_id type: object dto.TransferPigsWithinBatchRequest: properties: from_pen_id: description: 源猪栏ID type: integer quantity: description: 调栏猪只数量 minimum: 1 type: integer remarks: description: 备注 type: string to_pen_id: description: 目标猪栏ID type: integer required: - from_pen_id - quantity - to_pen_id type: object dto.UpdateAreaControllerRequest: properties: location: type: string name: type: string network_id: type: string properties: additionalProperties: true type: object required: - name - network_id type: object dto.UpdateAreaThresholdAlarmDTO: properties: level: allOf: - $ref: '#/definitions/models.SeverityLevel' description: 新的告警等级,可选 operator: allOf: - $ref: '#/definitions/models.Operator' description: 新的操作符 thresholds: description: 新的阈值 type: number required: - operator - thresholds type: object dto.UpdateDeviceRequest: properties: area_controller_id: type: integer device_template_id: type: integer location: type: string name: type: string properties: additionalProperties: true type: object required: - area_controller_id - device_template_id - name type: object dto.UpdateDeviceTemplateRequest: properties: category: $ref: '#/definitions/models.DeviceCategory' commands: additionalProperties: true type: object description: type: string manufacturer: type: string name: type: string values: items: $ref: '#/definitions/models.ValueDescriptor' type: array required: - category - commands - name type: object dto.UpdateDeviceThresholdAlarmDTO: properties: level: allOf: - $ref: '#/definitions/models.SeverityLevel' description: 新的告警等级,可选 operator: allOf: - $ref: '#/definitions/models.Operator' description: 新的操作符 thresholds: description: 新的阈值 type: number required: - operator - thresholds type: object dto.UpdateNutrientRequest: properties: description: description: 描述 maxLength: 255 type: string name: description: 营养素名称 maxLength: 100 type: string required: - name type: object dto.UpdatePenRequest: properties: capacity: type: integer house_id: type: integer pen_number: type: string status: allOf: - $ref: '#/definitions/models.PenStatus' description: 添加oneof校验 enum: - 空闲 - 使用中 - 病猪栏 - 康复栏 - 清洗消毒 - 维修中 required: - capacity - house_id - pen_number - status type: object dto.UpdatePenStatusRequest: properties: status: allOf: - $ref: '#/definitions/models.PenStatus' enum: - 空闲 - 使用中 - 病猪栏 - 康复栏 - 清洗消毒 - 维修中 example: 病猪栏 required: - status type: object dto.UpdatePigAgeStageRequest: properties: description: description: 阶段描述 maxLength: 255 type: string name: description: 年龄阶段名称 maxLength: 50 type: string required: - name type: object dto.UpdatePigBreedRequest: properties: appearance_features: description: 外貌特征 type: string breed_advantages: description: 品种优点 type: string breed_disadvantages: description: 品种缺点 type: string description: description: 其他描述 type: string name: description: 品种名称 maxLength: 50 type: string parent_info: description: 父母信息 type: string required: - name type: object dto.UpdatePigHouseRequest: properties: description: type: string name: type: string required: - name type: object dto.UpdatePigTypeNutrientRequirementsRequest: properties: nutrient_requirements: items: $ref: '#/definitions/dto.PigNutrientRequirementItem' type: array required: - nutrient_requirements type: object dto.UpdatePigTypeRequest: properties: age_stage_id: description: 关联的猪年龄阶段ID type: integer breed_id: description: 关联的猪品种ID type: integer daily_feed_intake: description: 理论日均食量 (g/天) type: number daily_gain_weight: description: 理论日增重 (g/天) type: number description: description: 该猪类型的描述或特点 maxLength: 255 type: string max_days: description: 该猪类型在该年龄阶段的最大日龄 type: integer max_weight: description: 该猪类型在该年龄阶段的最大体重 (g) type: number min_days: description: 该猪类型在该年龄阶段的最小日龄 type: integer min_weight: description: 该猪类型在该年龄阶段的最小体重 (g) type: number required: - age_stage_id - breed_id type: object dto.UpdatePlanRequest: properties: cron_expression: example: 0 0 6 * * * type: string description: example: 更新后的描述 type: string execute_num: example: 10 minimum: 0 type: integer execution_type: allOf: - $ref: '#/definitions/models.PlanExecutionType' example: 自动 name: example: 猪舍温度控制计划V2 type: string sub_plan_ids: items: type: integer type: array tasks: items: $ref: '#/definitions/dto.TaskRequest' type: array required: - execution_type type: object dto.UpdateRawMaterialNutrientsRequest: properties: nutrients: items: $ref: '#/definitions/dto.RawMaterialNutrientItem' type: array required: - nutrients type: object dto.UpdateRawMaterialRequest: properties: description: description: 描述 maxLength: 255 type: string max_addition_ratio: description: 最大添加比例 type: number name: description: 原料名称 maxLength: 100 type: string reference_price: description: 参考价格(kg/元) type: number required: - name type: object dto.UpdateRecipeRequest: properties: description: description: 配方描述 maxLength: 255 type: string name: description: 配方名称 maxLength: 100 type: string recipe_ingredients: description: 配方原料组成 items: $ref: '#/definitions/dto.RecipeIngredientDto' type: array required: - name type: object dto.UserActionLogDTO: properties: action_type: type: string description: type: string http_method: type: string http_path: type: string id: type: integer result_details: type: string source_ip: type: string status: $ref: '#/definitions/models.AuditStatus' target_resource: items: type: integer type: array time: type: string user_id: type: integer username: type: string type: object dto.WeighingBatchDTO: properties: created_at: type: string description: type: string id: type: integer pig_batch_id: type: integer updated_at: type: string weighing_time: type: string type: object dto.WeighingRecordDTO: properties: created_at: type: string id: type: integer operator_id: type: integer pen_id: type: integer remark: type: string updated_at: type: string weighing_batch_id: type: integer weighing_time: type: string weight: type: number type: object models.AlarmCode: enum: - 温度阈值 - 湿度阈值 - 重量阈值 - 电池电量阈值 - 信号强度阈值 - 设备离线 - 区域主控离线 type: string x-enum-varnames: - AlarmCodeTemperature - AlarmCodeHumidity - AlarmCodeWeight - AlarmCodeBatteryLevel - AlarmCodeSignalMetrics - AlarmCodeDeviceOffline - AlarmCodeAreaControllerOffline models.AlarmSourceType: enum: - 普通设备 - 区域主控 - 系统 type: string x-enum-varnames: - AlarmSourceTypeDevice - AlarmSourceTypeAreaController - AlarmSourceTypeSystem models.AuditStatus: enum: - 成功 - 失败 type: string x-enum-varnames: - AuditStatusSuccess - AuditStatusFailed models.DeviceCategory: enum: - 执行器 - 传感器 type: string x-enum-varnames: - CategoryActuator - CategorySensor models.ExecutionStatus: enum: - 已开始 - 已完成 - 失败 - 已取消 - 等待中 type: string x-enum-comments: ExecutionStatusCancelled: 执行取消 ExecutionStatusCompleted: 执行完成 ExecutionStatusFailed: 执行失败 ExecutionStatusStarted: 开始执行 ExecutionStatusWaiting: 等待执行 (用于预写日志) x-enum-descriptions: - 开始执行 - 执行完成 - 执行失败 - 执行取消 - 等待执行 (用于预写日志) x-enum-varnames: - ExecutionStatusStarted - ExecutionStatusCompleted - ExecutionStatusFailed - ExecutionStatusCancelled - ExecutionStatusWaiting models.LogChangeType: enum: - 死亡 - 淘汰 - 销售 - 购买 - 转入 - 转出 - 盘点校正 type: string x-enum-varnames: - ChangeTypeDeath - ChangeTypeCull - ChangeTypeSale - ChangeTypeBuy - ChangeTypeTransferIn - ChangeTypeTransferOut - ChangeTypeCorrection models.MedicationReasonType: enum: - 预防 - 治疗 - 保健 type: string x-enum-varnames: - ReasonTypePreventive - ReasonTypeTreatment - ReasonTypeHealthCare models.NotificationStatus: enum: - 发送成功 - 发送失败 - 已跳过 type: string x-enum-comments: NotificationStatusFailed: 通知发送失败 NotificationStatusSkipped: 通知因某些原因被跳过(例如:用户未配置联系方式) NotificationStatusSuccess: 通知已成功发送 x-enum-descriptions: - 通知已成功发送 - 通知发送失败 - 通知因某些原因被跳过(例如:用户未配置联系方式) x-enum-varnames: - NotificationStatusSuccess - NotificationStatusFailed - NotificationStatusSkipped models.NotifierType: enum: - 邮件 - 企业微信 - 飞书 - 日志 type: string x-enum-varnames: - NotifierTypeSMTP - NotifierTypeWeChat - NotifierTypeLark - NotifierTypeLog models.Operator: enum: - < - <= - '>' - '>=' - = - '!=' type: string x-enum-varnames: - OperatorLessThan - OperatorLessThanOrEqualTo - OperatorGreaterThan - OperatorGreaterThanOrEqualTo - OperatorEqualTo - OperatorNotEqualTo models.PenStatus: enum: - 空闲 - 使用中 - 病猪栏 - 康复栏 - 清洗消毒 - 维修中 type: string x-enum-varnames: - PenStatusEmpty - PenStatusOccupied - PenStatusSickPen - PenStatusRecovering - PenStatusCleaning - PenStatusUnderMaint models.PendingCollectionStatus: enum: - 等待中 - 已完成 - 已超时 type: string x-enum-comments: PendingStatusFulfilled: 已收到设备响应并成功处理 PendingStatusPending: 请求已发送,等待设备响应 PendingStatusTimedOut: 请求超时,未收到设备响应 x-enum-descriptions: - 请求已发送,等待设备响应 - 已收到设备响应并成功处理 - 请求超时,未收到设备响应 x-enum-varnames: - PendingStatusPending - PendingStatusFulfilled - PendingStatusTimedOut models.PigBatchOriginType: enum: - 自繁 - 外购 type: string x-enum-varnames: - OriginTypeSelfFarrowed - OriginTypePurchased models.PigBatchSickPigReasonType: enum: - 患病 - 康复 - 死亡 - 淘汰 - 转入 - 转出 - 其他 type: string x-enum-comments: SickPigReasonTypeDeath: 猪只死亡 SickPigReasonTypeEliminate: 猪只淘汰 SickPigReasonTypeIllness: 猪只患病 SickPigReasonTypeOther: 其他原因 SickPigReasonTypeRecovery: 猪只康复 SickPigReasonTypeTransferIn: 病猪转入当前批次 SickPigReasonTypeTransferOut: 病猪转出当前批次 (例如转到其他批次或出售) x-enum-descriptions: - 猪只患病 - 猪只康复 - 猪只死亡 - 猪只淘汰 - 病猪转入当前批次 - 病猪转出当前批次 (例如转到其他批次或出售) - 其他原因 x-enum-varnames: - SickPigReasonTypeIllness - SickPigReasonTypeRecovery - SickPigReasonTypeDeath - SickPigReasonTypeEliminate - SickPigReasonTypeTransferIn - SickPigReasonTypeTransferOut - SickPigReasonTypeOther models.PigBatchSickPigTreatmentLocation: enum: - 原地治疗 - 病猪栏治疗 type: string x-enum-varnames: - TreatmentLocationOnSite - TreatmentLocationSickBay models.PigBatchStatus: enum: - 生产中 - 待售 - 已出售 - 已归档 type: string x-enum-comments: BatchStatusActive: 饲养中 BatchStatusArchived: 批次结束(如全群淘汰等) BatchStatusForSale: 达到出栏标准 x-enum-descriptions: - 饲养中 - 达到出栏标准 - "" - 批次结束(如全群淘汰等) x-enum-varnames: - BatchStatusActive - BatchStatusForSale - BatchStatusSold - BatchStatusArchived models.PigTransferType: enum: - 群内调栏 - 跨群调栏 - 销售 - 死亡 - 淘汰 - 新购入 - 产房转入 type: string x-enum-comments: PigTransferTypeCrossBatch: 不同猪群间的调动 PigTransferTypeCull: 猪只淘汰 PigTransferTypeDeath: 猪只死亡 PigTransferTypeDeliveryRoomTransfor: 产房转入 PigTransferTypeInternal: 同一猪群内猪栏间的调动 PigTransferTypePurchase: 新购入猪只 PigTransferTypeSale: 猪只售出 x-enum-descriptions: - 同一猪群内猪栏间的调动 - 不同猪群间的调动 - 猪只售出 - 猪只死亡 - 猪只淘汰 - 新购入猪只 - 产房转入 x-enum-varnames: - PigTransferTypeInternal - PigTransferTypeCrossBatch - PigTransferTypeSale - PigTransferTypeDeath - PigTransferTypeCull - PigTransferTypePurchase - PigTransferTypeDeliveryRoomTransfor models.PlanContentType: enum: - 子计划 - 任务 type: string x-enum-comments: PlanContentTypeSubPlans: 计划包含子计划 PlanContentTypeTasks: 计划包含任务 x-enum-descriptions: - 计划包含子计划 - 计划包含任务 x-enum-varnames: - PlanContentTypeSubPlans - PlanContentTypeTasks models.PlanExecutionType: enum: - 自动 - 手动 type: string x-enum-comments: PlanExecutionTypeAutomatic: 自动执行 (包含定时和循环) PlanExecutionTypeManual: 手动执行 x-enum-descriptions: - 自动执行 (包含定时和循环) - 手动执行 x-enum-varnames: - PlanExecutionTypeAutomatic - PlanExecutionTypeManual models.PlanStatus: enum: - 已禁用 - 已启用 - 执行完毕 - 执行失败 type: string x-enum-comments: PlanStatusDisabled: 禁用计划 PlanStatusEnabled: 启用计划 PlanStatusFailed: 执行失败 PlanStatusStopped: 执行完毕 x-enum-descriptions: - 禁用计划 - 启用计划 - 执行完毕 - 执行失败 x-enum-varnames: - PlanStatusDisabled - PlanStatusEnabled - PlanStatusStopped - PlanStatusFailed models.PlanType: enum: - 自定义任务 - 系统任务 type: string x-enum-varnames: - PlanTypeCustom - PlanTypeSystem models.SensorType: enum: - 信号强度 - 电池电量 - 温度 - 湿度 - 重量 type: string x-enum-comments: SensorTypeBatteryLevel: 电池电量 SensorTypeHumidity: 湿度 SensorTypeSignalMetrics: 信号强度 SensorTypeTemperature: 温度 SensorTypeWeight: 重量 x-enum-descriptions: - 信号强度 - 电池电量 - 温度 - 湿度 - 重量 x-enum-varnames: - SensorTypeSignalMetrics - SensorTypeBatteryLevel - SensorTypeTemperature - SensorTypeHumidity - SensorTypeWeight models.SeverityLevel: enum: - debug - info - warn - error - dpanic - panic - fatal type: string x-enum-varnames: - DebugLevel - InfoLevel - WarnLevel - ErrorLevel - DPanicLevel - PanicLevel - FatalLevel models.StockLogSourceType: enum: - 采购入库 - 饲喂出库 - 变质出库 - 售卖出库 - 杂用领取 - 手动盘点 - 发酵出库 - 发酵入库 type: string x-enum-comments: StockLogSourceFermentEnd: 发酵料产出,作为新原料计入库存 StockLogSourceFermentStart: 原料投入发酵,从库存中扣除 x-enum-descriptions: - "" - "" - "" - "" - "" - "" - 原料投入发酵,从库存中扣除 - 发酵料产出,作为新原料计入库存 x-enum-varnames: - StockLogSourcePurchase - StockLogSourceFeeding - StockLogSourceDeteriorate - StockLogSourceSale - StockLogSourceMiscellaneous - StockLogSourceManual - StockLogSourceFermentStart - StockLogSourceFermentEnd models.TaskType: enum: - 计划分析 - 等待 - 下料 - 全量采集 - 告警通知 - 通知刷新 - 设备阈值检查 - 区域阈值检查 type: string x-enum-comments: TaskPlanAnalysis: 解析Plan的Task列表并添加到待执行队列的特殊任务 TaskTypeAlarmNotification: 告警通知任务 TaskTypeAreaCollectorThresholdCheck: 区域阈值检查任务 TaskTypeDeviceThresholdCheck: 设备阈值检查任务 TaskTypeFullCollection: 新增的全量采集任务 TaskTypeNotificationRefresh: 通知刷新任务 TaskTypeReleaseFeedWeight: 下料口释放指定重量任务 TaskTypeWaiting: 等待任务 x-enum-descriptions: - 解析Plan的Task列表并添加到待执行队列的特殊任务 - 等待任务 - 下料口释放指定重量任务 - 新增的全量采集任务 - 告警通知任务 - 通知刷新任务 - 设备阈值检查任务 - 区域阈值检查任务 x-enum-varnames: - TaskPlanAnalysis - TaskTypeWaiting - TaskTypeReleaseFeedWeight - TaskTypeFullCollection - TaskTypeAlarmNotification - TaskTypeNotificationRefresh - TaskTypeDeviceThresholdCheck - TaskTypeAreaCollectorThresholdCheck models.ValueDescriptor: properties: multiplier: description: 乘数,用于原始数据转换 type: number offset: description: 偏移量,用于原始数据转换 type: number type: $ref: '#/definitions/models.SensorType' type: object repository.PlanTypeFilter: enum: - 所有任务 - 自定义任务 - 系统任务 type: string x-enum-varnames: - PlanTypeFilterAll - PlanTypeFilterCustom - PlanTypeFilterSystem zapcore.Level: enum: - -1 - 0 - 1 - 2 - 3 - 4 - 5 - -1 - 5 - 6 - 7 format: int32 type: integer x-enum-varnames: - DebugLevel - InfoLevel - WarnLevel - ErrorLevel - DPanicLevel - PanicLevel - FatalLevel - _minLevel - _maxLevel - InvalidLevel - _numLevels info: contact: email: divano@example.com name: Divano url: http://www.example.com description: 这是一个用于管理猪场设备的后端服务。 license: name: Apache 2.0 url: http://www.apache.org/licenses/LICENSE-2.0.html title: 猪场管理系统 API version: "1.0" paths: /api/v1/alarm/threshold/{id}/cancel-snooze: post: consumes: - application/json description: 根据告警ID取消对一个阈值告警的忽略状态 parameters: - description: 告警ID in: path name: id required: true type: string produces: - application/json responses: "200": description: 成功取消忽略告警 schema: $ref: '#/definitions/controller.Response' security: - BearerAuth: [] summary: 取消忽略阈值告警 tags: - 告警管理 /api/v1/alarm/threshold/{id}/snooze: post: consumes: - application/json description: 根据告警ID忽略一个活跃的阈值告警,或更新其忽略时间 parameters: - description: 告警ID in: path name: id required: true type: string - description: 忽略告警请求体 in: body name: request required: true schema: $ref: '#/definitions/dto.SnoozeAlarmRequest' produces: - application/json responses: "200": description: 成功忽略告警 schema: $ref: '#/definitions/controller.Response' security: - BearerAuth: [] summary: 忽略阈值告警 tags: - 告警管理 /api/v1/alarm/threshold/active-alarms: get: consumes: - application/json description: 根据过滤条件和分页参数查询活跃告警列表 parameters: - description: 告警触发时间范围 - 结束时间 in: query name: end_time type: string - description: 按是否被忽略过滤 in: query name: is_ignored type: boolean - 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: 排序字段,例如 "trigger_time DESC" in: query name: order_by type: string - in: query name: page type: integer - in: query name: page_size type: integer - description: 按告警来源ID过滤 in: query name: source_id type: integer - description: 按告警来源类型过滤 enum: - 普通设备 - 区域主控 - 系统 in: query name: source_type type: string x-enum-varnames: - AlarmSourceTypeDevice - AlarmSourceTypeAreaController - AlarmSourceTypeSystem - description: 告警触发时间范围 - 开始时间 in: query name: trigger_time type: string produces: - application/json responses: "200": description: 成功获取活跃告警列表 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.ListActiveAlarmResponse' type: object security: - BearerAuth: [] summary: 批量查询活跃告警 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 description: 为指定的区域主控创建一个新的阈值告警规则 parameters: - description: 创建区域阈值告警请求体 in: body name: request required: true schema: $ref: '#/definitions/dto.CreateAreaThresholdAlarmDTO' produces: - application/json responses: "200": description: 成功创建区域阈值告警 schema: $ref: '#/definitions/controller.Response' security: - BearerAuth: [] summary: 创建区域阈值告警 tags: - 告警管理 /api/v1/alarm/threshold/area/{task_id}: delete: description: 根据任务ID删除区域阈值告警规则 parameters: - description: 任务ID in: path name: task_id required: true type: integer produces: - application/json responses: "200": description: 成功删除区域阈值告警 schema: $ref: '#/definitions/controller.Response' security: - BearerAuth: [] summary: 删除区域阈值告警 tags: - 告警管理 get: description: 根据任务ID获取单个区域阈值告警规则的详细信息 parameters: - description: 任务ID in: path name: task_id required: true type: integer produces: - application/json responses: "200": description: 成功获取区域阈值告警 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.AreaThresholdAlarmDTO' type: object security: - BearerAuth: [] summary: 获取区域阈值告警 tags: - 告警管理 put: consumes: - application/json description: 根据任务ID更新已存在的区域阈值告警规则 parameters: - description: 任务ID in: path name: task_id required: true type: integer - description: 更新区域阈值告警请求体 in: body name: request required: true schema: $ref: '#/definitions/dto.UpdateAreaThresholdAlarmDTO' produces: - application/json responses: "200": description: 成功更新区域阈值告警 schema: $ref: '#/definitions/controller.Response' security: - BearerAuth: [] summary: 更新区域阈值告警 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 description: 为单个设备创建一条新的阈值告警规则 parameters: - description: 创建设备阈值告警请求体 in: body name: request required: true schema: $ref: '#/definitions/dto.CreateDeviceThresholdAlarmDTO' produces: - application/json responses: "200": description: 成功创建设备阈值告警 schema: $ref: '#/definitions/controller.Response' security: - BearerAuth: [] summary: 创建设备阈值告警 tags: - 告警管理 /api/v1/alarm/threshold/device/{task_id}: delete: consumes: - application/json description: 根据任务ID删除设备阈值告警规则 parameters: - description: 任务ID in: path name: task_id required: true type: integer - description: 删除设备阈值告警请求体 in: body name: request required: true schema: $ref: '#/definitions/dto.DeleteDeviceThresholdAlarmDTO' produces: - application/json responses: "200": description: 成功删除设备阈值告警 schema: $ref: '#/definitions/controller.Response' security: - BearerAuth: [] summary: 删除设备阈值告警 tags: - 告警管理 get: description: 根据任务ID获取单个设备阈值告警规则的详细信息 parameters: - description: 任务ID in: path name: task_id required: true type: integer produces: - application/json responses: "200": description: 成功获取设备阈值告警 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.DeviceThresholdAlarmDTO' type: object security: - BearerAuth: [] summary: 获取设备阈值告警 tags: - 告警管理 put: consumes: - application/json description: 根据任务ID更新已存在的设备阈值告警规则 parameters: - description: 任务ID in: path name: task_id required: true type: integer - description: 更新设备阈值告警请求体 in: body name: request required: true schema: $ref: '#/definitions/dto.UpdateDeviceThresholdAlarmDTO' produces: - application/json responses: "200": description: 成功更新设备阈值告警 schema: $ref: '#/definitions/controller.Response' security: - BearerAuth: [] summary: 更新设备阈值告警 tags: - 告警管理 /api/v1/alarm/threshold/historical-alarms: get: consumes: - application/json description: 根据过滤条件和分页参数查询历史告警列表 parameters: - 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: 排序字段,例如 "trigger_time DESC" in: query name: order_by type: string - in: query name: page type: integer - in: query name: page_size type: integer - description: 告警解决时间范围 - 结束时间 in: query name: resolve_time_end type: string - description: 告警解决时间范围 - 开始时间 in: query name: resolve_time_start type: string - description: 按告警来源ID过滤 in: query name: source_id type: integer - description: 按告警来源类型过滤 enum: - 普通设备 - 区域主控 - 系统 in: query name: source_type type: string x-enum-varnames: - AlarmSourceTypeDevice - AlarmSourceTypeAreaController - AlarmSourceTypeSystem - description: 告警触发时间范围 - 结束时间 in: query name: trigger_time_end type: string - description: 告警触发时间范围 - 开始时间 in: query name: trigger_time_start type: string produces: - application/json responses: "200": description: 成功获取历史告警列表 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.ListHistoricalAlarmResponse' type: object security: - BearerAuth: [] summary: 批量查询历史告警 tags: - 告警管理 /api/v1/area-controllers: get: description: 获取系统中所有区域主控的列表 produces: - application/json responses: "200": description: OK schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: items: $ref: '#/definitions/dto.AreaControllerResponse' type: array type: object security: - BearerAuth: [] summary: 获取所有区域主控列表 tags: - 区域主控管理 post: consumes: - application/json description: 根据提供的信息创建一个新区域主控 parameters: - description: 区域主控信息 in: body name: areaController required: true schema: $ref: '#/definitions/dto.CreateAreaControllerRequest' produces: - application/json responses: "200": description: OK schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.AreaControllerResponse' type: object security: - BearerAuth: [] summary: 创建新区域主控 tags: - 区域主控管理 /api/v1/area-controllers/{id}: delete: description: 根据ID删除一个区域主控(软删除) parameters: - description: 区域主控ID in: path name: id required: true type: string produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/controller.Response' security: - BearerAuth: [] summary: 删除区域主控 tags: - 区域主控管理 get: description: 根据ID获取单个区域主控的详细信息 parameters: - description: 区域主控ID in: path name: id required: true type: string produces: - application/json responses: "200": description: OK schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.AreaControllerResponse' type: object security: - BearerAuth: [] summary: 获取区域主控信息 tags: - 区域主控管理 put: consumes: - application/json description: 根据ID更新一个已存在的区域主控信息 parameters: - description: 区域主控ID in: path name: id required: true type: string - description: 要更新的区域主控信息 in: body name: areaController required: true schema: $ref: '#/definitions/dto.UpdateAreaControllerRequest' produces: - application/json responses: "200": description: OK schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.AreaControllerResponse' type: object security: - BearerAuth: [] summary: 更新区域主控信息 tags: - 区域主控管理 /api/v1/device-templates: get: description: 获取系统中所有设备模板的列表 produces: - application/json responses: "200": description: OK schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: items: $ref: '#/definitions/dto.DeviceTemplateResponse' type: array type: object security: - BearerAuth: [] summary: 获取设备模板列表 tags: - 设备模板管理 post: consumes: - application/json description: 根据提供的信息创建一个新设备模板 parameters: - description: 设备模板信息 in: body name: deviceTemplate required: true schema: $ref: '#/definitions/dto.CreateDeviceTemplateRequest' produces: - application/json responses: "200": description: OK schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.DeviceTemplateResponse' type: object security: - BearerAuth: [] summary: 创建新设备模板 tags: - 设备模板管理 /api/v1/device-templates/{id}: delete: description: 根据设备模板ID删除一个设备模板(软删除) parameters: - description: 设备模板ID in: path name: id required: true type: string produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/controller.Response' security: - BearerAuth: [] summary: 删除设备模板 tags: - 设备模板管理 get: description: 根据设备模板ID获取单个设备模板的详细信息 parameters: - description: 设备模板ID in: path name: id required: true type: string produces: - application/json responses: "200": description: OK schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.DeviceTemplateResponse' type: object security: - BearerAuth: [] summary: 获取设备模板信息 tags: - 设备模板管理 put: consumes: - application/json description: 根据设备模板ID更新一个已存在的设备模板信息 parameters: - description: 设备模板ID in: path name: id required: true type: string - description: 要更新的设备模板信息 in: body name: deviceTemplate required: true schema: $ref: '#/definitions/dto.UpdateDeviceTemplateRequest' produces: - application/json responses: "200": description: OK schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.DeviceTemplateResponse' type: object security: - BearerAuth: [] summary: 更新设备模板信息 tags: - 设备模板管理 /api/v1/devices: get: description: 获取系统中所有设备的列表 produces: - application/json responses: "200": description: OK schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: items: $ref: '#/definitions/dto.DeviceResponse' type: array type: object security: - BearerAuth: [] summary: 获取设备列表 tags: - 设备管理 post: consumes: - application/json description: 根据提供的信息创建一个新设备 parameters: - description: 设备信息 in: body name: device required: true schema: $ref: '#/definitions/dto.CreateDeviceRequest' produces: - application/json responses: "200": description: OK schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.DeviceResponse' type: object security: - BearerAuth: [] summary: 创建新设备 tags: - 设备管理 /api/v1/devices/{id}: delete: description: 根据设备ID删除一个设备(软删除) parameters: - description: 设备ID in: path name: id required: true type: string produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/controller.Response' security: - BearerAuth: [] summary: 删除设备 tags: - 设备管理 get: description: 根据设备ID获取单个设备的详细信息 parameters: - description: 设备ID in: path name: id required: true type: string produces: - application/json responses: "200": description: OK schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.DeviceResponse' type: object security: - BearerAuth: [] summary: 获取设备信息 tags: - 设备管理 put: consumes: - application/json description: 根据设备ID更新一个已存在的设备信息 parameters: - description: 设备ID in: path name: id required: true type: string - description: 要更新的设备信息 in: body name: device required: true schema: $ref: '#/definitions/dto.UpdateDeviceRequest' produces: - application/json responses: "200": description: OK schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.DeviceResponse' type: object security: - BearerAuth: [] summary: 更新设备信息 tags: - 设备管理 /api/v1/devices/manual-control/{id}: post: consumes: - application/json description: 根据设备ID和指定的动作(开启或关闭)来手动控制设备 parameters: - description: 设备ID in: path name: id required: true type: string - description: 手动控制指令 in: body name: manualControl required: true schema: $ref: '#/definitions/dto.ManualControlDeviceRequest' produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/controller.Response' security: - BearerAuth: [] summary: 手动控制设备 tags: - 设备管理 /api/v1/feed/nutrients: get: description: 获取所有营养种类的列表,支持分页和过滤。 parameters: - description: 按营养名称模糊查询 in: query name: name type: string - description: 排序字段,例如 "id DESC" in: query name: order_by type: string - description: 页码 in: query name: page type: integer - description: 每页数量 in: query name: page_size type: integer - description: 按原料名称模糊查询 in: query name: raw_material_name type: string produces: - application/json responses: "200": description: 业务码为200代表成功获取列表 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.ListNutrientResponse' type: object security: - BearerAuth: [] summary: 获取营养种类列表 tags: - 饲料管理-营养 post: consumes: - application/json description: 创建一个新的营养种类。 parameters: - description: 营养种类信息 in: body name: nutrient required: true schema: $ref: '#/definitions/dto.CreateNutrientRequest' produces: - application/json responses: "200": description: 业务码为201代表创建成功 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.NutrientResponse' type: object security: - BearerAuth: [] summary: 创建营养种类 tags: - 饲料管理-营养 /api/v1/feed/nutrients/{id}: delete: description: 根据ID删除营养种类。 parameters: - description: 营养种类ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: 业务码为200代表删除成功 schema: $ref: '#/definitions/controller.Response' security: - BearerAuth: [] summary: 删除营养种类 tags: - 饲料管理-营养 get: description: 根据ID获取单个营养种类的详细信息。 parameters: - description: 营养种类ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: 业务码为200代表成功获取 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.NutrientResponse' type: object security: - BearerAuth: [] summary: 获取营养种类详情 tags: - 饲料管理-营养 put: consumes: - application/json description: 根据ID更新营养种类信息。 parameters: - description: 营养种类ID in: path name: id required: true type: integer - description: 更新后的营养种类信息 in: body name: nutrient required: true schema: $ref: '#/definitions/dto.UpdateNutrientRequest' produces: - application/json responses: "200": description: 业务码为200代表更新成功 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.NutrientResponse' type: object security: - BearerAuth: [] summary: 更新营养种类 tags: - 饲料管理-营养 /api/v1/feed/pig-age-stages: get: description: 获取所有猪年龄阶段的列表,支持分页和过滤。 parameters: - description: 按名称模糊查询 in: query name: name type: string - description: 排序字段,例如 "id DESC" in: query name: order_by type: string - description: 页码 in: query name: page type: integer - description: 每页数量 in: query name: page_size type: integer produces: - application/json responses: "200": description: 业务码为200代表成功获取列表 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.ListPigAgeStageResponse' type: object security: - BearerAuth: [] summary: 获取猪年龄阶段列表 tags: - 饲料管理-猪 post: consumes: - application/json description: 创建一个新的猪年龄阶段。 parameters: - description: 猪年龄阶段信息 in: body name: pigAgeStage required: true schema: $ref: '#/definitions/dto.CreatePigAgeStageRequest' produces: - application/json responses: "200": description: 业务码为201代表创建成功 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.PigAgeStageResponse' type: object security: - BearerAuth: [] summary: 创建猪年龄阶段 tags: - 饲料管理-猪 /api/v1/feed/pig-age-stages/{id}: delete: description: 根据ID删除猪年龄阶段。 parameters: - description: 猪年龄阶段ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: 业务码为200代表删除成功 schema: $ref: '#/definitions/controller.Response' security: - BearerAuth: [] summary: 删除猪年龄阶段 tags: - 饲料管理-猪 get: description: 根据ID获取单个猪年龄阶段的详细信息。 parameters: - description: 猪年龄阶段ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: 业务码为200代表成功获取 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.PigAgeStageResponse' type: object security: - BearerAuth: [] summary: 获取猪年龄阶段详情 tags: - 饲料管理-猪 put: consumes: - application/json description: 根据ID更新猪年龄阶段信息。 parameters: - description: 猪年龄阶段ID in: path name: id required: true type: integer - description: 更新后的猪年龄阶段信息 in: body name: pigAgeStage required: true schema: $ref: '#/definitions/dto.UpdatePigAgeStageRequest' produces: - application/json responses: "200": description: 业务码为200代表更新成功 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.PigAgeStageResponse' type: object security: - BearerAuth: [] summary: 更新猪年龄阶段 tags: - 饲料管理-猪 /api/v1/feed/pig-breeds: get: description: 获取所有猪品种的列表,支持分页和过滤。 parameters: - description: 按名称模糊查询 in: query name: name type: string - description: 排序字段,例如 "id DESC" in: query name: order_by type: string - description: 页码 in: query name: page type: integer - description: 每页数量 in: query name: page_size type: integer produces: - application/json responses: "200": description: 业务码为200代表成功获取列表 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.ListPigBreedResponse' type: object security: - BearerAuth: [] summary: 获取猪品种列表 tags: - 饲料管理-猪 post: consumes: - application/json description: 创建一个新的猪品种。 parameters: - description: 猪品种信息 in: body name: pigBreed required: true schema: $ref: '#/definitions/dto.CreatePigBreedRequest' produces: - application/json responses: "200": description: 业务码为201代表创建成功 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.PigBreedResponse' type: object security: - BearerAuth: [] summary: 创建猪品种 tags: - 饲料管理-猪 /api/v1/feed/pig-breeds/{id}: delete: description: 根据ID删除猪品种。 parameters: - description: 猪品种ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: 业务码为200代表删除成功 schema: $ref: '#/definitions/controller.Response' security: - BearerAuth: [] summary: 删除猪品种 tags: - 饲料管理-猪 get: description: 根据ID获取单个猪品种的详细信息。 parameters: - description: 猪品种ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: 业务码为200代表成功获取 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.PigBreedResponse' type: object security: - BearerAuth: [] summary: 获取猪品种详情 tags: - 饲料管理-猪 put: consumes: - application/json description: 根据ID更新猪品种信息。 parameters: - description: 猪品种ID in: path name: id required: true type: integer - description: 更新后的猪品种信息 in: body name: pigBreed required: true schema: $ref: '#/definitions/dto.UpdatePigBreedRequest' produces: - application/json responses: "200": description: 业务码为200代表更新成功 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.PigBreedResponse' type: object security: - BearerAuth: [] summary: 更新猪品种 tags: - 饲料管理-猪 /api/v1/feed/pig-types: get: description: 获取所有猪类型的列表,支持分页和过滤。 parameters: - description: 关联的猪年龄阶段ID in: query name: age_stage_id type: integer - description: 关联的猪年龄阶段名称 (用于模糊查询) in: query name: age_stage_name type: string - description: 关联的猪品种ID in: query name: breed_id type: integer - description: 关联的猪品种名称 (用于模糊查询) in: query name: breed_name type: string - description: 排序字段,例如 "id DESC" in: query name: order_by type: string - description: 页码 in: query name: page type: integer - description: 每页数量 in: query name: page_size type: integer produces: - application/json responses: "200": description: 业务码为200代表成功获取列表 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.ListPigTypeResponse' type: object security: - BearerAuth: [] summary: 获取猪类型列表 tags: - 饲料管理-猪 post: consumes: - application/json description: 创建一个新的猪类型。 parameters: - description: 猪类型信息 in: body name: pigType required: true schema: $ref: '#/definitions/dto.CreatePigTypeRequest' produces: - application/json responses: "200": description: 业务码为201代表创建成功 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.PigTypeResponse' type: object security: - BearerAuth: [] summary: 创建猪类型 tags: - 饲料管理-猪 /api/v1/feed/pig-types/{id}: delete: description: 根据ID删除猪类型。 parameters: - description: 猪类型ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: 业务码为200代表删除成功 schema: $ref: '#/definitions/controller.Response' security: - BearerAuth: [] summary: 删除猪类型 tags: - 饲料管理-猪 get: description: 根据ID获取单个猪类型的详细信息。 parameters: - description: 猪类型ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: 业务码为200代表成功获取 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.PigTypeResponse' type: object security: - BearerAuth: [] summary: 获取猪类型详情 tags: - 饲料管理-猪 put: consumes: - application/json description: 根据ID更新猪类型信息。 parameters: - description: 猪类型ID in: path name: id required: true type: integer - description: 更新后的猪类型信息 in: body name: pigType required: true schema: $ref: '#/definitions/dto.UpdatePigTypeRequest' produces: - application/json responses: "200": description: 业务码为200代表更新成功 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.PigTypeResponse' type: object security: - BearerAuth: [] summary: 更新猪类型 tags: - 饲料管理-猪 /api/v1/feed/pig-types/{id}/nutrient-requirements: put: consumes: - application/json description: 根据猪类型ID,替换其所有的营养需求信息。这是一个覆盖操作。 parameters: - description: 猪类型ID in: path name: id required: true type: integer - description: 新的营养需求列表 in: body name: nutrientRequirements required: true schema: $ref: '#/definitions/dto.UpdatePigTypeNutrientRequirementsRequest' produces: - application/json responses: "200": description: 业务码为200代表更新成功 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.PigTypeResponse' type: object security: - BearerAuth: [] summary: 全量更新猪类型的营养需求 tags: - 饲料管理-猪 /api/v1/feed/raw-materials: get: description: 获取所有原料的列表,支持分页和过滤。 parameters: - description: 参考价格最大值 in: query name: max_reference_price type: number - description: 参考价格最小值 in: query name: min_reference_price type: number - description: 按原料名称模糊查询 in: query name: name type: string - description: 按营养名称模糊查询 in: query name: nutrient_name type: string - description: 排序字段,例如 "id DESC" in: query name: order_by type: string - description: 页码 in: query name: page type: integer - description: 每页数量 in: query name: page_size type: integer produces: - application/json responses: "200": description: 业务码为200代表成功获取列表 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.ListRawMaterialResponse' type: object security: - BearerAuth: [] summary: 获取原料列表 tags: - 饲料管理-原料 post: consumes: - application/json description: 创建一个新的原料。 parameters: - description: 原料信息,包含名称、描述和参考价格 in: body name: rawMaterial required: true schema: $ref: '#/definitions/dto.CreateRawMaterialRequest' produces: - application/json responses: "200": description: 业务码为201代表创建成功 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.RawMaterialResponse' type: object security: - BearerAuth: [] summary: 创建原料 tags: - 饲料管理-原料 /api/v1/feed/raw-materials/{id}: delete: description: 根据ID删除原料。 parameters: - description: 原料ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: 业务码为200代表删除成功 schema: $ref: '#/definitions/controller.Response' security: - BearerAuth: [] summary: 删除原料 tags: - 饲料管理-原料 get: description: 根据ID获取单个原料的详细信息。 parameters: - description: 原料ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: 业务码为200代表成功获取 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.RawMaterialResponse' type: object security: - BearerAuth: [] summary: 获取原料详情 tags: - 饲料管理-原料 put: consumes: - application/json description: 根据ID更新原料信息。 parameters: - description: 原料ID in: path name: id required: true type: integer - description: 更新后的原料信息,包含名称、描述和参考价格 in: body name: rawMaterial required: true schema: $ref: '#/definitions/dto.UpdateRawMaterialRequest' produces: - application/json responses: "200": description: 业务码为200代表更新成功 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.RawMaterialResponse' type: object security: - BearerAuth: [] summary: 更新原料 tags: - 饲料管理-原料 /api/v1/feed/raw-materials/{id}/nutrients: put: consumes: - application/json description: 根据原料ID,替换其所有的营养成分信息。这是一个覆盖操作。 parameters: - description: 原料ID in: path name: id required: true type: integer - description: 新的营养成分列表 in: body name: nutrients required: true schema: $ref: '#/definitions/dto.UpdateRawMaterialNutrientsRequest' produces: - application/json responses: "200": description: 业务码为200代表更新成功 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.RawMaterialResponse' type: object security: - BearerAuth: [] summary: 全量更新原料的营养成分 tags: - 饲料管理-原料 /api/v1/feed/recipes: get: description: 获取所有配方的列表,支持分页和过滤。 parameters: - description: 按名称模糊查询 in: query name: name type: string - description: 排序字段,例如 "id DESC" in: query name: order_by type: string - description: 页码 in: query name: page type: integer - description: 每页数量 in: query name: page_size type: integer produces: - application/json responses: "200": description: 业务码为200代表成功获取列表 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.ListRecipeResponse' type: object security: - BearerAuth: [] summary: 获取配方列表 tags: - 饲料管理-配方 post: consumes: - application/json description: 创建一个新的配方,包含其原料组成。 parameters: - description: 配方信息 in: body name: recipe required: true schema: $ref: '#/definitions/dto.CreateRecipeRequest' produces: - application/json responses: "200": description: 业务码为201代表创建成功 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.RecipeResponse' type: object security: - BearerAuth: [] summary: 创建配方 tags: - 饲料管理-配方 /api/v1/feed/recipes/{id}: delete: description: 根据ID删除配方。 parameters: - description: 配方ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: 业务码为200代表删除成功 schema: $ref: '#/definitions/controller.Response' security: - BearerAuth: [] summary: 删除配方 tags: - 饲料管理-配方 get: description: 根据ID获取单个配方的详细信息。 parameters: - description: 配方ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: 业务码为200代表成功获取 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.RecipeResponse' type: object security: - BearerAuth: [] summary: 获取配方详情 tags: - 饲料管理-配方 put: consumes: - application/json description: 根据ID更新配方信息及其原料组成。 parameters: - description: 配方ID in: path name: id required: true type: integer - description: 更新后的配方信息 in: body name: recipe required: true schema: $ref: '#/definitions/dto.UpdateRecipeRequest' produces: - application/json responses: "200": description: 业务码为200代表更新成功 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.RecipeResponse' type: object security: - BearerAuth: [] summary: 更新配方 tags: - 饲料管理-配方 /api/v1/feed/recipes/generate-from-all-materials/{pig_type_id}: post: description: 根据指定的猪类型ID,使用系统中所有可用的原料,自动计算并创建一个成本最优的配方。 parameters: - description: 猪类型ID in: path name: pig_type_id required: true type: integer produces: - application/json responses: "201": description: 业务码为201代表创建成功 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.GenerateRecipeResponse' type: object security: - BearerAuth: [] summary: 使用系统中所有可用的原料一键生成配方 tags: - 饲料管理-配方 /api/v1/feed/recipes/generate-prioritized-stock/{pig_type_id}: post: description: 根据指定的猪类型ID,优先使用有库存的原料,自动计算并创建一个配方。 parameters: - description: 猪类型ID in: path name: pig_type_id required: true type: integer produces: - application/json responses: "201": description: 业务码为201代表创建成功 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.GenerateRecipeResponse' type: object security: - BearerAuth: [] summary: 使用优先有库存原料的策略生成配方 tags: - 饲料管理-配方 /api/v1/inventory/stock/adjust: post: consumes: - application/json description: 手动调整指定原料的库存量。 parameters: - description: 库存调整请求 in: body name: request required: true schema: $ref: '#/definitions/dto.StockAdjustmentRequest' produces: - application/json responses: "200": description: 业务码为200代表调整成功 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.StockLogResponse' type: object security: - BearerAuth: [] summary: 调整原料库存 tags: - 库存管理 /api/v1/inventory/stock/current: get: description: 获取所有原料的当前库存列表,支持分页和过滤。 parameters: - description: 只查询有库存的原料 in: query name: has_stock type: boolean - description: 排序字段, 例如 "stock DESC" in: query name: order_by type: string - description: 页码 in: query name: page type: integer - description: 每页数量 in: query name: page_size type: integer - description: 按原料名称模糊查询 in: query name: raw_material_name type: string produces: - application/json responses: "200": description: 业务码为200代表成功获取列表 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.ListCurrentStockResponse' type: object security: - BearerAuth: [] summary: 获取当前库存列表 tags: - 库存管理 /api/v1/inventory/stock/logs: get: description: 获取原料库存变动历史记录,支持分页、过滤和时间范围查询。 parameters: - description: 结束时间 (RFC3339格式) in: query name: end_time type: string - description: 排序字段 in: query name: order_by type: string - description: 页码 in: query name: page type: integer - description: 每页数量 in: query name: page_size type: integer - description: 按原料ID精确查询 in: query name: raw_material_id type: integer - collectionFormat: csv description: 按来源类型查询 in: query items: enum: - 采购入库 - 饲喂出库 - 变质出库 - 售卖出库 - 杂用领取 - 手动盘点 - 发酵出库 - 发酵入库 type: string name: source_types type: array - description: 开始时间 (RFC3339格式, e.g., "2023-01-01T00:00:00Z") in: query name: start_time type: string produces: - application/json responses: "200": description: 业务码为200代表成功获取列表 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.ListStockLogResponse' type: object security: - BearerAuth: [] summary: 获取库存变动日志 tags: - 库存管理 /api/v1/monitor/device-command-logs: get: description: 根据提供的过滤条件,分页获取设备命令日志 parameters: - in: query name: device_id type: integer - in: query name: end_time type: string - in: query name: order_by type: string - in: query name: page type: integer - in: query name: page_size type: integer - in: query name: received_success type: boolean - in: query name: start_time type: string produces: - application/json responses: "200": description: OK schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.ListDeviceCommandLogResponse' type: object security: - BearerAuth: [] summary: 获取设备命令日志列表 tags: - 数据监控 /api/v1/monitor/medication-logs: get: description: 根据提供的过滤条件,分页获取用药记录 parameters: - in: query name: end_time type: string - in: query name: medication_id type: integer - in: query name: operator_id type: integer - in: query name: order_by type: string - in: query name: page type: integer - in: query name: page_size type: integer - in: query name: pig_batch_id type: integer - in: query name: reason type: string - in: query name: start_time type: string produces: - application/json responses: "200": description: OK schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.ListMedicationLogResponse' type: object security: - BearerAuth: [] summary: 获取用药记录列表 tags: - 数据监控 /api/v1/monitor/notifications: get: description: 根据提供的过滤条件,分页获取通知列表 parameters: - in: query name: end_time type: string - enum: - -1 - 0 - 1 - 2 - 3 - 4 - 5 - -1 - 5 - 6 - 7 format: int32 in: query name: level type: integer x-enum-varnames: - DebugLevel - InfoLevel - WarnLevel - ErrorLevel - DPanicLevel - PanicLevel - FatalLevel - _minLevel - _maxLevel - InvalidLevel - _numLevels - enum: - 邮件 - 企业微信 - 飞书 - 日志 in: query name: notifier_type type: string x-enum-varnames: - NotifierTypeSMTP - NotifierTypeWeChat - NotifierTypeLark - NotifierTypeLog - in: query name: order_by type: string - in: query name: page type: integer - in: query name: page_size type: integer - in: query name: start_time type: string - enum: - 发送成功 - 发送失败 - 已跳过 in: query name: status type: string x-enum-comments: NotificationStatusFailed: 通知发送失败 NotificationStatusSkipped: 通知因某些原因被跳过(例如:用户未配置联系方式) NotificationStatusSuccess: 通知已成功发送 x-enum-descriptions: - 通知已成功发送 - 通知发送失败 - 通知因某些原因被跳过(例如:用户未配置联系方式) x-enum-varnames: - NotificationStatusSuccess - NotificationStatusFailed - NotificationStatusSkipped - in: query name: user_id type: integer produces: - application/json responses: "200": description: OK schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.ListNotificationResponse' type: object security: - BearerAuth: [] summary: 批量查询通知 tags: - 数据监控 /api/v1/monitor/pending-collections: get: description: 根据提供的过滤条件,分页获取待采集请求 parameters: - in: query name: device_id type: integer - in: query name: end_time type: string - in: query name: order_by type: string - in: query name: page type: integer - in: query name: page_size type: integer - in: query name: start_time type: string - in: query name: status type: string produces: - application/json responses: "200": description: OK schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.ListPendingCollectionResponse' type: object security: - BearerAuth: [] summary: 获取待采集请求列表 tags: - 数据监控 /api/v1/monitor/pig-batch-logs: get: description: 根据提供的过滤条件,分页获取猪批次日志 parameters: - in: query name: change_type type: string - in: query name: end_time type: string - in: query name: operator_id type: integer - in: query name: order_by type: string - in: query name: page type: integer - in: query name: page_size type: integer - in: query name: pig_batch_id type: integer - in: query name: start_time type: string produces: - application/json responses: "200": description: OK schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.ListPigBatchLogResponse' type: object security: - BearerAuth: [] summary: 获取猪批次日志列表 tags: - 数据监控 /api/v1/monitor/pig-purchases: get: description: 根据提供的过滤条件,分页获取猪只采购记录 parameters: - in: query name: end_time type: string - in: query name: operator_id type: integer - in: query name: order_by type: string - in: query name: page type: integer - in: query name: page_size type: integer - in: query name: pig_batch_id type: integer - in: query name: start_time type: string - in: query name: supplier type: string produces: - application/json responses: "200": description: OK schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.ListPigPurchaseResponse' type: object security: - BearerAuth: [] summary: 获取猪只采购记录列表 tags: - 数据监控 /api/v1/monitor/pig-sales: get: description: 根据提供的过滤条件,分页获取猪只售卖记录 parameters: - in: query name: buyer type: string - in: query name: end_time type: string - in: query name: operator_id type: integer - in: query name: order_by type: string - in: query name: page type: integer - in: query name: page_size type: integer - in: query name: pig_batch_id type: integer - in: query name: start_time type: string produces: - application/json responses: "200": description: OK schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.ListPigSaleResponse' type: object security: - BearerAuth: [] summary: 获取猪只售卖记录列表 tags: - 数据监控 /api/v1/monitor/pig-sick-logs: get: description: 根据提供的过滤条件,分页获取病猪日志 parameters: - in: query name: end_time type: string - in: query name: operator_id type: integer - in: query name: order_by type: string - in: query name: page type: integer - in: query name: page_size type: integer - in: query name: pen_id type: integer - in: query name: pig_batch_id type: integer - in: query name: reason type: string - in: query name: start_time type: string - in: query name: treatment_location type: string produces: - application/json responses: "200": description: OK schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.ListPigSickLogResponse' type: object security: - BearerAuth: [] summary: 获取病猪日志列表 tags: - 数据监控 /api/v1/monitor/pig-transfer-logs: get: description: 根据提供的过滤条件,分页获取猪只迁移日志 parameters: - in: query name: correlation_id type: string - in: query name: end_time type: string - in: query name: operator_id type: integer - in: query name: order_by type: string - in: query name: page type: integer - in: query name: page_size type: integer - in: query name: pen_id type: integer - in: query name: pig_batch_id type: integer - in: query name: start_time type: string - in: query name: transfer_type type: string produces: - application/json responses: "200": description: OK schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.ListPigTransferLogResponse' type: object security: - BearerAuth: [] summary: 获取猪只迁移日志列表 tags: - 数据监控 /api/v1/monitor/plan-execution-logs: get: description: 根据提供的过滤条件,分页获取计划执行日志 parameters: - in: query name: end_time type: string - in: query name: order_by type: string - in: query name: page type: integer - in: query name: page_size type: integer - in: query name: plan_id type: integer - in: query name: start_time type: string - in: query name: status type: string produces: - application/json responses: "200": description: OK schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.ListPlanExecutionLogResponse' type: object security: - BearerAuth: [] summary: 获取计划执行日志列表 tags: - 数据监控 /api/v1/monitor/sensor-data: get: description: 根据提供的过滤条件,分页获取传感器数据 parameters: - in: query name: device_id type: integer - in: query name: end_time type: string - in: query name: order_by type: string - in: query name: page type: integer - in: query name: page_size type: integer - in: query name: sensor_type type: string - in: query name: start_time type: string produces: - application/json responses: "200": description: OK schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.ListSensorDataResponse' type: object security: - BearerAuth: [] summary: 获取传感器数据列表 tags: - 数据监控 /api/v1/monitor/task-execution-logs: get: description: 根据提供的过滤条件,分页获取任务执行日志 parameters: - in: query name: end_time type: string - in: query name: order_by type: string - in: query name: page type: integer - in: query name: page_size type: integer - in: query name: plan_execution_log_id type: integer - in: query name: start_time type: string - in: query name: status type: string - in: query name: task_id type: integer produces: - application/json responses: "200": description: OK schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.ListTaskExecutionLogResponse' type: object security: - BearerAuth: [] summary: 获取任务执行日志列表 tags: - 数据监控 /api/v1/monitor/user-action-logs: get: description: 根据提供的过滤条件,分页获取用户操作日志 parameters: - in: query name: action_type type: string - in: query name: end_time type: string - in: query name: order_by type: string - in: query name: page type: integer - in: query name: page_size type: integer - in: query name: start_time type: string - in: query name: status type: string - in: query name: user_id type: integer - in: query name: username type: string produces: - application/json responses: "200": description: OK schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.ListUserActionLogResponse' type: object security: - BearerAuth: [] summary: 获取用户操作日志列表 tags: - 数据监控 /api/v1/monitor/weighing-batches: get: description: 根据提供的过滤条件,分页获取批次称重记录 parameters: - in: query name: end_time type: string - in: query name: order_by type: string - in: query name: page type: integer - in: query name: page_size type: integer - in: query name: pig_batch_id type: integer - in: query name: start_time type: string produces: - application/json responses: "200": description: OK schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.ListWeighingBatchResponse' type: object security: - BearerAuth: [] summary: 获取批次称重记录列表 tags: - 数据监控 /api/v1/monitor/weighing-records: get: description: 根据提供的过滤条件,分页获取单次称重记录 parameters: - in: query name: end_time type: string - in: query name: operator_id type: integer - in: query name: order_by type: string - in: query name: page type: integer - in: query name: page_size type: integer - in: query name: pen_id type: integer - in: query name: start_time type: string - in: query name: weighing_batch_id type: integer produces: - application/json responses: "200": description: OK schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.ListWeighingRecordResponse' type: object security: - BearerAuth: [] summary: 获取单次称重记录列表 tags: - 数据监控 /api/v1/pens: get: description: 获取所有猪栏的列表 produces: - application/json responses: "200": description: 获取成功 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: items: $ref: '#/definitions/dto.PenResponse' type: array type: object security: - BearerAuth: [] summary: 获取猪栏列表 tags: - 猪场管理 post: consumes: - application/json description: 创建一个新的猪栏 parameters: - description: 猪栏信息 in: body name: body required: true schema: $ref: '#/definitions/dto.CreatePenRequest' produces: - application/json responses: "201": description: 创建成功 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.PenResponse' type: object security: - BearerAuth: [] summary: 创建猪栏 tags: - 猪场管理 /api/v1/pens/{id}: delete: description: 根据ID删除一个猪栏 parameters: - description: 猪栏ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: 删除成功 schema: $ref: '#/definitions/controller.Response' security: - BearerAuth: [] summary: 删除猪栏 tags: - 猪场管理 get: description: 根据ID获取单个猪栏信息 parameters: - description: 猪栏ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: 获取成功 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.PenResponse' type: object security: - BearerAuth: [] summary: 获取单个猪栏 tags: - 猪场管理 put: consumes: - application/json description: 更新一个已存在的猪栏信息 parameters: - description: 猪栏ID in: path name: id required: true type: integer - description: 猪栏信息 in: body name: body required: true schema: $ref: '#/definitions/dto.UpdatePenRequest' produces: - application/json responses: "200": description: 更新成功 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.PenResponse' type: object security: - BearerAuth: [] summary: 更新猪栏 tags: - 猪场管理 /api/v1/pens/{id}/status: put: consumes: - application/json description: 更新指定猪栏的当前状态 parameters: - description: 猪栏ID in: path name: id required: true type: integer - description: 新的猪栏状态 in: body name: body required: true schema: $ref: '#/definitions/dto.UpdatePenStatusRequest' produces: - application/json responses: "200": description: 更新成功 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.PenResponse' type: object security: - BearerAuth: [] summary: 更新猪栏状态 tags: - 猪场管理 /api/v1/pig-batches: get: description: 获取所有猪批次的列表,支持按活跃状态筛选 parameters: - description: 是否活跃 (true/false) in: query name: is_active type: boolean produces: - application/json responses: "200": description: 获取成功 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: items: $ref: '#/definitions/dto.PigBatchResponseDTO' type: array type: object security: - BearerAuth: [] summary: 获取猪批次列表 tags: - 猪群管理 post: consumes: - application/json description: 创建一个新的猪批次 parameters: - description: 猪批次信息 in: body name: body required: true schema: $ref: '#/definitions/dto.PigBatchCreateDTO' produces: - application/json responses: "201": description: 创建成功 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.PigBatchResponseDTO' type: object security: - BearerAuth: [] summary: 创建猪批次 tags: - 猪群管理 /api/v1/pig-batches/{id}: delete: description: 根据ID删除一个猪批次 parameters: - description: 猪批次ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: 删除成功 schema: $ref: '#/definitions/controller.Response' security: - BearerAuth: [] summary: 删除猪批次 tags: - 猪群管理 get: description: 根据ID获取单个猪批次信息 parameters: - description: 猪批次ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: 获取成功 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.PigBatchResponseDTO' type: object security: - BearerAuth: [] summary: 获取单个猪批次 tags: - 猪群管理 put: consumes: - application/json description: 更新一个已存在的猪批次信息 parameters: - description: 猪批次ID in: path name: id required: true type: integer - description: 猪批次信息 in: body name: body required: true schema: $ref: '#/definitions/dto.PigBatchUpdateDTO' produces: - application/json responses: "200": description: 更新成功 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.PigBatchResponseDTO' type: object security: - BearerAuth: [] summary: 更新猪批次 tags: - 猪群管理 /api/v1/pig-batches/assign-pens/{id}: post: 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.AssignEmptyPensToBatchRequest' produces: - application/json responses: "200": description: 分配成功 schema: $ref: '#/definitions/controller.Response' security: - BearerAuth: [] summary: 为猪批次分配空栏 tags: - 猪群管理 /api/v1/pig-batches/buy-pigs/{id}: post: consumes: - application/json description: 记录猪批次中的猪只购买事件 parameters: - description: 猪批次ID in: path name: id required: true type: integer - description: 买猪请求信息 in: body name: body required: true schema: $ref: '#/definitions/dto.BuyPigsRequest' produces: - application/json responses: "200": description: 买猪成功 schema: $ref: '#/definitions/controller.Response' security: - BearerAuth: [] summary: 处理买猪的业务逻辑 tags: - 猪群管理 /api/v1/pig-batches/move-pigs-into-pen/{id}: post: 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.MovePigsIntoPenRequest' produces: - application/json responses: "200": description: 移入成功 schema: $ref: '#/definitions/controller.Response' security: - BearerAuth: [] summary: 将猪只从“虚拟库存”移入指定猪栏 tags: - 猪群管理 /api/v1/pig-batches/reclassify-pen/{fromBatchID}: post: consumes: - application/json description: 将一个猪栏(连同其中的猪只)从一个批次整体划拨到另一个批次 parameters: - description: 源猪批次ID in: path name: fromBatchID required: true type: integer - description: 划拨请求信息 (包含目标批次ID、猪栏ID和备注) in: body name: body required: true schema: $ref: '#/definitions/dto.ReclassifyPenToNewBatchRequest' produces: - application/json responses: "200": description: 划拨成功 schema: $ref: '#/definitions/controller.Response' security: - BearerAuth: [] summary: 将猪栏划拨到新批次 tags: - 猪群管理 /api/v1/pig-batches/record-cull/{id}: post: consumes: - application/json description: 记录猪批次中正常猪只淘汰的数量和发生时间 parameters: - description: 猪批次ID in: path name: id required: true type: integer - description: 记录正常猪只淘汰请求信息 in: body name: body required: true schema: $ref: '#/definitions/dto.RecordCullRequest' produces: - application/json responses: "200": description: 记录成功 schema: $ref: '#/definitions/controller.Response' security: - BearerAuth: [] summary: 记录正常猪只淘汰事件 tags: - 猪群管理 /api/v1/pig-batches/record-death/{id}: post: consumes: - application/json description: 记录猪批次中正常猪只死亡的数量和发生时间 parameters: - description: 猪批次ID in: path name: id required: true type: integer - description: 记录正常猪只死亡请求信息 in: body name: body required: true schema: $ref: '#/definitions/dto.RecordDeathRequest' produces: - application/json responses: "200": description: 记录成功 schema: $ref: '#/definitions/controller.Response' security: - BearerAuth: [] summary: 记录正常猪只死亡事件 tags: - 猪群管理 /api/v1/pig-batches/record-sick-pig-cull/{id}: post: consumes: - application/json description: 记录猪批次中病猪淘汰的数量、治疗地点和发生时间 parameters: - description: 猪批次ID in: path name: id required: true type: integer - description: 记录病猪淘汰请求信息 in: body name: body required: true schema: $ref: '#/definitions/dto.RecordSickPigCullRequest' produces: - application/json responses: "200": description: 记录成功 schema: $ref: '#/definitions/controller.Response' security: - BearerAuth: [] summary: 记录病猪淘汰事件 tags: - 猪群管理 /api/v1/pig-batches/record-sick-pig-death/{id}: post: consumes: - application/json description: 记录猪批次中病猪死亡的数量、治疗地点和发生时间 parameters: - description: 猪批次ID in: path name: id required: true type: integer - description: 记录病猪死亡请求信息 in: body name: body required: true schema: $ref: '#/definitions/dto.RecordSickPigDeathRequest' produces: - application/json responses: "200": description: 记录成功 schema: $ref: '#/definitions/controller.Response' security: - BearerAuth: [] summary: 记录病猪死亡事件 tags: - 猪群管理 /api/v1/pig-batches/record-sick-pig-recovery/{id}: post: consumes: - application/json description: 记录猪批次中病猪康复的数量、治疗地点和发生时间 parameters: - description: 猪批次ID in: path name: id required: true type: integer - description: 记录病猪康复请求信息 in: body name: body required: true schema: $ref: '#/definitions/dto.RecordSickPigRecoveryRequest' produces: - application/json responses: "200": description: 记录成功 schema: $ref: '#/definitions/controller.Response' security: - BearerAuth: [] summary: 记录病猪康复事件 tags: - 猪群管理 /api/v1/pig-batches/record-sick-pigs/{id}: post: consumes: - application/json description: 记录猪批次中新增病猪的数量、治疗地点和发生时间 parameters: - description: 猪批次ID in: path name: id required: true type: integer - description: 记录病猪请求信息 in: body name: body required: true schema: $ref: '#/definitions/dto.RecordSickPigsRequest' produces: - application/json responses: "200": description: 记录成功 schema: $ref: '#/definitions/controller.Response' security: - BearerAuth: [] summary: 记录新增病猪事件 tags: - 猪群管理 /api/v1/pig-batches/remove-pen/{penID}/{batchID}: delete: description: 将一个空闲猪栏从指定的猪批次中移除 parameters: - description: 猪批次ID in: path name: batchID required: true type: integer - description: 待移除的猪栏ID in: path name: penID required: true type: integer produces: - application/json responses: "200": description: 移除成功 schema: $ref: '#/definitions/controller.Response' security: - BearerAuth: [] summary: 从猪批次移除空栏 tags: - 猪群管理 /api/v1/pig-batches/sell-pigs/{id}: post: consumes: - application/json description: 记录猪批次中的猪只出售事件 parameters: - description: 猪批次ID in: path name: id required: true type: integer - description: 卖猪请求信息 in: body name: body required: true schema: $ref: '#/definitions/dto.SellPigsRequest' produces: - application/json responses: "200": description: 卖猪成功 schema: $ref: '#/definitions/controller.Response' security: - BearerAuth: [] summary: 处理卖猪的业务逻辑 tags: - 猪群管理 /api/v1/pig-batches/transfer-across-batches/{sourceBatchID}: post: consumes: - application/json description: 将指定数量的猪只从一个猪群的猪栏调动到另一个猪群的猪栏 parameters: - description: 源猪批次ID in: path name: sourceBatchID required: true type: integer - description: 跨群调栏请求信息 in: body name: body required: true schema: $ref: '#/definitions/dto.TransferPigsAcrossBatchesRequest' produces: - application/json responses: "200": description: 调栏成功 schema: $ref: '#/definitions/controller.Response' security: - BearerAuth: [] summary: 跨猪群调栏 tags: - 猪群管理 /api/v1/pig-batches/transfer-within-batch/{id}: post: consumes: - application/json description: 将指定数量的猪只在同一个猪群的不同猪栏间调动 parameters: - description: 猪批次ID in: path name: id required: true type: integer - description: 群内调栏请求信息 in: body name: body required: true schema: $ref: '#/definitions/dto.TransferPigsWithinBatchRequest' produces: - application/json responses: "200": description: 调栏成功 schema: $ref: '#/definitions/controller.Response' security: - BearerAuth: [] summary: 群内调栏 tags: - 猪群管理 /api/v1/pig-houses: get: description: 获取所有猪舍的列表 produces: - application/json responses: "200": description: 获取成功 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: items: $ref: '#/definitions/dto.PigHouseResponse' type: array type: object security: - BearerAuth: [] summary: 获取猪舍列表 tags: - 猪场管理 post: consumes: - application/json description: 根据提供的信息创建一个新猪舍 parameters: - description: 猪舍信息 in: body name: body required: true schema: $ref: '#/definitions/dto.CreatePigHouseRequest' produces: - application/json responses: "201": description: 创建成功 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.PigHouseResponse' type: object security: - BearerAuth: [] summary: 创建猪舍 tags: - 猪场管理 /api/v1/pig-houses/{id}: delete: description: 根据ID删除一个猪舍 parameters: - description: 猪舍ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: 删除成功 schema: $ref: '#/definitions/controller.Response' security: - BearerAuth: [] summary: 删除猪舍 tags: - 猪场管理 get: description: 根据ID获取单个猪舍信息 parameters: - description: 猪舍ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: 获取成功 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.PigHouseResponse' type: object security: - BearerAuth: [] summary: 获取单个猪舍 tags: - 猪场管理 put: consumes: - application/json description: 更新一个已存在的猪舍信息 parameters: - description: 猪舍ID in: path name: id required: true type: integer - description: 猪舍信息 in: body name: body required: true schema: $ref: '#/definitions/dto.UpdatePigHouseRequest' produces: - application/json responses: "200": description: 更新成功 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.PigHouseResponse' type: object security: - BearerAuth: [] summary: 更新猪舍 tags: - 猪场管理 /api/v1/plans: get: description: 获取所有计划的列表,支持按类型过滤和分页 parameters: - description: 页码 in: query name: page type: integer - description: 每页大小 in: query name: page_size type: integer - description: 计划类型 enum: - 所有任务 - 自定义任务 - 系统任务 in: query name: plan_type type: string x-enum-varnames: - PlanTypeFilterAll - PlanTypeFilterCustom - PlanTypeFilterSystem produces: - application/json responses: "200": description: 业务码为200代表成功获取列表 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.ListPlansResponse' type: object security: - BearerAuth: [] summary: 获取计划列表 tags: - 计划管理 post: consumes: - application/json description: 创建一个新的计划,包括其基本信息和所有关联的子计划/任务。 parameters: - description: 计划信息 in: body name: plan required: true schema: $ref: '#/definitions/dto.CreatePlanRequest' produces: - application/json responses: "200": description: 业务码为201代表创建成功 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.PlanResponse' type: object security: - BearerAuth: [] summary: 创建计划 tags: - 计划管理 /api/v1/plans/{id}: delete: description: 根据计划ID删除计划。(软删除)系统计划不允许删除。 parameters: - description: 计划ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: 业务码为200代表删除成功 schema: $ref: '#/definitions/controller.Response' security: - BearerAuth: [] summary: 删除计划 tags: - 计划管理 get: description: 根据计划ID获取单个计划的详细信息。 parameters: - description: 计划ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: 业务码为200代表成功获取 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.PlanResponse' type: object security: - BearerAuth: [] summary: 获取计划详情 tags: - 计划管理 put: consumes: - application/json description: 根据计划ID更新计划的详细信息。系统计划不允许修改。 parameters: - description: 计划ID in: path name: id required: true type: integer - description: 更新后的计划信息 in: body name: plan required: true schema: $ref: '#/definitions/dto.UpdatePlanRequest' produces: - application/json responses: "200": description: 业务码为200代表更新成功 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.PlanResponse' type: object security: - BearerAuth: [] summary: 更新计划 tags: - 计划管理 /api/v1/plans/{id}/start: post: description: 根据计划ID启动一个计划的执行。系统计划不允许手动启动。 parameters: - description: 计划ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: 业务码为200代表成功启动计划 schema: $ref: '#/definitions/controller.Response' security: - BearerAuth: [] summary: 启动计划 tags: - 计划管理 /api/v1/plans/{id}/stop: post: description: 根据计划ID停止一个正在执行的计划。系统计划不能被停止。 parameters: - description: 计划ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: 业务码为200代表成功停止计划 schema: $ref: '#/definitions/controller.Response' security: - BearerAuth: [] summary: 停止计划 tags: - 计划管理 /api/v1/users: post: consumes: - application/json description: 根据用户名和密码创建一个新的系统用户。 parameters: - description: 用户信息 in: body name: user required: true schema: $ref: '#/definitions/dto.CreateUserRequest' produces: - application/json responses: "200": description: 业务码为201代表创建成功 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.CreateUserResponse' type: object summary: 创建新用户 tags: - 用户管理 /api/v1/users/{id}/notifications/test: post: consumes: - application/json description: 为指定用户发送一条特定渠道的测试消息,以验证其配置是否正确。 parameters: - description: 用户ID in: path name: id required: true type: integer - description: 请求体 in: body name: body required: true schema: $ref: '#/definitions/dto.SendTestNotificationRequest' produces: - application/json responses: "200": description: 成功响应 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: type: string type: object security: - BearerAuth: [] summary: 发送测试通知 tags: - 用户管理 /api/v1/users/login: post: consumes: - application/json description: 用户可以使用用户名、邮箱、手机号、微信号或飞书账号进行登录,成功后返回 JWT 令牌。 parameters: - description: 登录凭证 in: body name: credentials required: true schema: $ref: '#/definitions/dto.LoginRequest' produces: - application/json responses: "200": description: 业务码为200代表登录成功 schema: allOf: - $ref: '#/definitions/controller.Response' - properties: data: $ref: '#/definitions/dto.LoginResponse' type: object summary: 用户登录 tags: - 用户管理 /healthz: get: description: 检查服务进程是否运行正常,只要服务能响应就返回 200 OK。 produces: - application/json responses: "200": description: 服务存活 schema: $ref: '#/definitions/controller.Response' summary: 服务存活检查 tags: - 健康检查 /readyz: get: description: 检查服务是否已准备好接收流量。当前实现为只要服务能响应即代表就绪。 produces: - application/json responses: "200": description: 服务已就绪 schema: $ref: '#/definitions/controller.Response' summary: 服务就绪检查 tags: - 健康检查 securityDefinitions: BearerAuth: in: header name: Authorization type: apiKey swagger: "2.0"