business.go 585 B

12345678910111213141516171819202122232425
  1. package service
  2. import (
  3. "context"
  4. "go-common/app/interface/main/reply/model/reply"
  5. )
  6. // ListBusiness return all non-deleted business record.
  7. func (s *Service) ListBusiness(c context.Context) (business []*reply.Business, err error) {
  8. return s.dao.Business.ListBusiness(c)
  9. }
  10. // loadBusiness load business
  11. func (s *Service) loadBusiness() (err error) {
  12. var business []*reply.Business
  13. if business, err = s.ListBusiness(context.Background()); err != nil {
  14. return
  15. }
  16. for _, b := range business {
  17. s.typeMapping[b.Type] = b.Alias
  18. s.aliasMapping[b.Alias] = b.Type
  19. }
  20. return
  21. }