fusenapi/model/gmodel/fs_order_detail_template_logic.go
laodaming 2b1728aac5 fix
2023-07-06 17:43:07 +08:00

28 lines
1.0 KiB
Go
Executable File

package gmodel
import (
"context"
)
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
}
func (dt *FsOrderDetailTemplateModel) FindOneBySn(ctx context.Context, sn string) (resp *FsOrderDetailTemplate, err error) {
err = dt.db.WithContext(ctx).Model(&FsOrderDetailTemplate{}).Where("`sn` = ?", sn).Take(&resp).Error
return resp, err
}
func (dt *FsOrderDetailTemplateModel) Create(ctx context.Context, data *FsOrderDetailTemplate) error {
return dt.db.WithContext(ctx).Model(&FsOrderDetailTemplate{}).Create(&data).Error
}
func (dt *FsOrderDetailTemplateModel) FindOne(ctx context.Context, id int64) (resp *FsOrderDetailTemplate, err error) {
err = dt.db.WithContext(ctx).Model(&FsOrderDetailTemplate{}).Where("`id` = ?", id).Take(&resp).Error
return resp, err
}