feat providerArticle添加find方法
This commit is contained in:
parent
3eb2ed0d82
commit
7104275251
@ -13,6 +13,7 @@ type ProviderArticleApi interface {
|
||||
Update(providerArticle v2.ProviderArticle, selects ...string) error
|
||||
BatchUpdate(articles []v2.ProviderArticle) error
|
||||
AutoMigrate() error
|
||||
Find(query *GetProviderArticleQuery) (articles []v2.ProviderArticle, err error)
|
||||
List(query PageListQuery, scopes ...func(db *gorm.DB) *gorm.DB) (articles []v2.ProviderArticle, total int64, err error)
|
||||
FindInBatches(query *GetProviderArticleQuery, results *[]v2.ProviderArticle, f func(tx *gorm.DB, batch int) error) error
|
||||
ProviderPrice(providerArticleID uint) (history []v2.ProviderPrice, err error)
|
||||
@ -136,6 +137,11 @@ func (p *providerArticleApi) List(query PageListQuery, scopes ...func(db *gorm.D
|
||||
return
|
||||
}
|
||||
|
||||
func (p *providerArticleApi) Find(query *GetProviderArticleQuery) (articles []v2.ProviderArticle, err error) {
|
||||
err = p.db.Scopes(query.Scope).Find(&articles).Error
|
||||
return
|
||||
}
|
||||
|
||||
// 批量更新,更新价格时用到
|
||||
func (p *providerArticleApi) BatchUpdate(articles []v2.ProviderArticle) error {
|
||||
return p.db.Select("id", "cost").Save(&articles).Error
|
||||
|
Loading…
Reference in New Issue
Block a user