public async Task <IResultModel> Query(RoleUserQueryModel model) { var result = new QueryResultModel <RoleUserEntity> { Rows = await _roleUserRepository.Query(model), Total = model.TotalCount }; return(ResultModel.Success(result)); }
public async Task <IList <RoleUserEntity> > Query(RoleUserQueryModel model) { var conditions = await _filter.GetConditions <RoleUserEntity, RoleUserQueryModel>(model); var query = _dbContext.Db.Queryable <RoleUserEntity>() .InnerJoin <UserEntity>((x, y) => x.UserId == y.Id && y.IsDel == false) .Select((x, y) => new RoleUserEntity { Id = x.Id.SelectAll(), UserCode = y.UserCode, UserName = y.UserName }) .MergeTable() .Where(conditions) .OrderBy(model.OrderFileds); RefAsync <int> totalCount = 0; var data = await query.ToPageListAsync(model.PageIndex, model.PageSize, totalCount); model.TotalCount = totalCount; return(data); }
public Task <IResultModel> Query([FromQuery] RoleUserQueryModel model) { return(_service.Query(model)); }