fusenapi/model/gmodel/fs_order_detail_template_logic.go
2023-08-10 19:08:06 +08:00

36 lines
1.2 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
}
func (dt *FsOrderDetailTemplateModel) RBCreate(ctx context.Context, data *FsOrderDetailTemplate) error {
return dt.db.WithContext(ctx).Create(&data).Error
}
func (m *FsOrderDetailTemplateModel) TableName() string {
return m.name
}