feat 通过sellerId和providerId获取对象
This commit is contained in:
parent
55f4cbdd6b
commit
56c30cfe59
@ -12,6 +12,7 @@ import (
|
||||
|
||||
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)
|
||||
Create(provider v2.Provider) error
|
||||
Update(provider v2.Provider) error
|
||||
@ -51,6 +52,11 @@ func (p *providerApi) Get(id uint) (provider v2.Provider, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (p *providerApi) GetByProvider(providerId v2.ProviderId) (provider v2.Provider, err error) {
|
||||
err = p.db.Where("provider_id = ?", providerId).Preload("CalculateProcess").First(&provider).Error
|
||||
return
|
||||
}
|
||||
|
||||
func (p *providerApi) List(query PageListQuery) (providers []v2.Provider, total int64, err error) {
|
||||
err = p.db.Scopes(query.Scoper.Scope).Model(&v2.Provider{}).Count(&total).Error
|
||||
if err != nil {
|
||||
|
@ -12,6 +12,7 @@ import (
|
||||
|
||||
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)
|
||||
Create(seller v2.Seller) error
|
||||
Update(seller v2.Seller) error
|
||||
@ -51,6 +52,11 @@ func (p *sellerApi) Get(id uint) (seller v2.Seller, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (p *sellerApi) GetBySellerId(sellerId v2.SellerId) (seller v2.Seller, err error) {
|
||||
err = p.db.Where("seller_id = ?", sellerId).Preload("CalculateProcess").First(&seller).Error
|
||||
return
|
||||
}
|
||||
|
||||
func (p *sellerApi) List(query PageListQuery) (sellers []v2.Seller, total int64, err error) {
|
||||
err = p.db.Scopes(query.Scoper.Scope).Model(&v2.Seller{}).Count(&total).Error
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user