SysDictService.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. /// 字典表Service业务层处理
  13. /// </summary>
  14. [AppService(ServiceType = typeof(ISysDictService), ServiceLifetime = LifeTime.Transient)]
  15. public class SysDictService : BaseService<SysDict>, ISysDictService
  16. {
  17. /// <summary>
  18. /// 字典表-列表
  19. /// </summary>
  20. /// <param name="parm">请求参数</param>
  21. /// <returns>字典表列表</returns>
  22. public PagedInfo<SysDictListVo> List([FromQuery] SysDictListDto parm)
  23. {
  24. //开始拼装查询条件
  25. var predicate = Expressionable.Create<SysDict>();
  26. predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.dictType), m => m.dictType.Contains(parm.dictType));
  27. predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.description), m => m.description.Contains(parm.description));
  28. var response = Queryable()
  29. .Where(predicate.ToExpression())
  30. .OrderByDescending(m => m.id)
  31. .ToPage<SysDict, SysDictListVo>(new PagerInfo());
  32. return response;
  33. }
  34. }
  35. }