PostCache.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using LeaRun.Application.Busines.BaseManage;
  2. using LeaRun.Application.Entity.BaseManage;
  3. using LeaRun.Cache.Factory;
  4. using System.Collections.Generic;
  5. using System.Data;
  6. using System.Linq;
  7. namespace LeaRun.Application.Cache
  8. {
  9. /// <summary>
  10. /// 版 本 6.1
  11. /// Copyright (c) 2013-2016 上海力软信息技术有限公司
  12. /// 创建人:佘赐雄
  13. /// 日 期:2016.3.4 9:56
  14. /// 描 述:岗位信息缓存
  15. /// </summary>
  16. public class PostCache
  17. {
  18. private PostBLL busines = new PostBLL();
  19. /// <summary>
  20. /// 岗位列表
  21. /// </summary>
  22. /// <returns></returns>
  23. public IEnumerable<RoleEntity> GetList()
  24. {
  25. var cacheList = CacheFactory.Cache().GetCache<IEnumerable<RoleEntity>>(busines.cacheKey);
  26. if (cacheList == null)
  27. {
  28. var data = busines.GetList();
  29. CacheFactory.Cache().WriteCache(data, busines.cacheKey);
  30. return data;
  31. }
  32. else
  33. {
  34. return cacheList;
  35. }
  36. }
  37. /// <summary>
  38. /// 岗位列表
  39. /// </summary>
  40. /// <param name="organizeId">公司Id</param>
  41. /// <returns></returns>
  42. public IEnumerable<RoleEntity> GetList(string organizeId)
  43. {
  44. var data = this.GetList();
  45. if (!string.IsNullOrEmpty(organizeId))
  46. {
  47. data = data.Where(t => t.OrganizeId == organizeId);
  48. }
  49. return data;
  50. }
  51. }
  52. }