PriPrizeInQueryFieldService.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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(IPriPrizeInQueryFieldService), ServiceLifetime = LifeTime.Transient)]
  14. public class PriPrizeInQueryFieldService : BaseService<PriPrizeInQueryField>, IPriPrizeInQueryFieldService
  15. {
  16. /// <summary>
  17. /// 奖励入库条件字段-列表
  18. /// </summary>
  19. /// <param name="param">参数请求体</param>
  20. /// <param name="page">分页参数</param>
  21. /// <returns>列表</returns>
  22. public PagedInfo<GetPriPrizeInQueryFieldListVo> getPriPrizeInQueryFieldList([FromQuery] PagerInfo page, [FromQuery] PriPrizeInQueryField param)
  23. {
  24. //拼装查询条件
  25. var predicate = Expressionable.Create<PriPrizeInQueryField>();
  26. predicate = predicate.AndIF(!string.IsNullOrEmpty(param.fieldName), m => m.fieldName.Contains(param.fieldName));
  27. predicate = predicate.AndIF(!string.IsNullOrEmpty(param.fieldEnName), m => m.fieldEnName.Contains(param.fieldEnName));
  28. predicate = predicate.AndIF(param.inTableId > 0, m => m.inTableId == param.inTableId);
  29. var response = Queryable()
  30. .Where(predicate.ToExpression())
  31. .OrderByDescending(m => m.id)
  32. .ToPage<PriPrizeInQueryField, GetPriPrizeInQueryFieldListVo>(page);
  33. return response;
  34. }
  35. }
  36. }