fusenapi/model/gmodel/fs_order_detail_logic.go
laodaming 6abca6b271 fix
2023-06-28 17:05:31 +08:00

21 lines
762 B
Go
Executable File

package gmodel
import (
"context"
)
func (od *FsOrderDetailModel) GetOrderDetailsByOrderId(ctx context.Context, orderId int64) (resp []FsOrderDetail, err error) {
err = od.db.WithContext(ctx).Model(&FsOrderDetail{}).Where("`order_id` = ?", orderId).Find(&resp).Error
if err != nil {
return nil, err
}
return
}
func (od *FsOrderDetailModel) FindOneByOrderDetailTemplateId(ctx context.Context, templateId int64) (resp *FsOrderDetail, err error) {
err = od.db.WithContext(ctx).Model(&FsOrderDetail{}).Where("`order_detail_template_id` = ?", templateId).Take(&resp).Error
return resp, err
}
func (od *FsOrderDetailModel) Create(ctx context.Context, data *FsOrderDetail) error {
return od.db.WithContext(ctx).Model(&FsOrderDetail{}).Create(&data).Error
}