fusenapi/model/gmodel/fs_order_detail_template_logic.go

36 lines
1.2 KiB
Go
Raw Normal View History

2023-06-16 07:11:37 +00:00
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
}
2023-06-28 09:05:31 +00:00
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
}
2023-07-06 09:43:07 +00:00
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
}
2023-07-24 10:04:24 +00:00
2023-08-10 11:08:06 +00:00
func (dt *FsOrderDetailTemplateModel) RBCreate(ctx context.Context, data *FsOrderDetailTemplate) error {
return dt.db.WithContext(ctx).Create(&data).Error
}
2023-07-24 10:04:24 +00:00
func (m *FsOrderDetailTemplateModel) TableName() string {
return m.name
}