CzLinkBLL.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using CP.Cache;
  2. using CP.Model;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace CP.Business
  9. {
  10. public class CzLinkBLL
  11. {
  12. /// <summary>
  13. /// 缓存
  14. /// </summary>
  15. static WMCache cache = WMCache.GetCacheService();
  16. /// <summary>
  17. /// 获取当前cid的超链接
  18. /// </summary>
  19. /// <returns></returns>
  20. public static List<CzLink> GetList(int cid)
  21. {
  22. string key = "CzLink_" + cid;
  23. List<CzLink> list = cache.GetObject<List<CzLink>>(key);
  24. if (list == null)
  25. {
  26. DataConnect dc = new DataConnect();
  27. var listAll = cache.GetObject<List<CzLink>>("CzLink_All");
  28. if (listAll == null)
  29. {
  30. listAll = dc.db.Fetch<CzLink>($" ORDER BY seq asc");
  31. cache.AddObject("CzLink_All", listAll, (int)CacheTime.System);
  32. }
  33. list = listAll.Where(p => p.cid == cid).ToList();
  34. cache.AddObject(key, list, (int)CacheTime.System);
  35. }
  36. return list;
  37. }
  38. }
  39. }