Files
pig-farm-controller/docs/swagger.yaml

2520 lines
62 KiB
YAML
Raw Normal View History

2025-10-03 23:59:25 +08:00
definitions:
controller.Response:
properties:
code:
allOf:
- $ref: '#/definitions/controller.ResponseCode'
description: 业务状态码
data:
description: 业务数据
message:
description: 提示信息
type: string
type: object
controller.ResponseCode:
enum:
- 2000
- 2001
- 4000
- 4001
- 4004
- 4009
- 5000
- 5003
type: integer
x-enum-comments:
CodeBadRequest: 请求参数错误
CodeConflict: 资源冲突
CodeCreated: 创建成功
CodeInternalError: 服务器内部错误
CodeNotFound: 资源未找到
CodeServiceUnavailable: 服务不可用
CodeSuccess: 操作成功
CodeUnauthorized: 未授权
x-enum-descriptions:
- 操作成功
- 创建成功
- 请求参数错误
- 未授权
- 资源未找到
- 资源冲突
- 服务器内部错误
- 服务不可用
x-enum-varnames:
- CodeSuccess
- CodeCreated
- CodeBadRequest
- CodeUnauthorized
- CodeNotFound
- CodeConflict
- CodeInternalError
- CodeServiceUnavailable
dto.AreaControllerResponse:
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
2025-10-06 23:10:58 +08:00
dto.AssignEmptyPensToBatchRequest:
type: object
2025-10-06 23:22:47 +08:00
dto.BuyPigsRequest:
properties:
penID:
description: 猪栏ID
type: integer
quantity:
description: 买入猪只数量
minimum: 1
type: integer
remarks:
description: 备注
type: string
totalPrice:
description: 总价
minimum: 0
type: number
tradeDate:
description: 交易日期
type: string
traderName:
description: 交易方名称
type: string
unitPrice:
description: 单价
minimum: 0
type: number
required:
- penID
- quantity
- totalPrice
- tradeDate
- traderName
- unitPrice
type: object
2025-10-03 23:59:25 +08:00
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.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.CreatePenRequest:
properties:
capacity:
type: integer
house_id:
type: integer
pen_number:
type: string
required:
- capacity
- house_id
- pen_number
type: object
dto.CreatePigHouseRequest:
properties:
description:
type: string
name:
type: string
required:
- name
type: object
dto.CreatePlanRequest:
properties:
cron_expression:
example: 0 0 6 * * *
type: string
description:
example: 根据温度自动调节风扇和加热器
type: string
execute_num:
example: 10
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.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.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.HistoryResponse:
properties:
action_type:
example: 更新设备
type: string
description:
example: 设备更新成功
type: string
target_resource: {}
time:
type: string
user_id:
example: 101
type: integer
username:
example: testuser
type: string
type: object
dto.ListHistoryResponse:
properties:
history:
items:
$ref: '#/definitions/dto.HistoryResponse'
type: array
total:
example: 100
type: integer
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
2025-10-13 12:16:36 +08:00
dto.ManualControlDeviceRequest:
properties:
action:
description: Action 不传表示这是一个传感器, 会触发一次采集
enum:
- "on"
- "off"
type: string
type: object
2025-10-06 23:10:58 +08:00
dto.MovePigsIntoPenRequest:
properties:
quantity:
description: 移入猪只数量
minimum: 1
type: integer
remarks:
description: 备注
type: string
toPenID:
description: 目标猪栏ID
type: integer
required:
- quantity
- toPenID
type: object
2025-10-03 23:59:25 +08:00
dto.PenResponse:
properties:
capacity:
type: integer
house_id:
type: integer
id:
type: integer
pen_number:
type: string
pig_batch_id:
type: integer
status:
$ref: '#/definitions/models.PenStatus'
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.PigBatchResponseDTO:
properties:
batch_number:
description: 批次编号
type: string
create_time:
description: 创建时间
type: string
end_date:
description: 批次结束日期
type: string
id:
description: 批次ID
type: integer
initial_count:
description: 初始数量
type: integer
is_active:
description: 是否活跃
type: boolean
origin_type:
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.PigHouseResponse:
properties:
description:
type: string
id:
type: integer
name:
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
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
2025-10-06 23:10:58 +08:00
dto.ReclassifyPenToNewBatchRequest:
properties:
penID:
description: 待划拨的猪栏ID
type: integer
remarks:
description: 备注
type: string
toBatchID:
description: 目标猪批次ID
type: integer
required:
- penID
- toBatchID
type: object
2025-10-06 23:22:47 +08:00
dto.RecordCullRequest:
properties:
happenedAt:
description: 发生时间
type: string
penID:
description: 猪栏ID
type: integer
quantity:
description: 淘汰猪数量
minimum: 1
type: integer
remarks:
description: 备注
type: string
required:
- happenedAt
- penID
- quantity
type: object
dto.RecordDeathRequest:
properties:
happenedAt:
description: 发生时间
type: string
penID:
description: 猪栏ID
type: integer
quantity:
description: 死亡猪数量
minimum: 1
type: integer
remarks:
description: 备注
type: string
required:
- happenedAt
- penID
- quantity
type: object
dto.RecordSickPigCullRequest:
properties:
happenedAt:
description: 发生时间
type: string
penID:
description: 猪栏ID
type: integer
quantity:
description: 淘汰猪数量
minimum: 1
type: integer
remarks:
description: 备注
type: string
treatmentLocation:
allOf:
- $ref: '#/definitions/models.PigBatchSickPigTreatmentLocation'
description: 治疗地点
required:
- happenedAt
- penID
- quantity
- treatmentLocation
type: object
dto.RecordSickPigDeathRequest:
properties:
happenedAt:
description: 发生时间
type: string
penID:
description: 猪栏ID
type: integer
quantity:
description: 死亡猪数量
minimum: 1
type: integer
remarks:
description: 备注
type: string
treatmentLocation:
allOf:
- $ref: '#/definitions/models.PigBatchSickPigTreatmentLocation'
description: 治疗地点
required:
- happenedAt
- penID
- quantity
- treatmentLocation
type: object
dto.RecordSickPigRecoveryRequest:
properties:
happenedAt:
description: 发生时间
type: string
penID:
description: 猪栏ID
type: integer
quantity:
description: 康复猪数量
minimum: 1
type: integer
remarks:
description: 备注
type: string
treatmentLocation:
allOf:
- $ref: '#/definitions/models.PigBatchSickPigTreatmentLocation'
description: 治疗地点
required:
- happenedAt
- penID
- quantity
- treatmentLocation
type: object
dto.RecordSickPigsRequest:
properties:
happenedAt:
description: 发生时间
type: string
penID:
description: 猪栏ID
type: integer
quantity:
description: 病猪数量
minimum: 1
type: integer
remarks:
description: 备注
type: string
treatmentLocation:
allOf:
- $ref: '#/definitions/models.PigBatchSickPigTreatmentLocation'
description: 治疗地点
required:
- happenedAt
- penID
- quantity
- treatmentLocation
type: object
dto.SellPigsRequest:
properties:
penID:
description: 猪栏ID
type: integer
quantity:
description: 卖出猪只数量
minimum: 1
type: integer
remarks:
description: 备注
type: string
totalPrice:
description: 总价
minimum: 0
type: number
tradeDate:
description: 交易日期
type: string
traderName:
description: 交易方名称
type: string
unitPrice:
description: 单价
minimum: 0
type: number
required:
- penID
- quantity
- totalPrice
- tradeDate
- traderName
- unitPrice
type: object
2025-10-03 23:59:25 +08:00
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.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
2025-10-06 23:22:47 +08:00
dto.TransferPigsAcrossBatchesRequest:
properties:
destBatchID:
description: 目标猪批次ID
type: integer
fromPenID:
description: 源猪栏ID
type: integer
quantity:
description: 调栏猪只数量
minimum: 1
type: integer
remarks:
description: 备注
type: string
toPenID:
description: 目标猪栏ID
type: integer
required:
- destBatchID
- fromPenID
- quantity
- toPenID
type: object
dto.TransferPigsWithinBatchRequest:
properties:
fromPenID:
description: 源猪栏ID
type: integer
quantity:
description: 调栏猪只数量
minimum: 1
type: integer
remarks:
description: 备注
type: string
toPenID:
description: 目标猪栏ID
type: integer
required:
- fromPenID
- quantity
- toPenID
type: object
2025-10-03 23:59:25 +08:00
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.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.UpdatePenRequest:
properties:
capacity:
type: integer
house_id:
type: integer
pen_number:
type: string
status:
2025-10-04 01:31:35 +08:00
allOf:
- $ref: '#/definitions/models.PenStatus'
description: 添加oneof校验
enum:
- 空闲
- 使用中
- 病猪栏
- 康复栏
- 清洗消毒
- 维修中
2025-10-03 23:59:25 +08:00
required:
- capacity
- house_id
- pen_number
- status
type: object
2025-10-04 01:31:35 +08:00
dto.UpdatePenStatusRequest:
properties:
status:
allOf:
- $ref: '#/definitions/models.PenStatus'
enum:
- 空闲
- 使用中
- 病猪栏
- 康复栏
- 清洗消毒
- 维修中
example: 病猪栏
required:
- status
type: object
2025-10-03 23:59:25 +08:00
dto.UpdatePigHouseRequest:
properties:
description:
type: string
name:
type: string
required:
- name
type: object
dto.UpdatePlanRequest:
properties:
cron_expression:
example: 0 0 6 * * *
type: string
description:
example: 更新后的描述
type: string
execute_num:
example: 10
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
models.DeviceCategory:
enum:
- 执行器
- 传感器
type: string
x-enum-varnames:
- CategoryActuator
- CategorySensor
models.PenStatus:
enum:
- 空闲
2025-10-04 01:31:35 +08:00
- 使用中
2025-10-03 23:59:25 +08:00
- 病猪栏
- 康复栏
- 清洗消毒
- 维修中
type: string
x-enum-varnames:
- PenStatusEmpty
- PenStatusOccupied
- PenStatusSickPen
- PenStatusRecovering
- PenStatusCleaning
- PenStatusUnderMaint
models.PigBatchOriginType:
enum:
- 自繁
- 外购
type: string
x-enum-varnames:
- OriginTypeSelfFarrowed
- OriginTypePurchased
2025-10-06 23:22:47 +08:00
models.PigBatchSickPigTreatmentLocation:
enum:
- 原地治疗
- 病猪栏治疗
type: string
x-enum-varnames:
- TreatmentLocationOnSite
- TreatmentLocationSickBay
2025-10-03 23:59:25 +08:00
models.PigBatchStatus:
enum:
- 保育
- 生长
- 育肥
- 待售
- 已出售
- 已归档
type: string
x-enum-comments:
BatchStatusArchived: 批次结束(如全群淘汰等)
BatchStatusFinishing: 最后的育肥阶段
BatchStatusForSale: 达到出栏标准
BatchStatusGrowing: 生长育肥阶段
BatchStatusWeaning: 从断奶到保育结束
x-enum-descriptions:
- 从断奶到保育结束
- 生长育肥阶段
- 最后的育肥阶段
- 达到出栏标准
- ""
- 批次结束(如全群淘汰等)
x-enum-varnames:
- BatchStatusWeaning
- BatchStatusGrowing
- BatchStatusFinishing
- BatchStatusForSale
- BatchStatusSold
- BatchStatusArchived
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.SensorType:
enum:
- 信号强度
- 电池电量
- 温度
- 湿度
- 重量
type: string
x-enum-comments:
SensorTypeBatteryLevel: 电池电量
SensorTypeHumidity: 湿度
SensorTypeSignalMetrics: 信号强度
SensorTypeTemperature: 温度
SensorTypeWeight: 重量
x-enum-descriptions:
- 信号强度
- 电池电量
- 温度
- 湿度
- 重量
x-enum-varnames:
- SensorTypeSignalMetrics
- SensorTypeBatteryLevel
- SensorTypeTemperature
- SensorTypeHumidity
- SensorTypeWeight
models.TaskType:
enum:
- 计划分析
- 等待
- 下料
type: string
x-enum-comments:
TaskPlanAnalysis: 解析Plan的Task列表并添加到待执行队列的特殊任务
TaskTypeReleaseFeedWeight: 下料口释放指定重量任务
TaskTypeWaiting: 等待任务
x-enum-descriptions:
- 解析Plan的Task列表并添加到待执行队列的特殊任务
- 等待任务
- 下料口释放指定重量任务
x-enum-varnames:
- TaskPlanAnalysis
- TaskTypeWaiting
- TaskTypeReleaseFeedWeight
models.ValueDescriptor:
properties:
multiplier:
description: 乘数,用于原始数据转换
type: number
offset:
description: 偏移量,用于原始数据转换
type: number
type:
$ref: '#/definitions/models.SensorType'
type: object
info:
contact: {}
paths:
/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
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
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'
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
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
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
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
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'
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
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
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
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
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'
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
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
summary: 更新设备信息
tags:
- 设备管理
2025-10-13 12:16:36 +08:00
/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'
summary: 手动控制设备
tags:
- 设备管理
2025-10-03 23:59:25 +08:00
/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
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
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'
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
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
summary: 更新猪栏
tags:
- 猪场管理
2025-10-04 01:31:35 +08:00
/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
summary: 更新猪栏状态
tags:
- 猪场管理
2025-10-03 23:59:25 +08:00
/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
summary: 获取猪批次列表
tags:
2025-10-06 23:22:47 +08:00
- 猪群管理
2025-10-03 23:59:25 +08:00
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
summary: 创建猪批次
tags:
2025-10-06 23:22:47 +08:00
- 猪群管理
2025-10-03 23:59:25 +08:00
/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'
summary: 删除猪批次
tags:
2025-10-06 23:22:47 +08:00
- 猪群管理
2025-10-03 23:59:25 +08:00
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
summary: 获取单个猪批次
tags:
2025-10-06 23:22:47 +08:00
- 猪群管理
2025-10-03 23:59:25 +08:00
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
summary: 更新猪批次
tags:
2025-10-06 23:22:47 +08:00
- 猪群管理
2025-10-13 12:16:36 +08:00
/api/v1/pig-batches/assign-pens/{id}:
2025-10-06 23:10:58 +08:00
post:
2025-10-04 00:47:27 +08:00
consumes:
- application/json
2025-10-06 23:10:58 +08:00
description: 将一个或多个空闲猪栏分配给指定的猪批次
2025-10-04 00:47:27 +08:00
parameters:
- description: 猪批次ID
in: path
name: id
required: true
type: integer
2025-10-06 23:10:58 +08:00
- description: 待分配的猪栏ID列表
2025-10-04 00:47:27 +08:00
in: body
name: body
required: true
schema:
2025-10-06 23:10:58 +08:00
$ref: '#/definitions/dto.AssignEmptyPensToBatchRequest'
2025-10-04 00:47:27 +08:00
produces:
- application/json
responses:
"200":
2025-10-06 23:10:58 +08:00
description: 分配成功
schema:
$ref: '#/definitions/controller.Response'
summary: 为猪批次分配空栏
tags:
2025-10-06 23:22:47 +08:00
- 猪群管理
2025-10-13 12:16:36 +08:00
/api/v1/pig-batches/buy-pigs/{id}:
2025-10-06 23:22:47 +08:00
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'
summary: 处理买猪的业务逻辑
tags:
2025-10-13 12:16:36 +08:00
- 猪群管理
/api/v1/pig-batches/move-pigs-into-pen/{id}:
2025-10-06 23:10:58 +08:00
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: 移入成功
2025-10-04 00:47:27 +08:00
schema:
$ref: '#/definitions/controller.Response'
2025-10-06 23:10:58 +08:00
summary: 将猪只从“虚拟库存”移入指定猪栏
2025-10-04 00:47:27 +08:00
tags:
2025-10-06 23:22:47 +08:00
- 猪群管理
2025-10-13 12:16:36 +08:00
/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'
summary: 将猪栏划拨到新批次
tags:
- 猪群管理
/api/v1/pig-batches/record-cull/{id}:
2025-10-06 23:22:47 +08:00
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'
summary: 记录正常猪只淘汰事件
tags:
2025-10-13 12:16:36 +08:00
- 猪群管理
/api/v1/pig-batches/record-death/{id}:
2025-10-06 23:22:47 +08:00
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'
summary: 记录正常猪只死亡事件
tags:
2025-10-13 12:16:36 +08:00
- 猪群管理
/api/v1/pig-batches/record-sick-pig-cull/{id}:
2025-10-06 23:22:47 +08:00
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'
summary: 记录病猪淘汰事件
tags:
2025-10-13 12:16:36 +08:00
- 猪群管理
/api/v1/pig-batches/record-sick-pig-death/{id}:
2025-10-06 23:22:47 +08:00
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'
summary: 记录病猪死亡事件
tags:
2025-10-13 12:16:36 +08:00
- 猪群管理
/api/v1/pig-batches/record-sick-pig-recovery/{id}:
2025-10-06 23:22:47 +08:00
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'
summary: 记录病猪康复事件
tags:
2025-10-13 12:16:36 +08:00
- 猪群管理
/api/v1/pig-batches/record-sick-pigs/{id}:
2025-10-06 23:22:47 +08:00
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'
summary: 记录新增病猪事件
tags:
2025-10-13 12:16:36 +08:00
- 猪群管理
/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'
summary: 从猪批次移除空栏
tags:
- 猪群管理
/api/v1/pig-batches/sell-pigs/{id}:
2025-10-06 23:22:47 +08:00
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'
summary: 处理卖猪的业务逻辑
tags:
2025-10-13 12:16:36 +08:00
- 猪群管理
/api/v1/pig-batches/transfer-across-batches/{sourceBatchID}:
2025-10-06 23:22:47 +08:00
post:
consumes:
- application/json
2025-10-13 12:16:36 +08:00
description: 将指定数量的猪只从一个猪群的猪栏调动到另一个猪群的猪栏
2025-10-06 23:22:47 +08:00
parameters:
2025-10-13 12:16:36 +08:00
- description: 源猪批次ID
2025-10-06 23:22:47 +08:00
in: path
2025-10-13 12:16:36 +08:00
name: sourceBatchID
2025-10-06 23:22:47 +08:00
required: true
type: integer
2025-10-13 12:16:36 +08:00
- description: 跨群调栏请求信息
2025-10-06 23:22:47 +08:00
in: body
name: body
required: true
schema:
2025-10-13 12:16:36 +08:00
$ref: '#/definitions/dto.TransferPigsAcrossBatchesRequest'
2025-10-06 23:22:47 +08:00
produces:
- application/json
responses:
"200":
description: 调栏成功
schema:
$ref: '#/definitions/controller.Response'
2025-10-13 12:16:36 +08:00
summary: 跨猪群调栏
2025-10-06 23:22:47 +08:00
tags:
2025-10-13 12:16:36 +08:00
- 猪群管理
/api/v1/pig-batches/transfer-within-batch/{id}:
2025-10-06 23:22:47 +08:00
post:
consumes:
- application/json
2025-10-13 12:16:36 +08:00
description: 将指定数量的猪只在同一个猪群的不同猪栏间调动
2025-10-06 23:22:47 +08:00
parameters:
2025-10-13 12:16:36 +08:00
- description: 猪批次ID
2025-10-06 23:22:47 +08:00
in: path
2025-10-13 12:16:36 +08:00
name: id
2025-10-06 23:22:47 +08:00
required: true
type: integer
2025-10-13 12:16:36 +08:00
- description: 群内调栏请求信息
2025-10-06 23:22:47 +08:00
in: body
name: body
required: true
schema:
2025-10-13 12:16:36 +08:00
$ref: '#/definitions/dto.TransferPigsWithinBatchRequest'
2025-10-06 23:22:47 +08:00
produces:
- application/json
responses:
"200":
description: 调栏成功
schema:
$ref: '#/definitions/controller.Response'
2025-10-13 12:16:36 +08:00
summary: 群内调栏
2025-10-06 23:22:47 +08:00
tags:
2025-10-13 12:16:36 +08:00
- 猪群管理
2025-10-03 23:59:25 +08:00
/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
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
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'
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
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
summary: 更新猪舍
tags:
- 猪场管理
/api/v1/plans:
get:
description: 获取所有计划的列表
produces:
- application/json
responses:
"200":
description: 业务码为200代表成功获取列表
schema:
allOf:
- $ref: '#/definitions/controller.Response'
- properties:
data:
items:
$ref: '#/definitions/dto.PlanResponse'
type: array
type: object
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
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'
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
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
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'
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'
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}/history:
get:
description: 根据用户ID分页获取该用户的操作审计日志。
parameters:
- description: 用户ID
in: path
name: id
required: true
type: integer
- default: 1
description: 页码
in: query
name: page
type: integer
- default: 10
description: 每页大小
in: query
name: page_size
type: integer
- description: 按操作类型过滤
in: query
name: action_type
type: string
produces:
- application/json
responses:
"200":
description: 业务码为200代表成功获取
schema:
allOf:
- $ref: '#/definitions/controller.Response'
- properties:
data:
$ref: '#/definitions/dto.ListHistoryResponse'
type: object
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:
- 用户管理
swagger: "2.0"