123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- package service
- import (
- "city_chips/internal/model"
- "city_chips/internal/repository"
- "context"
- )
- type IntelligentBuildingControlService interface {
- GetIntelligentBuildingControl(ctx context.Context, id int64) (*model.IntelligentBuildingControl, error)
- GetPoint(conds map[string]any) (*[]model.Point, error)
- GetPointType() ([]string, error)
- DeviceType() ([]string, error)
- DeviceCount() (int64, error)
- }
- func NewIntelligentBuildingControlService(
- service *Service,
- intelligentBuildingControlRepository repository.IntelligentBuildingControlRepository,
- ) IntelligentBuildingControlService {
- return &intelligentBuildingControlService{
- Service: service,
- intelligentBuildingControlRepository: intelligentBuildingControlRepository,
- }
- }
- type intelligentBuildingControlService struct {
- *Service
- intelligentBuildingControlRepository repository.IntelligentBuildingControlRepository
- }
- // DeviceCount 获取设备总数
- func (s *intelligentBuildingControlService) DeviceCount() (int64, error) {
- //TODO implement me
- count, err := s.intelligentBuildingControlRepository.DeviceCount()
- if err != nil {
- return 0, err
- }
- return count, nil
- }
- // DeviceType 获取设备类型
- func (s *intelligentBuildingControlService) DeviceType() ([]string, error) {
- //TODO implement me
- poions, err := s.intelligentBuildingControlRepository.DeviceType()
- if err != nil {
- return nil, err
- }
- return poions, nil
- }
- // GetPointType 获取点位类型
- func (s *intelligentBuildingControlService) GetPointType() ([]string, error) {
- poions, err := s.intelligentBuildingControlRepository.GetPointType()
- if err != nil {
- return nil, err
- }
- return poions, nil
- }
- // GetPoint 获取点位列表
- func (s *intelligentBuildingControlService) GetPoint(conds map[string]any) (*[]model.Point, error) {
- points, err := s.intelligentBuildingControlRepository.GetPoint(conds)
- if err != nil {
- return &[]model.Point{}, err
- }
- return points, err
- }
- func (s *intelligentBuildingControlService) GetIntelligentBuildingControl(ctx context.Context, id int64) (*model.IntelligentBuildingControl, error) {
- return s.intelligentBuildingControlRepository.GetIntelligentBuildingControl(ctx, id)
- }
|