12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- using LeaRun.Application.Busines.BaseManage;
- using LeaRun.Application.Entity.BaseManage;
- using LeaRun.Application.Code;
- using LeaRun.Cache.Factory;
- using System.Collections.Generic;
- using System.Data;
- using System.Linq;
- using LeaRun.Application.Entity.WebApp;
- namespace LeaRun.Application.Cache
- {
- /// <summary>
- /// 版 本 6.1
- /// Copyright (c) 2013-2016 上海力软信息技术有限公司
- /// 创建人:佘赐雄
- /// 日 期:2016.3.4 9:56
- /// 描 述:用户信息缓存
- /// </summary>
- public class UserCache
- {
- private UserBLL busines = new UserBLL();
- /// <summary>
- /// 用户列表
- /// </summary>
- /// <returns></returns>
- public IEnumerable<UserEntity> GetList()
- {
- IEnumerable<UserEntity> data = new List<UserEntity>();
- var cacheList = CacheFactory.Cache().GetCache<IEnumerable<UserEntity>>(busines.cacheKey);
- if (cacheList == null)
- {
- data = busines.GetList();
- CacheFactory.Cache().WriteCache(data, busines.cacheKey);
- }
- else
- {
- data = cacheList;
- }
- return data;
- }
- /// <summary>
- /// 用户列表
- /// </summary>
- /// <param name="departmentId">部门Id</param>
- /// <returns></returns>
- public IEnumerable<UserEntity> GetList(string departmentId)
- {
- var data = this.GetList();
- if (!string.IsNullOrEmpty(departmentId))
- {
- data = data.Where(t => t.DepartmentId == departmentId);
- }
- return data;
- }
- public Dictionary<string,appUserInfoModel> GetListToApp()
- {
- Dictionary<string, appUserInfoModel> data = new Dictionary<string,appUserInfoModel>();
- var datalist = this.GetList();
- foreach (var item in datalist)
- {
- appUserInfoModel one = new appUserInfoModel {
- UserId = item.UserId,
- Account = item.Account,
- RealName = item.RealName,
- OrganizeId = item.OrganizeId,
- DepartmentId = item.DepartmentId
- };
- data.Add(item.UserId, one);
- }
- return data;
- }
- }
- }
|