ApiInfoService.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using Attribute;
  2. using Dto;
  3. using Vo;
  4. using Model;
  5. using Model.Base;
  6. using Repository;
  7. using Service;
  8. using Microsoft.AspNetCore.Mvc;
  9. namespace Services
  10. {
  11. /// <summary>
  12. /// api接口Service业务层处理
  13. /// </summary>
  14. [AppService(ServiceType = typeof(IApiInfoService), ServiceLifetime = LifeTime.Transient)]
  15. public class ApiInfoService : BaseService<ApiInfo>, IApiInfoService
  16. {
  17. /// <summary>
  18. /// api接口-列表
  19. /// </summary>
  20. /// <param name="parm">请求参数</param>
  21. /// <returns>api接口列表</returns>
  22. public PagedInfo<ApiInfoListVo> List([FromQuery] PagerInfo page, [FromQuery] ApiInfoListDto parm)
  23. {
  24. //开始拼装查询条件
  25. var predicate = Expressionable.Create<ApiInfo>();
  26. predicate = predicate.AndIF(parm.groupId > 0, m => m.groupId == parm.groupId);
  27. predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.apiName), m => m.apiName.Contains(parm.apiName));
  28. var response = Queryable()
  29. .Where(predicate.ToExpression())
  30. .OrderByDescending(m => m.id)
  31. .Includes(m => m.apiGroupJoin)
  32. .ToPage<ApiInfo, ApiInfoListVo>(page);
  33. return response;
  34. }
  35. }
  36. }