/// <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="userName"></param> /// <param name="passWord"></param> /// <returns></returns> public AdminEntity Login(string userName, string passWord) { AdminEntity entity = new AdminEntity(); entity.IncludeAll(); entity.Where(a => a.UserName == userName).And(a => a.PassWord == passWord); SysRoleEntity roleEntity = new SysRoleEntity(); roleEntity.Include("RoleName", "RoleName"); entity.Left <SysRoleEntity>(roleEntity, new Params <string, string>() { Item1 = "RoleNum", Item2 = "RoleNum" }); entity = this.Admin.GetSingle(entity); if (entity != null) { AdminEntity admin = new AdminEntity(); admin.LoginCount = admin.LoginCount + 1; admin.IncludeLoginCount(true); admin.Where(a => a.UserCode == entity.UserCode); this.Admin.Update(admin); } return(entity); }