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 (m *FsOrderDetailTemplateModel) TableName() string { return m.name }