SystemLabelService.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using GxPress.Service.Interface.SystemLabel;
  2. using GxPress.Repository.Interface.SystemLabel;
  3. using System.Threading.Tasks;
  4. using GxPress.Common.Page;
  5. using GxPress.Result.SystemLabel;
  6. using System.Collections.Generic;
  7. namespace GxPress.Service.Implement.SystemLabel
  8. {
  9. public class SystemLabelService : ISystemLabelService
  10. {
  11. private readonly ISystemLabelRepository systemLabelRepository;
  12. private readonly ISystemLableMediaRepository systemLableMediaRepository;
  13. public SystemLabelService(ISystemLabelRepository systemLabelRepository, ISystemLableMediaRepository systemLableMediaRepository)
  14. {
  15. this.systemLabelRepository = systemLabelRepository;
  16. this.systemLableMediaRepository = systemLableMediaRepository;
  17. }
  18. public async Task<PagedList<SystemLabelResult>> GetAllPageAsync(Common.Page.PageParameter request)
  19. {
  20. var result = await systemLabelRepository.GetAllPageAsync(request);
  21. foreach (var item in result.Items)
  22. {
  23. item.MediaIds = await systemLableMediaRepository.GetMediaIdsAsync(item.Id, 0);
  24. }
  25. return result;
  26. }
  27. public async Task<IEnumerable<SystemLabelResult>> GetAllAsync()
  28. {
  29. var result = await systemLabelRepository.GetAllAsync();
  30. return result;
  31. }
  32. /// <summary>
  33. /// 获取明栏分页
  34. /// </summary>
  35. /// <param name="request"></param>
  36. /// <returns></returns>
  37. public async Task<PagedList<SystemLabelResult>> GetAllStarLablePageAsync(Common.Page.PageParameter request)
  38. {
  39. var result = await systemLabelRepository.GetAllStarLablePageAsync(request);
  40. foreach (var item in result.Items)
  41. {
  42. item.MediaIds = await systemLableMediaRepository.GetMediaIdsAsync(item.Id, 0);
  43. }
  44. return result;
  45. }
  46. /// <summary>
  47. /// 获取明栏
  48. /// </summary>
  49. /// <returns></returns>
  50. public async Task<IEnumerable<SystemLabelResult>> GetStarLableAllAsync()
  51. {
  52. var result = await systemLabelRepository.GetStarLableAllAsync();
  53. return result;
  54. }
  55. }
  56. }