store.go 455 B

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