sub_account_dao.go 679 B

1234567891011121314151617181920212223
  1. package dao
  2. import "youngee_b_api/app/entity"
  3. type SubAccountDao struct{}
  4. func (d SubAccountDao) GetSubAccount(subAccountId int64) (*entity.SubAccount, error) {
  5. var subAccount entity.SubAccount
  6. err := Db.Model(&entity.SubAccount{}).Where("sub_account_id = ?", subAccountId).Select("sub_account_name, user_id").First(&subAccount).Error
  7. if err != nil {
  8. return nil, err
  9. }
  10. return &subAccount, nil
  11. }
  12. func (d SubAccountDao) GetSubAccountPhone(subAccountId int64) (string, error) {
  13. var phone string
  14. err := Db.Model(&entity.SubAccount{}).Where("sub_account_id = ?", subAccountId).Select("phone").First(&phone).Error
  15. if err != nil {
  16. return "", err
  17. }
  18. return phone, nil
  19. }