team_buying.go 505 B

123456789101112131415161718
  1. package db
  2. import (
  3. "context"
  4. "youngee_b_api/model/gorm_model"
  5. )
  6. // FindTeamById 根据团购ID查找门店信息
  7. func FindTeamById(ctx context.Context, teamId int) (*gorm_model.YounggeeTeamBuying, error) {
  8. db := GetReadDB(ctx)
  9. var teamInfo *gorm_model.YounggeeTeamBuying
  10. whereCondition := gorm_model.YounggeeTeamBuying{TeamBuyingId: teamId}
  11. err := db.Model(gorm_model.YounggeeTeamBuying{}).Where(whereCondition).Find(&teamInfo).Error
  12. if err != nil {
  13. return nil, err
  14. }
  15. return teamInfo, nil
  16. }