使用枚举
This commit is contained in:
@@ -41,7 +41,7 @@ func ConvertStockLogToDTO(log *models.RawMaterialStockLog) *StockLogResponse {
|
||||
ChangeAmount: log.ChangeAmount,
|
||||
BeforeQuantity: log.BeforeQuantity,
|
||||
AfterQuantity: log.AfterQuantity,
|
||||
SourceType: string(log.SourceType),
|
||||
SourceType: log.SourceType,
|
||||
SourceID: log.SourceID,
|
||||
HappenedAt: log.HappenedAt,
|
||||
Remarks: log.Remarks,
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
package dto
|
||||
|
||||
import "time"
|
||||
import (
|
||||
"time"
|
||||
|
||||
"git.huangwc.com/pig/pig-farm-controller/internal/infra/models"
|
||||
)
|
||||
|
||||
// =============================================================================================================
|
||||
// 库存 (Inventory) 相关 DTO
|
||||
@@ -37,27 +41,27 @@ type ListCurrentStockResponse struct {
|
||||
|
||||
// StockLogResponse 库存变动历史记录的响应体
|
||||
type StockLogResponse struct {
|
||||
ID uint32 `json:"id"`
|
||||
RawMaterialID uint32 `json:"raw_material_id"`
|
||||
RawMaterialName string `json:"raw_material_name"`
|
||||
ChangeAmount float32 `json:"change_amount"`
|
||||
BeforeQuantity float32 `json:"before_quantity"`
|
||||
AfterQuantity float32 `json:"after_quantity"`
|
||||
SourceType string `json:"source_type"`
|
||||
SourceID *uint32 `json:"source_id,omitempty"`
|
||||
HappenedAt time.Time `json:"happened_at"`
|
||||
Remarks string `json:"remarks"`
|
||||
ID uint32 `json:"id"`
|
||||
RawMaterialID uint32 `json:"raw_material_id"`
|
||||
RawMaterialName string `json:"raw_material_name"`
|
||||
ChangeAmount float32 `json:"change_amount"`
|
||||
BeforeQuantity float32 `json:"before_quantity"`
|
||||
AfterQuantity float32 `json:"after_quantity"`
|
||||
SourceType models.StockLogSourceType `json:"source_type"`
|
||||
SourceID *uint32 `json:"source_id,omitempty"`
|
||||
HappenedAt time.Time `json:"happened_at"`
|
||||
Remarks string `json:"remarks"`
|
||||
}
|
||||
|
||||
// ListStockLogRequest 定义了获取库存变动历史的请求参数
|
||||
type ListStockLogRequest struct {
|
||||
Page int `json:"page" query:"page"` // 页码
|
||||
PageSize int `json:"page_size" query:"page_size"` // 每页数量
|
||||
RawMaterialID *uint32 `json:"raw_material_id" query:"raw_material_id"` // 按原料ID精确查询
|
||||
SourceTypes []string `json:"source_types" query:"source_types"` // 按来源类型查询
|
||||
StartTime *string `json:"start_time" query:"start_time"` // 开始时间 (RFC3339格式, e.g., "2023-01-01T00:00:00Z")
|
||||
EndTime *string `json:"end_time" query:"end_time"` // 结束时间 (RFC3339格式)
|
||||
OrderBy string `json:"order_by" query:"order_by"` // 排序字段
|
||||
Page int `json:"page" query:"page"` // 页码
|
||||
PageSize int `json:"page_size" query:"page_size"` // 每页数量
|
||||
RawMaterialID *uint32 `json:"raw_material_id" query:"raw_material_id"` // 按原料ID精确查询
|
||||
SourceTypes []models.StockLogSourceType `json:"source_types" query:"source_types"` // 按来源类型查询
|
||||
StartTime *string `json:"start_time" query:"start_time"` // 开始时间 (RFC3339格式, e.g., "2023-01-01T00:00:00Z")
|
||||
EndTime *string `json:"end_time" query:"end_time"` // 结束时间 (RFC3339格式)
|
||||
OrderBy string `json:"order_by" query:"order_by"` // 排序字段
|
||||
}
|
||||
|
||||
// ListStockLogResponse 是获取库存变动历史列表的响应结构
|
||||
|
||||
Reference in New Issue
Block a user