12345678910111213141516171819202122232425262728 |
- package service
- import (
- "iot_manager_service/app/record/dao"
- "iot_manager_service/util/common"
- )
- var LightRecordService = new(lightRecordService)
- type lightRecordService struct{}
- func (s *lightRecordService) List(searchValue, start, end string, id int, current int, size int) ([]dao.LightRecord, int64, *common.Errors) {
- var record dao.LightRecord
- offset := (current - 1) * size
- limit := size
- records, total, err := record.GetRecords(offset, limit, start, end, searchValue, id)
- if err != nil {
- return nil, 0, common.FailResponse(err.Error(), nil)
- }
- return records, total, nil
- }
- func (s *lightRecordService) Detail(id int) (dao.LightRecord, error) {
- record := &dao.LightRecord{
- Id: id,
- }
- return record.Get()
- }
|