fix
This commit is contained in:
@@ -52,15 +52,19 @@ func (t *FsProductTemplateV2Model) FindByParam(ctx context.Context, id int64, mo
|
||||
func (t *FsProductTemplateV2Model) Update(ctx context.Context, id int64, data *FsProductTemplateV2) error {
|
||||
return t.db.WithContext(ctx).Model(&FsProductTemplateV2{}).Where("`id` = ? ", id).Updates(&data).Error
|
||||
}
|
||||
func (t *FsProductTemplateV2Model) FindAllByModelIds(ctx context.Context, modelIds []int64) (resp []FsProductTemplateV2, err error) {
|
||||
func (t *FsProductTemplateV2Model) FindAllByModelIds(ctx context.Context, modelIds []int64, orderBy string, fields ...string) (resp []FsProductTemplateV2, err error) {
|
||||
if len(modelIds) == 0 {
|
||||
return
|
||||
}
|
||||
err = t.db.WithContext(ctx).Model(&FsProductTemplateV2{}).Where("`model_id` in (?) and `is_del` = ? and `status` = ?", modelIds, 0, 1).Find(&resp).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
db := t.db.WithContext(ctx).Model(&FsProductTemplateV2{}).Where("`model_id` in (?) and `is_del` = ? and `status` = ?", modelIds, 0, 1)
|
||||
switch orderBy {
|
||||
case "":
|
||||
db = db.Order("id DESC")
|
||||
default:
|
||||
db = db.Order(orderBy)
|
||||
}
|
||||
return
|
||||
err = db.Find(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
func (t *FsProductTemplateV2Model) FindAllByProductIdModelIds(ctx context.Context, modelIds []int64, productId int64) (resp []FsProductTemplateV2, err error) {
|
||||
if len(modelIds) == 0 {
|
||||
|
||||
Reference in New Issue
Block a user