feat 添加api获取所有满足条件的供应商和销售商

This commit is contained in:
timerzz 2024-09-06 17:22:28 +08:00
parent d24fecebdb
commit fb9918e266
2 changed files with 12 additions and 0 deletions

View File

@ -14,6 +14,7 @@ type ProviderApi interface {
Get(id uint) (provider v2.Provider, err error)
GetByProvider(providerId v2.ProviderId) (provider v2.Provider, err error)
List(query PageListQuery) (providers []v2.Provider, total int64, err error)
Find(query Scoper) (providers []v2.Provider, err error)
Create(provider v2.Provider) error
Update(provider v2.Provider) error
UpdateStatus(provider v2.Provider) error
@ -67,6 +68,11 @@ func (p *providerApi) List(query PageListQuery) (providers []v2.Provider, total
return
}
func (p *providerApi) Find(query Scoper) (providers []v2.Provider, err error) {
err = p.db.Scopes(query.Scope).Order("id DESC").Find(&providers).Error
return
}
func (p *providerApi) Create(provider v2.Provider) error {
if provider.ProviderId == "" {
return fmt.Errorf("标识为空")

View File

@ -14,6 +14,7 @@ type SellerApi interface {
Get(id uint) (seller v2.Seller, err error)
GetBySellerId(sellerId v2.SellerId) (seller v2.Seller, err error)
List(query PageListQuery) (sellers []v2.Seller, total int64, err error)
Find(query Scoper) (sellers []v2.Seller, err error)
Create(seller v2.Seller) error
Update(seller v2.Seller) error
UpdateStatus(seller v2.Seller) error
@ -67,6 +68,11 @@ func (p *sellerApi) List(query PageListQuery) (sellers []v2.Seller, total int64,
return
}
func (p *sellerApi) Find(query Scoper) (sellers []v2.Seller, err error) {
err = p.db.Scopes(query.Scope).Order("id DESC").Find(&sellers).Error
return
}
func (p *sellerApi) Create(seller v2.Seller) error {
if seller.SellerId == "" {
return fmt.Errorf("标识为空")