...
|
...
|
@@ -96,15 +96,25 @@ func (repository *BusinessBonusRepository) Find(queryOptions domain.BusinessBonu |
|
|
businessBonusModels []models.BusinessBonus
|
|
|
)
|
|
|
query := tx.Model(&businessBonusModels)
|
|
|
if queryOptions.Offset > -1 {
|
|
|
query = query.Offset(queryOptions.Offset)
|
|
|
}
|
|
|
if queryOptions.Limit > 0 {
|
|
|
query = query.Limit(queryOptions.Limit)
|
|
|
} else {
|
|
|
query = query.Limit(1000)
|
|
|
}
|
|
|
|
|
|
if cnt, err = query.SelectAndCount(); err != nil {
|
|
|
return 0, businessBonuss, err
|
|
|
}
|
|
|
|
|
|
for i := range businessBonusModels {
|
|
|
if businessBonus, err := repository.transformPgModelToDomainModel(&businessBonusModels[i]); err != nil {
|
|
|
businessBonus, err := repository.transformPgModelToDomainModel(&businessBonusModels[i])
|
|
|
if err != nil {
|
|
|
return 0, businessBonuss, err
|
|
|
} else {
|
|
|
businessBonuss = append(businessBonuss, businessBonus)
|
|
|
}
|
|
|
businessBonuss = append(businessBonuss, businessBonus)
|
|
|
}
|
|
|
return cnt, businessBonuss, nil
|
|
|
} |
...
|
...
|
|