PriListService.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using Attribute;
  2. using Model;
  3. using Model.Base;
  4. using Repository;
  5. using Service;
  6. using Microsoft.AspNetCore.Mvc;
  7. using Vo.Admin;
  8. namespace Services
  9. {
  10. /// <summary>
  11. /// 奖励配置Service业务层处理
  12. /// </summary>
  13. [AppService(ServiceType = typeof(IPriListService), ServiceLifetime = LifeTime.Transient)]
  14. public class PriListService : BaseService<PriList>, IPriListService
  15. {
  16. /// <summary>
  17. /// 奖励配置-列表
  18. /// </summary>
  19. /// <param name="param">参数请求体</param>
  20. /// <param name="page">分页参数</param>
  21. /// <returns>列表</returns>
  22. public PagedInfo<GetPriListListVo> getPriListList([FromQuery] PagerInfo page, [FromQuery] PriList param)
  23. {
  24. //拼装查询条件
  25. var predicate = Expressionable.Create<PriList>();
  26. predicate = predicate.AndIF(param.projectId > 0, m => m.projectId == param.projectId);
  27. predicate = predicate.AndIF(!string.IsNullOrEmpty(param.prizeName), m => m.prizeName.Contains(param.prizeName));
  28. predicate = predicate.AndIF(!string.IsNullOrEmpty(param.conditionMode), m => m.conditionMode.Contains(param.conditionMode));
  29. predicate = predicate.AndIF(!string.IsNullOrEmpty(param.prizeContent), m => m.prizeContent.Contains(param.prizeContent));
  30. var response = Queryable()
  31. .Where(predicate.ToExpression())
  32. .OrderBy(m => m.kind)
  33. .OrderByDescending(m => m.id)
  34. .ToPage<PriList, GetPriListListVo>(page);
  35. return response;
  36. }
  37. /// <summary>
  38. /// 奖励配置-下拉框数据
  39. /// </summary>
  40. /// <param name="page">分页参数</param>
  41. /// <returns>下拉框数据</returns>
  42. public PagedInfo<GetPriListDicVo> getPriListDic([FromQuery] PagerInfo page)
  43. {
  44. //拼装查询条件
  45. var predicate = Expressionable.Create<PriList>();
  46. var response = Queryable()
  47. .Where(predicate.ToExpression())
  48. .OrderByDescending(m => m.id)
  49. .ToPage<PriList, GetPriListDicVo>(page);
  50. return response;
  51. }
  52. }
  53. }