59 lines
2.1 KiB
Go
59 lines
2.1 KiB
Go
package dto
|
|
|
|
import (
|
|
"fmt"
|
|
"hospital-admin-api/api/model"
|
|
)
|
|
|
|
type OrderProductLogisticsDto struct {
|
|
LogisticsId string `json:"logistics_id"` // 主键id
|
|
OrderProductId string `json:"order_product_id"` // 药品订单id;NOT NULL
|
|
LogisticsStatus int `json:"logistics_status"` // 运单签收状态(0在途 1揽收 2疑难 3签收 4退签 5派件 8清关 14拒签);NOT NULL
|
|
LogisticsNo string `json:"logistics_no"` // 物流编号
|
|
CompanyName string `json:"company_name"` // 快递公司名称
|
|
CompanyCode string `json:"company_code"` // 快递公司编码
|
|
LogisticsContent string `json:"logistics_content"` // 内容
|
|
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
|
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
|
}
|
|
|
|
func GetOrderProductLogisticsDto(m *model.OrderProductLogistics) *OrderProductLogisticsDto {
|
|
return &OrderProductLogisticsDto{
|
|
LogisticsId: fmt.Sprintf("%d", m.LogisticsId),
|
|
OrderProductId: fmt.Sprintf("%d", m.OrderProductId),
|
|
LogisticsStatus: m.LogisticsStatus,
|
|
LogisticsNo: m.LogisticsNo,
|
|
CompanyName: m.CompanyName,
|
|
CompanyCode: m.CompanyCode,
|
|
LogisticsContent: m.LogisticsContent,
|
|
CreatedAt: m.CreatedAt,
|
|
UpdatedAt: m.UpdatedAt,
|
|
}
|
|
}
|
|
|
|
func GetOrderProductLogisticsListDto(m []*model.OrderProductLogistics) []OrderProductLogisticsDto {
|
|
// 处理返回值
|
|
responses := make([]OrderProductLogisticsDto, len(m))
|
|
|
|
if len(m) > 0 {
|
|
for i, v := range m {
|
|
response := OrderProductLogisticsDto{
|
|
LogisticsId: fmt.Sprintf("%d", v.LogisticsId),
|
|
OrderProductId: fmt.Sprintf("%d", v.OrderProductId),
|
|
LogisticsStatus: v.LogisticsStatus,
|
|
LogisticsNo: v.LogisticsNo,
|
|
CompanyName: v.CompanyName,
|
|
CompanyCode: v.CompanyCode,
|
|
LogisticsContent: v.LogisticsContent,
|
|
CreatedAt: v.CreatedAt,
|
|
UpdatedAt: v.UpdatedAt,
|
|
}
|
|
|
|
// 将转换后的结构体添加到新切片中
|
|
responses[i] = response
|
|
}
|
|
}
|
|
|
|
return responses
|
|
}
|