39 lines
1.5 KiB
Go
39 lines
1.5 KiB
Go
|
package gmodel
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"gorm.io/gorm"
|
||
|
)
|
||
|
|
||
|
type FsOrderDetailTemplate struct {
|
||
|
Id int64 `gorm:"primary_key" json:"id"`
|
||
|
Sn *string `gorm:"default:''" json:"sn"` // 唯一编码
|
||
|
ProductId *int64 `gorm:"default:0" json:"product_id"` // 产品ID
|
||
|
ModelId *int64 `gorm:"default:0" json:"model_id"` // 模型ID
|
||
|
TemplateId *int64 `gorm:"default:0" json:"template_id"` // 模板ID
|
||
|
MaterialId *int64 `gorm:"default:0" json:"material_id"` // 材质id
|
||
|
SizeId *int64 `gorm:"default:0" json:"size_id"` // 尺寸id
|
||
|
EachBoxNum *int64 `gorm:"default:0" json:"each_box_num"` // 每一箱的个数
|
||
|
EachBoxWeight *float64 `gorm:"default:0.00" json:"each_box_weight"` // 每一箱的重量 单位KG
|
||
|
DesignId *int64 `gorm:"default:0" json:"design_id"` // 设计ID
|
||
|
Ctime *int64 `gorm:"default:0" json:"ctime"` // 添加时间
|
||
|
}
|
||
|
type FsOrderDetailTemplateModel struct {
|
||
|
db *gorm.DB
|
||
|
}
|
||
|
|
||
|
func NewFsOrderDetailTemplateModel(db *gorm.DB) *FsOrderDetailTemplateModel {
|
||
|
return &FsOrderDetailTemplateModel{db}
|
||
|
}
|
||
|
|
||
|
func (dt *FsOrderDetailTemplateModel) GetListByIds(ctx context.Context, ids []int64) (resp []FsOrderDetailTemplate, err error) {
|
||
|
if len(ids) == 0 {
|
||
|
return
|
||
|
}
|
||
|
err = dt.db.WithContext(ctx).Model(&FsOrderDetailTemplate{}).Where("`id` in (?)", ids).Find(&resp).Error
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
return
|
||
|
}
|