utilService.go 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package service
  2. import (
  3. "iot_manager_service/app/device/dao"
  4. )
  5. var UtilService = new(utilService)
  6. type utilService struct{}
  7. func (s *utilService) GetDeviceVendor(tenantId, deviceType int) ([]dao.DeviceVendor, error) {
  8. // 创建查询实例
  9. device := &dao.DeviceVendor{
  10. TenantId: tenantId,
  11. DeviceType: deviceType,
  12. }
  13. vendors, err := device.GetVendor()
  14. if err != nil {
  15. return nil, err
  16. }
  17. return vendors, nil
  18. }
  19. func (s *utilService) GetDeviceBrand(tenantId, deviceType int) ([]dao.DeviceVendor, error) {
  20. // 创建查询实例
  21. device := &dao.DeviceVendor{
  22. TenantId: tenantId,
  23. DeviceType: deviceType,
  24. }
  25. vendors, err := device.GetBrand()
  26. if err != nil {
  27. return nil, err
  28. }
  29. return vendors, nil
  30. }
  31. func (s *utilService) GetDeviceModel(tenantId, deviceType, parentId int) ([]dao.DeviceVendor, error) {
  32. // 创建查询实例
  33. device := &dao.DeviceVendor{
  34. TenantId: tenantId,
  35. DeviceType: deviceType,
  36. ParentId: parentId,
  37. }
  38. vendors, err := device.GetModel()
  39. if err != nil {
  40. return nil, err
  41. }
  42. return vendors, nil
  43. }