12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- package service
- import (
- "iot_manager_service/app/device/dao"
- "iot_manager_service/util"
- )
- // 灯控策略-时间策略服务
- var TimeConditionService = new(timeConditionService)
- type timeConditionService struct{}
- func (s *timeConditionService) Get(id int) (*dao.TimeCondition, *util.Errors) {
- // 创建查询实例
- condition := &dao.TimeCondition{
- ID: id,
- }
- err := condition.Get()
- if err != nil {
- return nil, util.FailResponse(err.Error(), nil)
- }
- return condition, nil
- }
- func (s *timeConditionService) BatchGet(ids []int) []dao.TimeCondition {
- // 创建查询实例
- condition := &dao.TimeCondition{}
- conditions, err := condition.BatchGet(ids)
- if err != nil {
- return nil
- }
- return conditions
- }
- func (s *timeConditionService) Save([]dao.TimeCondition) error {
- return nil
- }
- func (s *timeConditionService) GetByLightId(id int) ([]dao.TimeCondition, *util.Errors) {
- // 创建查询实例
- condition := &dao.TimeCondition{
- LightId: id,
- }
- conditions, err := condition.GetByLightId()
- if err != nil {
- return nil, util.FailResponse(err.Error(), nil)
- }
- return conditions, nil
- }
|