123456789101112131415161718192021222324252627282930313233343536373839404142 |
- using CP.Cache;
- using CP.Model;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace CP.Business
- {
- public class CzLinkBLL
- {
- /// <summary>
- /// 缓存
- /// </summary>
- static WMCache cache = WMCache.GetCacheService();
- /// <summary>
- /// 获取当前cid的超链接
- /// </summary>
- /// <returns></returns>
- public static List<CzLink> GetList(int cid)
- {
- string key = "CzLink_" + cid;
- List<CzLink> list = cache.GetObject<List<CzLink>>(key);
- if (list == null)
- {
- DataConnect dc = new DataConnect();
- var listAll = cache.GetObject<List<CzLink>>("CzLink_All");
- if (listAll == null)
- {
- listAll = dc.db.Fetch<CzLink>($" ORDER BY seq asc");
- cache.AddObject("CzLink_All", listAll, (int)CacheTime.System);
- }
- list = listAll.Where(p => p.cid == cid).ToList();
- cache.AddObject(key, list, (int)CacheTime.System);
- }
- return list;
- }
- }
- }
|