timeConditionService.go 799 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package service
  2. import (
  3. "iot_manager_service/app/device/dao"
  4. "iot_manager_service/util"
  5. )
  6. // 灯控策略-时间策略服务
  7. var TimeConditionService = new(timeConditionService)
  8. type timeConditionService struct{}
  9. func (s *timeConditionService) Get(id int) (*dao.TimeCondition, *util.Errors) {
  10. // 创建查询实例
  11. condition := &dao.TimeCondition{
  12. ID: id,
  13. }
  14. err := condition.Get()
  15. if err != nil {
  16. return nil, util.FailResponse(err.Error(), nil)
  17. }
  18. return condition, nil
  19. }
  20. func (s *timeConditionService) BatchGet(ids []int) []dao.TimeCondition {
  21. // 创建查询实例
  22. condition := &dao.TimeCondition{}
  23. conditions, err := condition.BatchGet(ids)
  24. if err != nil {
  25. return nil
  26. }
  27. return conditions
  28. }
  29. func (s *timeConditionService) Save([]dao.TimeCondition) error {
  30. return nil
  31. }