intelligentbuildingcontrol.go 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package service
  2. import (
  3. "city_chips/internal/model"
  4. "city_chips/internal/repository"
  5. "context"
  6. )
  7. type IntelligentBuildingControlService interface {
  8. GetIntelligentBuildingControl(ctx context.Context, id int64) (*model.IntelligentBuildingControl, error)
  9. GetPoint(conds map[string]any) (*[]model.Point, error)
  10. GetPointType() ([]string, error)
  11. }
  12. func NewIntelligentBuildingControlService(
  13. service *Service,
  14. intelligentBuildingControlRepository repository.IntelligentBuildingControlRepository,
  15. ) IntelligentBuildingControlService {
  16. return &intelligentBuildingControlService{
  17. Service: service,
  18. intelligentBuildingControlRepository: intelligentBuildingControlRepository,
  19. }
  20. }
  21. type intelligentBuildingControlService struct {
  22. *Service
  23. intelligentBuildingControlRepository repository.IntelligentBuildingControlRepository
  24. }
  25. // GetPointType implements IntelligentBuildingControlService.
  26. func (s *intelligentBuildingControlService) GetPointType() ([]string, error) {
  27. poions, err := s.intelligentBuildingControlRepository.GetPointType()
  28. if err != nil {
  29. return nil, err
  30. }
  31. return poions, nil
  32. }
  33. // GetPoint implements IntelligentBuildingControlService.
  34. func (s *intelligentBuildingControlService) GetPoint(conds map[string]any) (*[]model.Point, error) {
  35. points, err := s.intelligentBuildingControlRepository.GetPoint(conds)
  36. if err != nil {
  37. return &[]model.Point{}, err
  38. }
  39. return points, err
  40. }
  41. func (s *intelligentBuildingControlService) GetIntelligentBuildingControl(ctx context.Context, id int64) (*model.IntelligentBuildingControl, error) {
  42. return s.intelligentBuildingControlRepository.GetIntelligentBuildingControl(ctx, id)
  43. }