public List<FullUser> Query(FullUserQueryForm form) { if (form.PageSize.HasValue && form.PageSize.Value > 0) { form.RecordCount = mapper.QueryForObject<int>("QueryFullUserRecordCount", form); } return mapper.QueryForList<FullUser>("QueryFullUser", form).ToList(); }
public PagingEntity<FullUser> QueryUser(FullUserQueryForm form) { var list = bll.Query(form); PagingEntity<FullUser> users = new PagingEntity<FullUser> { Record = list, PageCount = form.PageCount, RecordCount = form.RecordCount, }; return users; }
public UserInitResultForm Init(FullUserQueryForm form) { var list = bll.Query(form); PagingEntity<FullUser> users = new PagingEntity<FullUser> { Record = list, PageCount = form.PageCount, RecordCount = form.RecordCount, }; RoleBLL rolebll = new RoleBLL(); var role = rolebll.Query(new RoleQueryForm { }); UserInitResultForm resultform = new UserInitResultForm { User = users, Role = role, }; return resultform; }
/// <summary> /// 查询所有用户 /// </summary> /// <returns></returns> public List<FullUser> Query(FullUserQueryForm form) { ISqlMapper mapper = Common.GetMapperFromSession(); FullUserDao dao = new FullUserDao(mapper); User_RoleDao urdao = new User_RoleDao(mapper); RoleDao roledao = new RoleDao(mapper); var userlist = dao.Query(form); var userids = (from u in userlist select u.ID).ToList(); var urs = urdao.Query(new User_RoleQueryForm { UserIDs = userids }); var roleids = (from ur in urs select ur.RoleID).Distinct().ToList(); var roles = roledao.Query(new RoleQueryForm { IDs = roleids }); foreach (var u in userlist) { var ur_temp = urs.FindAll(t => t.UserID == u.ID); var rolelist = (from ur in ur_temp join r in roles on ur.RoleID equals r.ID select r).ToList(); u.RoleList = rolelist; } return userlist; }