PriConditionService.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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(IPriConditionService), ServiceLifetime = LifeTime.Transient)]
  14. public class PriConditionService : BaseService<PriCondition>, IPriConditionService
  15. {
  16. /// <summary>
  17. /// 奖励条件-列表
  18. /// </summary>
  19. /// <param name="listId">配置ID</param>
  20. /// <param name="page">分页参数</param>
  21. /// <returns>列表</returns>
  22. public PagedInfo<GetPriConditionListVo> getPriConditionList([FromQuery] PagerInfo page, [FromQuery] PriCondition param)
  23. {
  24. //拼装查询条件
  25. var predicate = Expressionable.Create<PriCondition>();
  26. predicate = predicate.AndIF(param.listId > 0, m => m.listId == param.listId);
  27. var response = Queryable()
  28. .Where(predicate.ToExpression())
  29. .OrderByDescending(m => m.id)
  30. .ToPage<PriCondition, GetPriConditionListVo>(page);
  31. return response;
  32. }
  33. }
  34. }