fusenapi/model/gmodel/fs_order_detail_logic.go

31 lines
1.3 KiB
Go
Raw Permalink Normal View History

2023-06-16 07:11:37 +00:00
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
2023-07-06 09:43:07 +00:00
return resp, err
2023-06-16 07:11:37 +00:00
}
2023-06-28 09:05:31 +00:00
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
}
2023-07-06 09:43:07 +00:00
func (od *FsOrderDetailModel) GetOneOrderDetailByOrderId(ctx context.Context, orderId int64) (resp *FsOrderDetail, err error) {
err = od.db.WithContext(ctx).Model(&FsOrderDetail{}).Where("`order_id` = ?", orderId).Take(&resp).Error
return resp, err
}
func (d *FsProductDesignModel) FindOne(ctx context.Context, id int64, userId int64) (resp *FsProductDesign, err error) {
err = d.db.WithContext(ctx).Model(&FsProductDesign{}).Where("`id` = ? and `user_id` = ? and `status` = ?", id, userId, 1).First(&resp).Error
return resp, err
}
func (m *FsOrderDetailModel) TableName() string {
return m.name
}