public async Task <List <RoleEntity> > GetPageList(RoleListParam param, Pagination pagination) { var expression = ListFilter(param); var list = await this.BaseRepository().FindList(expression, pagination); return(list.ToList()); }
public JsonResult List([FromUri] RoleListParam p) { var total = 0; var list = bll.List(p, out total); return(base.List <Role>(total, list)); }
private Expression <Func <RoleEntity, bool> > ListFilter(RoleListParam param) { var expression = LinqExtensions.True <RoleEntity>(); if (param != null) { if (!string.IsNullOrEmpty(param.RoleName)) { expression = expression.And(t => t.RoleName.Contains(param.RoleName)); } if (!string.IsNullOrEmpty(param.RoleIds)) { long[] roleIdArr = TextHelper.SplitToArray <long>(param.RoleIds, ','); expression = expression.And(t => roleIdArr.Contains(t.Id.Value)); } if (!string.IsNullOrEmpty(param.RoleName)) { expression = expression.And(t => t.RoleName.Contains(param.RoleName)); } if (param.RoleStatus > -1) { expression = expression.And(t => t.RoleStatus == param.RoleStatus); } if (!string.IsNullOrEmpty(param.StartTime.ParseToString())) { expression = expression.And(t => t.BaseModifyTime >= param.StartTime); } if (!string.IsNullOrEmpty(param.EndTime.ParseToString())) { param.EndTime = (param.EndTime.Value.ToString("yyyy-MM-dd") + " 23:59:59").ParseToDateTime(); expression = expression.And(t => t.BaseModifyTime <= param.EndTime); } } return(expression); }
public async Task <TData <List <RoleEntity> > > GetPageListJson([FromQuery] RoleListParam param, [FromQuery] Pagination pagination) { var obj = await _roleBLL.GetPageList(param, pagination); return(obj); }
public async Task <IActionResult> GetPageListJson(RoleListRequest paramRequest) { RoleListParam param = paramRequest.param; Pagination pagination = paramRequest.pagination; TData <List <RoleEntity> > obj = await sysRoleBLL.GetPageList(param, pagination); return(Json(obj)); }
public async Task <TData <List <RoleEntity> > > GetList(RoleListParam param) { var obj = new TData <List <RoleEntity> >(); obj.Data = await _roleService.GetList(param); obj.Tag = 1; return(obj); }
public async Task <TData <List <RoleEntity> > > GetPageList(RoleListParam param, Pagination pagination) { TData <List <RoleEntity> > obj = new TData <List <RoleEntity> >(); obj.Result = await roleService.GetPageList(param, pagination); obj.TotalCount = pagination.TotalCount; obj.Tag = 1; return(obj); }
public async Task <TData <List <RoleEntity> > > GetList(RoleListParam param) { TData <List <RoleEntity> > obj = new TData <List <RoleEntity> >(); obj.Result = await roleService.GetList(param); obj.TotalCount = obj.Result.Count; obj.Tag = 1; return(obj); }
public async Task <IActionResult> GetRoleName(RoleListParam param) { TData <string> obj = new TData <string>(); var list = await sysRoleBLL.GetList(param); if (list.Tag == 1) { obj.Result = string.Join(",", list.Result.Select(p => p.RoleName)); obj.Tag = 1; } return(Json(obj)); }
public async Task MultiSortTest() { RoleService roleService = new RoleService(); RoleListParam roleListParam = new RoleListParam { }; Pagination pagination = new Pagination { Sort = "Id desc,RoleSort asc" }; List <RoleEntity> list = await roleService.GetPageList(roleListParam, pagination); Assert.IsTrue(list[0].Id > list[1].Id); }
/// <summary> /// 带条件查询所有 /// </summary> public async Task <List <RoleEntity> > GetList(RoleListParam param) { #region 查询条件 var query = _roleEntityDB.AsQueryable(); /* * */ #endregion var data = await query.ToListAsync(); return(data); }
/// <summary> /// 分页查询 /// </summary> public async Task <List <RoleEntity> > GetPageList(RoleListParam param, Pagination pagination) { #region 查询条件 var query = _roleEntityDB.AsQueryable(); /* * */ var data = await query.OrderByDescending(a => a.Id) .ToPagedListAsync(pagination.PageIndex, pagination.PageSize); #endregion // 分页参数赋值 pagination.TotalCount = data.TotalCount; return(data.Items.ToList()); }
/// <summary> /// 列表 /// </summary> /// <param name="p"></param> /// <param name="total"></param> /// <returns></returns> public IList <Role> List(RoleListParam p, out int total) { ICriterion query = Restrictions.Gt("Status", -1); // 编码、名称 if (!string.IsNullOrEmpty(p.Name)) { var query1 = Restrictions.Like("Code", p.Name, MatchMode.Anywhere); var query2 = Restrictions.Like("Name", p.Name, MatchMode.Anywhere); var query3 = Restrictions.Or(query1, query2); query = Restrictions.And(query, query3); } // 状态 if (p.Status != null) { var query1 = Restrictions.Eq("Status", p.Status); query = Restrictions.And(query, query1); } var list = dal.List(p.firstResult, p.maxResults, out total); return(list); }
public async Task <IActionResult> GetPageListJson(RoleListParam param, Pagination pagination) { TData <List <RoleEntity> > obj = await sysRoleBLL.GetPageList(param, pagination); return(Json(obj)); }
public async Task <IActionResult> GetListJson(RoleListParam param) { TData <List <RoleEntity> > obj = await roleBLL.GetList(param); return(Json(obj)); }
public async Task <TData <List <RoleEntity> > > GetListJson([FromQuery] RoleListParam param) { var obj = await _roleBLL.GetList(param); return(obj); }