1234567891011121314151617181920212223242526272829303132333435 |
- package service
- import (
- "iot_manager_service/app/multimedia/dao"
- "iot_manager_service/app/multimedia/model"
- "iot_manager_service/util/common"
- )
- var LibraryService = new(libraryService)
- type libraryService struct{}
- func (s *libraryService) List(tenantId int, searchValue string, current, size int) ([]model.LibraryDetail,
- *common.Errors) {
- library := &dao.Library{
- TenantId: tenantId,
- }
- offset := (current - 1) * size
- limit := size
- if searchValue != "" {
- library.LibName = searchValue
- }
- libraries, err := library.GetLibraries(offset, limit)
- if err != nil {
- return nil, common.FailResponse(err.Error(), nil)
- }
- var rsp []model.LibraryDetail
- for _, lib := range libraries {
- rsp = append(rsp, model.DaoToModel(lib))
- }
- return rsp, nil
- }
|