/// <summary> /// 查询用户管理员分页 /// </summary> /// <param name="entity"></param> /// <param name="pageInfo"></param> /// <returns></returns> public List <AdminEntity> GetList(AdminEntity entity, ref PageInfo pageInfo) { entity.IncludeAll(); entity.OrderBy(a => a.ID, EOrderBy.DESC); entity.Where(a => a.IsDelete == (int)EIsDelete.NotDelete); SysRoleEntity roleEntity = new SysRoleEntity(); roleEntity.Include("RoleName", "RoleName"); entity.Left <SysRoleEntity>(roleEntity, new Params <string, string>() { Item1 = "RoleNum", Item2 = "RoleNum" }); SysDepartEntity departEntity = new SysDepartEntity(); departEntity.Include("DepartName", "DepartName"); entity.Left <SysDepartEntity>(departEntity, new Params <string, string>() { Item1 = "DepartNum", Item2 = "DepartNum" }); int rowCount = 0; List <AdminEntity> listResult = this.Admin.GetList(entity, pageInfo.PageSize, pageInfo.PageIndex, out rowCount); pageInfo.RowCount = rowCount; return(listResult); }
/// <summary> /// 查询用户管理员分页 /// </summary> /// <param name="entity"></param> /// <param name="pageInfo"></param> /// <returns></returns> public List <AdminEntity> GetList(AdminEntity entity, ref PageInfo pageInfo) { entity.IncludeAll(); entity.Exclude(a => a.PassWord); entity.OrderBy(a => a.ID, EOrderBy.DESC); entity.Where(a => a.IsDelete == (int)EIsDelete.NotDelete); entity.And(a => a.CompanyID == entity.CompanyID); entity.And(item => item.UserCode != "DA_0000"); if (!entity.UserName.IsEmpty()) { entity.And("UserName", ECondition.Like, "%" + entity.UserName + "%"); } if (!entity.UserCode.IsEmpty()) { entity.And("UserCode", ECondition.Like, "%" + entity.UserCode + "%"); } if (!entity.RoleNum.IsEmpty()) { entity.And(a => a.RoleNum == entity.RoleNum); } if (!entity.DepartNum.IsEmpty()) { DepartProvider provider = new DepartProvider(this.CompanyID); List <SysDepartEntity> listDepart = provider.GetChildList(entity.DepartNum); string[] items = null; if (!listDepart.IsNullOrEmpty()) { items = listDepart.Select(item => item.SnNum).ToArray(); entity.And("DepartNum", ECondition.In, items); } } int rowCount = 0; List <AdminEntity> listResult = this.Admin.GetList(entity, pageInfo.PageSize, pageInfo.PageIndex, out rowCount); pageInfo.RowCount = rowCount; if (!listResult.IsNullOrEmpty()) { SysRoleProvider RoleProvider = new SysRoleProvider(this.CompanyID); DepartProvider DepartProvider = new DepartProvider(this.CompanyID); foreach (AdminEntity item in listResult) { if (item.RoleNum.IsNotEmpty()) { SysRoleEntity RoleEntity = RoleProvider.GetRoleEntity(item.RoleNum); item.RoleName = RoleEntity != null ? RoleEntity.RoleName : string.Empty; } if (item.DepartNum.IsNotEmpty()) { SysDepartEntity DepartEntity = DepartProvider.GetSingle(item.DepartNum); item.DepartName = DepartEntity != null ? DepartEntity.DepartName : string.Empty; } } } return(listResult); }