/// <summary> /// 角色权限 /// </summary> /// <param name="request"></param> /// <returns></returns> public BsTableDataSource <RoleDetailViewModel> GetRoleDetaileList(GetRoleDetaileList request) { if (RowID != 1) { throw new Exception("权限异常"); } using (var db = DbFactory.Open()) { var builder = db.From <RoleDetail>(); if (null != request.rid && request.rid.Value > 0) { builder.Where(w => w.RoleID == request.rid); } var count = db.Select(builder).Count; if (!string.IsNullOrEmpty(request.Sort) && !string.IsNullOrEmpty(request.Order) && request.Order == "asc") { builder.OrderBy(o => request.Sort); } else if (!string.IsNullOrEmpty(request.Sort) && !string.IsNullOrEmpty(request.Order) && request.Order == "desc") { builder.OrderByDescending(o => request.Sort); } else { builder.OrderBy(o => o.RoleDetailID); } var PageSize = request.PageSize == 0 ? 15 : request.PageSize; var PageIndex = request.PageIndex == 0 ? 0 : (request.PageIndex) * PageSize; builder.Limit(PageIndex, PageSize); var RList = db.Select <RoleDetailViewModel>(builder); return(new BsTableDataSource <RoleDetailViewModel>() { rows = RList, total = count }); } }
public BsTableDataSource <RoleDetailViewModel> Get(GetRoleDetaileList request) { return(ColumnManager.GetRoleDetaileList(request)); }