fusenapi/model/gmodel/fs_product_design_logic.go
laodaming 7ef6f453dc fix
2023-06-20 17:28:28 +08:00

21 lines
641 B
Go
Executable File

package gmodel
import (
"context"
)
func (d *FsProductDesignModel) FindOneBySn(ctx context.Context, sn string, userId int64) (resp *FsProductDesign, err error) {
err = d.db.WithContext(ctx).Model(&FsProductDesign{}).Where("`sn` = ? and `user_id` = ? and `status` = ?", sn, userId, 1).First(&resp).Error
return resp, err
}
func (d *FsProductDesignModel) GetAllByIds(ctx context.Context, ids []int64) (resp []FsProductDesign, err error) {
if len(ids) == 0 {
return
}
err = d.db.WithContext(ctx).Model(&FsProductDesign{}).Where("`id` in (?) and `status` = ?", ids, 1).Find(&resp).Error
if err != nil {
return nil, err
}
return
}