40 lines
1.2 KiB
Go
40 lines
1.2 KiB
Go
package response
|
|
|
|
import "psi/models"
|
|
|
|
// SupplierListResponse 供应商列表响应
|
|
type SupplierListResponse struct {
|
|
List []SupplierItem `json:"list"`
|
|
Total int64 `json:"total"`
|
|
Page int `json:"page"`
|
|
PageSize int `json:"pageSize"`
|
|
}
|
|
|
|
// SupplierItem 供应商列表项
|
|
type SupplierItem struct {
|
|
ID int64 `json:"id"`
|
|
Code string `json:"code"`
|
|
Name string `json:"name"`
|
|
ContactPerson string `json:"contact_person"`
|
|
ContactPhone string `json:"contact_phone"`
|
|
Address string `json:"address"`
|
|
Status int8 `json:"status"`
|
|
CreatedAt int64 `json:"created_at"`
|
|
UpdatedAt int64 `json:"updated_at"`
|
|
}
|
|
|
|
// ConvertSupplierToItem 将供应商模型转换为响应项
|
|
func ConvertSupplierToItem(supplier models.Supplier) SupplierItem {
|
|
return SupplierItem{
|
|
ID: supplier.ID,
|
|
Code: supplier.Code,
|
|
Name: supplier.Name,
|
|
ContactPerson: supplier.ContactPerson,
|
|
ContactPhone: supplier.ContactPhone,
|
|
Address: supplier.Address,
|
|
Status: supplier.Status,
|
|
CreatedAt: supplier.CreatedAt,
|
|
UpdatedAt: supplier.UpdatedAt,
|
|
}
|
|
}
|