fusenapi/model/gmodel/fs_product_template_v2_logic.go

32 lines
1005 B
Go
Raw Normal View History

2023-06-16 07:11:37 +00:00
package gmodel
import (
"context"
)
func (t *FsProductTemplateV2Model) FindAllByProductIds(ctx context.Context, productIds []int64) (resp []FsProductTemplateV2, err error) {
if len(productIds) == 0 {
return
}
2023-06-19 04:23:02 +00:00
err = t.db.WithContext(ctx).Model(&FsProductTemplateV2{}).Where("`product_id` in (?) and `is_del` = ? and `status` = ?", productIds, 0, 1).Find(&resp).Error
2023-06-16 07:11:37 +00:00
if err != nil {
return nil, err
}
return
}
2023-06-19 04:23:02 +00:00
func (t *FsProductTemplateV2Model) FindAllByIds(ctx context.Context, ids []int64) (resp []FsProductTemplateV2, err error) {
if len(ids) == 0 {
return
}
err = t.db.WithContext(ctx).Model(&FsProductTemplateV2{}).Where("`id` in (?) and `is_del` = ? and `status` = ?", ids, 0, 1).Find(&resp).Error
if err != nil {
return nil, err
}
return
}
2023-06-20 09:28:28 +00:00
func (t *FsProductTemplateV2Model) FindOne(ctx context.Context, id int64) (resp *FsProductTemplateV2, err error) {
2023-06-19 04:23:02 +00:00
2023-06-19 06:47:54 +00:00
err = t.db.WithContext(ctx).Model(&FsProductTemplateV2{}).Where("`id` = ? ", id).Find(&resp).Error
2023-06-20 09:28:28 +00:00
return resp, err
2023-06-19 04:23:02 +00:00
}