utilService.go 701 B

1234567891011121314151617181920212223242526272829303132333435
  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(modeType, deviceType int) (*dao.DeviceVendor, error) {
  8. // 创建查询实例
  9. device := &dao.DeviceVendor{
  10. VendorType: modeType,
  11. DeviceType: deviceType,
  12. }
  13. err := device.GetByType()
  14. if err != nil {
  15. return nil, err
  16. }
  17. return device, nil
  18. }
  19. func (s *utilService) GetTenantCode(modeType, deviceType int) (*dao.DeviceVendor, error) {
  20. // 创建查询实例
  21. device := &dao.DeviceVendor{
  22. VendorType: modeType,
  23. DeviceType: deviceType,
  24. }
  25. err := device.GetByType()
  26. if err != nil {
  27. return nil, err
  28. }
  29. return device, nil
  30. }