publishLibrariesService.go 641 B

123456789101112131415161718192021222324252627
  1. package service
  2. import (
  3. "iot_manager_service/app/multimedia/dao"
  4. "iot_manager_service/util/common"
  5. )
  6. var PublishLibrariesService = new(publishLibrariesService)
  7. type publishLibrariesService struct{}
  8. func (s *publishLibrariesService) List(tenantId int, searchValue string, current, size int) ([]dao.PublishLibraries,
  9. *common.Errors) {
  10. program := &dao.PublishLibraries{
  11. TenantId: tenantId,
  12. }
  13. offset := (current - 1) * size
  14. limit := size
  15. if searchValue != "" {
  16. program.Name = searchValue
  17. }
  18. list, err := program.GetList(offset, limit)
  19. if err != nil {
  20. return nil, common.FailResponse(err.Error(), nil)
  21. }
  22. return list, nil
  23. }