/// <summary> /// 获取管理员列表(全部) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public JsonRsp <CinemaChainViewModel> GetAllList() { JsonRsp <CinemaChainViewModel> rsp = new JsonRsp <CinemaChainViewModel>(); CinemaChainModel model = new CinemaChainModel(); OQL q = OQL.From(model) .Select() .OrderBy(model.ID, "asc") .END; List <CinemaChainModel> list = q.ToList <CinemaChainModel>();//使用OQL扩展 rsp.data = list.ConvertAll <CinemaChainViewModel>(o => { return(new CinemaChainViewModel() { ID = o.ID, CinemaChainName = o.CinemaChainName, CreateBy = o.CreateUser, CreateIP = o.CreateIP, CreateTime = o.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"), Sort = o.Sort, Status = o.Status, UpdateBy = o.UpdateUser, UpdateIP = o.UpdateIP, UpdateTime = o.UpdateTime == null ? "" : Convert.ToDateTime(o.UpdateTime).ToString("yyyy-MM-dd HH:mm:ss"), }); } ); rsp.success = true; rsp.code = 0; return(rsp); }
public JsonRsp <TreeSelect> GetRoleTreeSelect(int accountId) { List <long> roleIds = GetRoles(accountId); JsonRsp <TreeSelect> rsp = new JsonRsp <TreeSelect>(); AdminRole model = new AdminRole(); OQL q = OQL.From(model) .Select() .OrderBy(model.ID, "asc") .END; List <AdminRole> list = q.ToList <AdminRole>();//使用OQL扩展 List <TreeSelect> allList = list.ConvertAll <TreeSelect>(o => { return(new TreeSelect() { value = o.ID, name = o.RoleName, isChecked = roleIds.Contains(o.ID), }); } ); rsp.data = allList; rsp.success = true; rsp.code = 0; return(rsp); }
/// <summary> /// 获取管理员列表(全部) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public JsonRsp <AccountViewModel> GetAllList() { JsonRsp <AccountViewModel> rsp = new JsonRsp <AccountViewModel>(); AdminAccount model = new AdminAccount(); OQL q = OQL.From(model) .Select() .OrderBy(model.ID, "asc") .END; List <AdminAccount> list = q.ToList <AdminAccount>();//使用OQL扩展 rsp.data = list.ConvertAll <AccountViewModel>(o => { return(new AccountViewModel() { ID = o.ID, AccountName = o.AccountName, TrueName = o.TrueName, Status = o.Status, LoginTime = o.LoginTime, LastLoginTime = o.LastLoginTime, LoginCount = o.LoginCount, CreateTime = o.CreateTIme, }); } ); rsp.success = true; rsp.code = 0; return(rsp); }
/// <summary> /// 列表(全部) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public JsonRsp <MenuViewModel> GetAllList() { JsonRsp <MenuViewModel> rsp = new JsonRsp <MenuViewModel>(); AdminMenu model = new AdminMenu(); OQL q = OQL.From(model) .Select() .OrderBy(model.ID, "asc") .END; List <AdminMenu> list = q.ToList <AdminMenu>();//使用OQL扩展 rsp.data = list.ConvertAll <MenuViewModel>(o => { return(new MenuViewModel() { ID = o.ID, MenuKey = o.MenuKey, MenuName = o.MenuName, MenuUrl = o.MenuUrl, MenuType = o.MenuType, IDPath = o.IDPath, Remark = o.Remark, Sort = o.Sort, Status = o.Status, CreateTIme = o.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"), }); } ); rsp.success = true; rsp.code = 0; return(rsp); }
/// <summary> /// 获取列表(全部) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public JsonRsp <TicketBatchViewModel> GetAllList() { JsonRsp <TicketBatchViewModel> rsp = new JsonRsp <TicketBatchViewModel>(); TicketBatchModel model = new TicketBatchModel(); OQL q = OQL.From(model) .Select() .OrderBy(model.ID, "asc") .END; List <TicketBatchModel> list = q.ToList <TicketBatchModel>();//使用OQL扩展 rsp.data = list.ConvertAll <TicketBatchViewModel>(o => { return(new TicketBatchViewModel() { ID = o.ID, TicketTypeId = o.TicketTypeId, TicketBatchNo = o.TicketBatchNo, TicketPrefix = o.TicketPrefix, DataFrom = o.DataFrom, Count = o.Count, TicketBatchName = o.TicketBatchName, CreateId = o.CreateId, CreateUser = o.CreateUser, CreateIP = o.CreateIP, CreateTime = o.CreateTime, Status = o.Status, }); } ); rsp.success = true; rsp.code = 0; return(rsp); }
public JsonRsp <TreeSelect> GetMenuTreeSelect(int roleId) { AdminRole role = new AdminRoleBLL().GetModelById(roleId); string menuIds = "," + role.MenuIds + ","; int[] checkedArray = Array.ConvertAll(role.MenuIds.Split(','), int.Parse); JsonRsp <TreeSelect> rsp = new JsonRsp <TreeSelect>(); AdminMenu model = new AdminMenu(); OQL q = OQL.From(model) .Select() .OrderBy(model.ID, "asc") .END; List <AdminMenu> list = q.ToList <AdminMenu>();//使用OQL扩展 List <TreeSelect> allList = list.ConvertAll <TreeSelect>(o => { return(new TreeSelect() { value = o.ID, ParentID = o.ParentID, name = o.MenuName, isChecked = menuIds.IndexOf("," + o.ID + ",") > -1, }); } ); rsp.data = getMenuNodes(0, 0, allList); rsp.success = true; rsp.code = 0; return(rsp); }
/// <summary> /// 获取管理员列表(分页) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public JsonRsp <RoleViewModel> GetPageList(int pageIndex, int pageSize) { JsonRsp <RoleViewModel> rsp = new JsonRsp <RoleViewModel>(); AdminRole m = new AdminRole(); OQL q = OQL.From(m) .Select(m.ID, m.RoleName, m.Status, m.CreateTIme) .OrderBy(m.ID, "asc") .END; //分页 q.Limit(pageSize, pageIndex, true); //q.PageWithAllRecordCount = allCount; //List<Employee> list= EntityQuery<Employee>.QueryList(q); List <AdminRole> list = q.ToList <AdminRole>();//使用OQL扩展 rsp.data = list.ConvertAll <RoleViewModel>(o => { return(new RoleViewModel() { ID = o.ID, RoleName = o.RoleName, Status = o.Status, CreateTIme = o.CreateTIme.ToString("yyyy-MM-dd HH:mm:ss"), }); } ); rsp.success = true; rsp.code = 0; rsp.count = q.PageWithAllRecordCount; return(rsp); }
/// <summary> /// 获取列表(全部) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public List<BankAccountModel> GetAllModelList() { BankAccountModel model = new BankAccountModel(); OQL q = OQL.From(model) .Select() .OrderBy(model.ID, "asc") .END; return q.ToList<BankAccountModel>();//使用OQL扩展 }
/// <summary> /// 获取列表(全部) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public List <CustomFinancialModel> GetAllModelList() { CustomFinancialModel model = new CustomFinancialModel(); OQL q = OQL.From(model) .Select() .OrderBy(model.ID, "desc") .END; return(q.ToList <CustomFinancialModel>()); }
/// <summary> /// 获取管理员列表(全部) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public List <CustomTypeModel> GetAllModelList() { CustomTypeModel model = new CustomTypeModel(); OQL q = OQL.From(model) .Select() .OrderBy(model.ID, "asc") .END; return(q.ToList <CustomTypeModel>());//使用OQL扩展 }
/// <summary> /// 获取列表(全部) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public List <TenantModel> GetAllModelList() { TenantModel model = new TenantModel(); OQL q = OQL.From(model) .Select() .OrderBy(model.ID, "asc") .END; return(q.ToList <TenantModel>());//使用OQL扩展 }
/// <summary> /// 获取列表(全部) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public List <ContractModel> GetAllModelList() { ContractModel model = new ContractModel(); OQL q = OQL.From(model) .Select() .OrderBy(model.ID, "asc") .END; return(q.ToList <ContractModel>()); }
/// <summary> /// 获取列表(全部) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public List <AdminAction> GetAllModelList() { AdminAction model = new AdminAction(); OQL q = OQL.From(model) .Select() .OrderBy(model.ID, "asc") .END; return(q.ToList <AdminAction>());//使用OQL扩展 }
/// <summary> /// 获取列表(全部) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public List <ChargeCardsModel> GetAllModelList() { ChargeCardsModel model = new ChargeCardsModel(); OQL q = OQL.From(model) .Select() .OrderBy(model.Sort, "desc") .OrderBy(model.ID, "asc") .END; return(q.ToList <ChargeCardsModel>());//使用OQL扩展 }
/// <summary> /// 获取管理员列表(全部) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public List <CustomAccReceiptEntryModel> GetAllModelList() { JsonRsp <CustomAccReceiptEntryViewModel> rsp = new JsonRsp <CustomAccReceiptEntryViewModel>(); CustomAccReceiptEntryModel model = new CustomAccReceiptEntryModel(); OQL q = OQL.From(model) .Select() .OrderBy(model.ID, "desc") .END; return(q.ToList <CustomAccReceiptEntryModel>()); }
/// <summary> /// 获取管理员列表(全部) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public List <TicketTypeModel> GetAllModelList() { TicketTypeModel model = new TicketTypeModel(); OQL q = OQL.From(model) .Select() .OrderBy(model.Sort, "desc") .OrderBy(model.ID, "asc") .END; return(q.ToList <TicketTypeModel>());//使用OQL扩展 }
/// <summary> /// 获取管理员列表(全部) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public List <MerchantModel> GetAllModelList() { JsonRsp <MerchantViewModel> rsp = new JsonRsp <MerchantViewModel>(); MerchantModel model = new MerchantModel(); OQL q = OQL.From(model) .Select() .Where(model.TenantId == TenantId) .OrderBy(model.Sort, "desc") .END; return(q.ToList <MerchantModel>()); }
/// <summary> /// 获取指定页的联系人信息 /// </summary> /// <param name="pageSize"></param> /// <param name="pageNumber"></param> /// <param name="allCount"></param> /// <returns></returns> public List <CustomerContactInfo> GetContactInfoList(int pageSize, int pageNumber, int allCount) { CustomerContactInfo info = new CustomerContactInfo(); OQL q = new OQL(info); q.Select().OrderBy(info.CustomerName, "asc"); q.Limit(pageSize, pageNumber); q.PageWithAllRecordCount = allCount; //return EntityQuery<CustomerContactInfo>.QueryList(q); return(q.ToList <CustomerContactInfo>()); }
/// <summary> /// 获取用户角色集合 /// </summary> /// <param name="accountId"></param> /// <returns></returns> public List <AdminAccountRole> GetAccountRoles(int accountId) { AdminAccountRole model = new AdminAccountRole(); model.AccountID = accountId; OQL q = OQL.From(model) .Select() .Where(model.AccountID) .OrderBy(model.ID, "asc") .END; return(q.ToList <AdminAccountRole>());//使用OQL扩展 }
/// <summary> /// 获取列表(全部) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public List <CustomModel> GetAllModelList() { JsonRsp <CustomViewModel> rsp = new JsonRsp <CustomViewModel>(); CustomModel model = new CustomModel(); model.TenantId = TenantId; OQL q = OQL.From(model) .Select() .Where(model.TenantId) .OrderBy(model.Sort, "desc") .END; return(q.ToList <CustomModel>()); }
/// <summary> /// 获取管理员列表(分页) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public JsonRsp <CinemaViewModel> GetPageList(int pageIndex, int pageSize) { JsonRsp <CinemaViewModel> rsp = new JsonRsp <CinemaViewModel>(); CinemaModel m = new CinemaModel(); OQL q = OQL.From(m) .Select() .OrderBy(m.ID, "asc") .END; //分页 q.Limit(pageSize, pageIndex, true); //q.PageWithAllRecordCount = allCount; //List<Employee> list= EntityQuery<Employee>.QueryList(q); List <CinemaModel> list = q.ToList <CinemaModel>();//使用OQL扩展 rsp.data = list.ConvertAll <CinemaViewModel>(o => { return(new CinemaViewModel() { ID = o.ID, CinemaChainId = o.CinemaChainId, CinemaName = o.CinemaName, LinkPhone = o.LinkPhone, LinkName = o.LinkName, LinkMobile = o.LinkMobile, CinemaArea = o.CinemaArea, CinemaAddress = o.CinemaAddress, CreateBy = o.CreateUser, CreateIP = o.CreateIP, CreateTime = o.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"), Sort = o.Sort, Status = o.Status, UpdateBy = o.UpdateUser, UpdateIP = o.UpdateIP, UpdateTime = o.UpdateTime == null ? "" : Convert.ToDateTime(o.UpdateTime).ToString("yyyy-MM-dd HH:mm:ss"), }); } ); rsp.success = true; rsp.code = 0; rsp.count = q.PageWithAllRecordCount; return(rsp); }
/// <summary> /// 获取用户权限菜单 /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public List <MenuViewModel> GetMenuListByAccountId(long accountId, long menuType) { AdminRole role = new AdminRole(); OQL qRole = OQL.From(role) .Select() .OrderBy(role.ID, "asc") .END; StringBuilder sbMenuIds = new StringBuilder(); foreach (AdminRole item in qRole.ToList <AdminRole>()) { sbMenuIds.Append(item.MenuIds); } JsonRsp <MenuViewModel> rsp = new JsonRsp <MenuViewModel>(); AdminMenu model = new AdminMenu(); OQL q = new OQL(model); q.Select() .Where(q.Condition.AND(model.MenuType, "=", menuType)) .OrderBy(model.ID, "asc"); List <AdminMenu> list = q.ToList <AdminMenu>();//使用OQL扩展 return(list.ConvertAll <MenuViewModel>(o => { return new MenuViewModel() { ID = o.ID, ParentID = o.ParentID, MenuKey = o.MenuKey, MenuName = o.MenuName, MenuUrl = o.MenuUrl, MenuType = o.MenuType, IDPath = o.IDPath, Remark = o.Remark, Sort = o.Sort, Status = o.Status, CreateTIme = o.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"), }; } )); }
/// <summary> /// 获取管理员列表(全部) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public JsonRsp <TicketViewModel> GetAllList() { JsonRsp <TicketViewModel> rsp = new JsonRsp <TicketViewModel>(); TicketInfo model = new TicketInfo(); OQL q = OQL.From(model) .Select() .OrderBy(model.ID, "asc") .END; List <TicketInfo> list = q.ToList <TicketInfo>();//使用OQL扩展 rsp.data = list.ConvertAll <TicketViewModel>(ticket => { return(new TicketViewModel() { ID = ticket.ID, TicketCode = ticket.TicketCode, TicketTypeId = ticket.TicketTypeId, Consumptionlevel = BaseEnum.ConsumptionlevelEnum.初始化, MoneyTyp = BaseEnum.MoneyTypeEnum.初始化, CustomID = 0, InitialAmount = 0, CostAmount = 0, Balance = 0, Status = BaseEnum.CredentialEnum.未交付, IsExpire = false, IsActivated = false, //MakeTime=null, //ExpireDate=null, TicketBatchNo = model.TicketBatchNo, GrantBy = 0, //GrantTime=null, CreateBy = AdminName, CreateIP = Util.GetLocalIP(), CreateTime = ticket.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"), Sort = ticket.Sort, }); } ); rsp.success = true; rsp.code = 0; return(rsp); }
/// <summary> /// 验证密码是否正确 /// </summary> /// <param name="userName"></param> /// <param name="passWord"></param> /// <returns></returns> public JsonRsp CheckPassWord(string accountName, string accountPwd) { JsonRsp json = new JsonRsp(); AdminAccount model = new AdminAccount(); model.AccountName = accountName; OQL q = OQL.From(model) .Select() .Where(model.AccountName) //以用户名和密码来验证登录 .END; var list = q.ToList <AdminAccount>();//ToEntity,OQL扩展方法 if (list.Count == 0) { json.success = false; json.retmsg = "用户不存在"; return(json); } else if (list.Count == 1) { model = list[0]; if (model.AccountPwd == EncryptHelper.MD5Encoding(accountPwd, model.Salt)) { json.success = true; json.code = 0; json.returnObj = model; } else { json.success = false; json.retmsg = "账号或密码不匹配"; return(json); } } else { model = new AdminAccount(); } return(json); }
/// <summary> /// 获取列表(分页) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public JsonRsp <CustomTypeViewModel> GetPageList(int pageIndex, int pageSize) { JsonRsp <CustomTypeViewModel> rsp = new JsonRsp <CustomTypeViewModel>(); CustomTypeModel m = new CustomTypeModel(); OQL q = OQL.From(m) .Select() .OrderBy(m.ID, "asc") .END; //分页 q.Limit(pageSize, pageIndex, true); //q.PageWithAllRecordCount = allCount; //List<Employee> list= EntityQuery<Employee>.QueryList(q); List <CustomTypeModel> list = q.ToList <CustomTypeModel>();//使用OQL扩展 rsp.data = list.ConvertAll <CustomTypeViewModel>(o => { return(new CustomTypeViewModel() { ID = o.ID, CustomTypeName = o.CustomTypeName, CreateId = o.CreateId, CreateUser = o.CreateUser, CreateIP = o.CreateIP, CreateTime = o.CreateTime, Sort = o.Sort, Status = o.Status, UpdateBy = o.UpdateUser, UpdateIP = o.UpdateIP, UpdateTime = o.UpdateTime, }); } ); rsp.success = true; rsp.code = 0; rsp.count = q.PageWithAllRecordCount; return(rsp); }
/// <summary> /// 获取所有的收银员 /// </summary> /// <returns></returns> public List <Cashier> GetAllCashiers() { Employee emp = new Employee(); emp.JobName = "收银员"; OQL q = OQL.From(emp) .Select(emp.WorkNumber, emp.EmployeeName) .Where(emp.JobName) .OrderBy(emp.EmployeeName, "asc") .END; //List<Employee> list= EntityQuery<Employee>.QueryList(q); List <Employee> list = q.ToList <Employee>();//使用OQL扩展 return(list.ConvertAll <Cashier>(p => { return new Cashier() { CashierName = p.EmployeeName, WorkNumber = p.WorkNumber }; } )); }
/// <summary> /// 获取管理员列表(分页) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public JsonRsp <CustomReceiptedViewModel> GetPageList(int pageIndex, int pageSize) { JsonRsp <CustomReceiptedViewModel> rsp = new JsonRsp <CustomReceiptedViewModel>(); CustomReceiptedModel m = new CustomReceiptedModel(); OQL q = OQL.From(m) .Select() .OrderBy(m.ID, "asc") .END; //分页 q.Limit(pageSize, pageIndex, true); //q.PageWithAllRecordCount = allCount; //List<Employee> list= EntityQuery<Employee>.QueryList(q); List <CustomReceiptedModel> list = q.ToList <CustomReceiptedModel>();//使用OQL扩展 rsp.data = list.ConvertAll <CustomReceiptedViewModel>(o => { return(new CustomReceiptedViewModel() { ID = o.ID, CustomAccReceiptId = o.CustomAccReceiptId, BankAccountId = o.BankAccountId, CurrentAmount = o.CurrentAmount, BankSerialNumber = o.BankSerialNumber, DateOfEntry = o.DateOfEntry, CreateId = o.CreateId, CreateUser = o.CreateUser, CreateIP = o.CreateIP, CreateTime = o.CreateTime, Status = o.Status, }); } ); rsp.success = true; rsp.code = 0; rsp.count = q.PageWithAllRecordCount; return(rsp); }
/// <summary> /// 获取管理员列表(分页) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public JsonRsp <MenuViewModel> GetPageList(int pageIndex, int pageSize) { JsonRsp <MenuViewModel> rsp = new JsonRsp <MenuViewModel>(); AdminMenu m = new AdminMenu(); OQL q = OQL.From(m) .Select() .OrderBy(m.ID, "asc") .END; //分页 q.Limit(pageSize, pageIndex, true); //q.PageWithAllRecordCount = allCount; //List<Employee> list= EntityQuery<Employee>.QueryList(q); List <AdminMenu> list = q.ToList <AdminMenu>();//使用OQL扩展 rsp.data = list.ConvertAll <MenuViewModel>(o => { return(new MenuViewModel() { ID = o.ID, MenuKey = o.MenuKey, MenuName = o.MenuName, MenuUrl = o.MenuUrl, MenuType = o.MenuType, IDPath = o.IDPath, Remark = o.Remark, Sort = o.Sort, Status = o.Status, CreateTIme = o.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"), }); } ); rsp.success = true; rsp.code = 0; rsp.count = q.PageWithAllRecordCount; return(rsp); }
/// <summary> /// 获取管理员列表(分页) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public JsonRsp <TicketTypeViewModel> GetPageList(int pageIndex, int pageSize) { JsonRsp <TicketTypeViewModel> rsp = new JsonRsp <TicketTypeViewModel>(); TicketTypeModel m = new TicketTypeModel(); OQL q = OQL.From(m) .Select() .OrderBy(m.Sort, "desc") .END; //分页 q.Limit(pageSize, pageIndex, true); //q.PageWithAllRecordCount = allCount; //List<Employee> list= EntityQuery<Employee>.QueryList(q); List <TicketTypeModel> list = q.ToList <TicketTypeModel>();//使用OQL扩展 rsp.data = list.ConvertAll <TicketTypeViewModel>(o => { return(new TicketTypeViewModel() { ID = o.ID, TicketTypeName = o.TicketTypeName, CreateBy = o.CreateUser, CreateIP = o.CreateIP, CreateTime = o.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"), Sort = o.Sort, Status = o.Status, UpdateBy = o.UpdateUser, UpdateIP = o.UpdateIP, UpdateTime = o.UpdateTime == null ? "" : Convert.ToDateTime(o.UpdateTime).ToString("yyyy-MM-dd HH:mm:ss"), }); } ); rsp.success = true; rsp.code = 0; rsp.count = q.PageWithAllRecordCount; return(rsp); }
/// <summary> /// 获取列表(全部) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public JsonRsp <RoleViewModel> GetAllList() { JsonRsp <RoleViewModel> rsp = new JsonRsp <RoleViewModel>(); AdminRole model = new AdminRole(); OQL q = OQL.From(model) .Select() .OrderBy(model.ID, "asc") .END; List <AdminRole> list = q.ToList <AdminRole>();//使用OQL扩展 rsp.data = list.ConvertAll <RoleViewModel>(o => { return(new RoleViewModel() { ID = o.ID, RoleName = o.RoleName, CreateTIme = o.CreateTIme.ToString("yyyy-MM-dd HH:mm:ss"), }); } ); rsp.success = true; rsp.code = 0; return(rsp); }