fix(distribution): 统一分销订单租户管理口径
This commit is contained in:
@@ -19,8 +19,10 @@ func (r *Repository) FindTenantOffer(ctx context.Context, listingID uint64) (*Te
|
||||
}
|
||||
var listing model.RentalListing
|
||||
if err := r.db.WithContext(ctx).
|
||||
Select("id, price_cent").
|
||||
Where("id = ? AND (distribution_site_id IS NULL OR distribution_site_id = 0)", listingID).
|
||||
Table("rental_listings AS l").
|
||||
Select("l.id, l.price_cent").
|
||||
Joins("JOIN tenant_listing_offers AS tlo ON tlo.listing_id = l.id AND tlo.tenant_id = ?", tenantID).
|
||||
Where("l.id = ?", listingID).
|
||||
First(&listing).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -54,8 +56,10 @@ func (r *Repository) UpdateTenantOffer(
|
||||
}
|
||||
var listing model.RentalListing
|
||||
if err := r.db.WithContext(ctx).
|
||||
Select("id, price_cent").
|
||||
Where("id = ? AND (distribution_site_id IS NULL OR distribution_site_id = 0)", listingID).
|
||||
Table("rental_listings AS l").
|
||||
Select("l.id, l.price_cent").
|
||||
Joins("JOIN tenant_listing_offers AS tlo ON tlo.listing_id = l.id AND tlo.tenant_id = ?", tenantID).
|
||||
Where("l.id = ?", listingID).
|
||||
First(&listing).Error; err != nil {
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return nil, ErrListingNotFound
|
||||
|
||||
Reference in New Issue
Block a user