feat 添加api获取所有满足条件的供应商和销售商
This commit is contained in:
parent
d24fecebdb
commit
fb9918e266
@ -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("标识为空")
|
||||
|
@ -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("标识为空")
|
||||
|
Loading…
Reference in New Issue
Block a user