feat 供应商商品添加更新状态

This commit is contained in:
timerzz 2024-11-19 14:57:55 +08:00
parent 217039202d
commit 566d95bc0f

View File

@ -15,6 +15,7 @@ type ProviderArticleApi interface {
AutoMigrate() error
FindInBatches(query *GetProviderArticleQuery, results *[]v2.ProviderArticle, f func(tx *gorm.DB, batch int) error) error
ProviderPrice(providerArticleID uint) (history []v2.ProviderPrice, err error)
UpdateStatus(article v2.ProviderArticle) error
}
type providerArticleApi struct {
@ -98,6 +99,9 @@ func (p *providerArticleApi) Upsert(article v2.ProviderArticle) error {
}
return nil
}
func (p *providerArticleApi) UpdateStatus(article v2.ProviderArticle) error {
return p.db.Where("id=?", article.ID).Select("status").Updates(&article).Error
}
func (p *providerArticleApi) FindInBatches(query *GetProviderArticleQuery, results *[]v2.ProviderArticle, f func(tx *gorm.DB, batch int) error) error {
err := p.db.Scopes(query.Scope).Preload("CalculateProcess").FindInBatches(results, 20, f).Error